Lines Matching refs:md
19 struct mapped_device *md;
60 int dm_request_based(struct mapped_device *md)
62 return queue_is_mq(md->queue);
128 static void rq_end_stats(struct mapped_device *md, struct request *orig)
130 if (unlikely(dm_stats_used(&md->stats))) {
133 dm_stats_account_io(&md->stats, rq_data_dir(orig),
140 * Don't touch any member of the md after calling this function because
141 * the md may be freed in dm_put() at the end of this function.
144 static void rq_completed(struct mapped_device *md)
149 dm_put(md);
160 struct mapped_device *md = tio->md;
166 rq_end_stats(md, rq);
168 rq_completed(md);
176 void dm_mq_kick_requeue_list(struct mapped_device *md)
178 __dm_mq_kick_requeue_list(md->queue, 0);
190 struct mapped_device *md = tio->md;
194 rq_end_stats(md, rq);
201 rq_completed(md);
220 disable_discard(tio->md);
223 disable_write_same(tio->md);
226 disable_write_zeroes(tio->md);
261 struct mapped_device *md = tio->md;
263 rq_end_stats(md, rq);
265 rq_completed(md);
341 r = blk_rq_prep_clone(clone, rq, &tio->md->bs, gfp_mask,
355 struct mapped_device *md)
357 tio->md = md;
368 if (!md->init_tio_pdu)
382 struct mapped_device *md = tio->md;
400 trace_block_rq_remap(clone, disk_devt(dm_disk(md)),
431 ssize_t dm_attr_rq_based_seq_io_merge_deadline_show(struct mapped_device *md, char *buf)
436 ssize_t dm_attr_rq_based_seq_io_merge_deadline_store(struct mapped_device *md,
442 static void dm_start_request(struct mapped_device *md, struct request *orig)
446 if (unlikely(dm_stats_used(&md->stats))) {
450 dm_stats_account_io(&md->stats, rq_data_dir(orig),
456 * Hold the md reference here for the in-flight I/O.
462 dm_get(md);
468 struct mapped_device *md = set->driver_data;
472 * Must initialize md member of tio, otherwise it won't
475 tio->md = md;
477 if (md->init_tio_pdu) {
490 struct mapped_device *md = tio->md;
491 struct dm_target *ti = md->immutable_target;
497 map = dm_get_live_table(md, &srcu_idx);
499 dm_put_live_table(md, srcu_idx);
503 dm_put_live_table(md, srcu_idx);
509 dm_start_request(md, rq);
511 /* Init tio using md established in .init_request */
512 init_tio(tio, rq, md);
522 rq_end_stats(md, rq);
523 rq_completed(md);
536 int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t)
542 md->tag_set = kzalloc_node(sizeof(struct blk_mq_tag_set), GFP_KERNEL, md->numa_node_id);
543 if (!md->tag_set)
546 md->tag_set->ops = &dm_mq_ops;
547 md->tag_set->queue_depth = dm_get_blk_mq_queue_depth();
548 md->tag_set->numa_node = md->numa_node_id;
549 md->tag_set->flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING;
550 md->tag_set->nr_hw_queues = dm_get_blk_mq_nr_hw_queues();
551 md->tag_set->driver_data = md;
553 md->tag_set->cmd_size = sizeof(struct dm_rq_target_io);
557 md->tag_set->cmd_size += immutable_tgt->per_io_data_size;
558 md->init_tio_pdu = true;
561 err = blk_mq_alloc_tag_set(md->tag_set);
565 q = blk_mq_init_allocated_queue(md->tag_set, md->queue, true);
574 blk_mq_free_tag_set(md->tag_set);
576 kfree(md->tag_set);
577 md->tag_set = NULL;
582 void dm_mq_cleanup_mapped_device(struct mapped_device *md)
584 if (md->tag_set) {
585 blk_mq_free_tag_set(md->tag_set);
586 kfree(md->tag_set);
587 md->tag_set = NULL;