From: Mike Snitzer Date: Sun, 31 Jan 2016 22:38:28 +0000 (-0500) Subject: dm mpath: use blk_mq_alloc_request() and blk_mq_free_request() directly X-Git-Tag: next-20160210~48^2~3 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b6a58d6c2b4fbd8a2ac073a9aa56d8891af4a33b;p=karo-tx-linux.git dm mpath: use blk_mq_alloc_request() and blk_mq_free_request() directly There isn't any need to support both old .request_fn and blk-mq paths in the blk-mq specific portion of __multipath_map(). Call blk_mq_alloc_request() directly rather than use blk_get_request(). Similarly, call blk_mq_free_request(), rather than blk_put_request(), in multipath_release_clone(). Signed-off-by: Mike Snitzer --- diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 612ec571862d..798644624663 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -23,6 +23,7 @@ #include #include #include +#include #define DM_MSG_PREFIX "multipath" #define DM_PG_INIT_DELAY_MSECS 2000 @@ -439,14 +440,22 @@ static int __multipath_map(struct dm_target *ti, struct request *clone, spin_unlock_irq(&m->lock); if (clone) { - /* Old request-based interface: allocated clone is passed in */ + /* + * Old request-based interface: allocated clone is passed in. + * Used by both: .request_fn stacked on .request_fn path(s) and + * blk-mq stacked on .request_fn path(s). + */ clone->q = bdev_get_queue(bdev); clone->rq_disk = bdev->bd_disk; clone->cmd_flags |= REQ_FAILFAST_TRANSPORT; } else { - /* blk-mq request-based interface */ - *__clone = blk_get_request(bdev_get_queue(bdev), - rq_data_dir(rq), GFP_ATOMIC); + /* + * blk-mq request-based interface; used by both: + * .request_fn stacked on blk-mq path(s) and + * blk-mq stacked on blk-mq path(s). + */ + *__clone = blk_mq_alloc_request(bdev_get_queue(bdev), + rq_data_dir(rq), BLK_MQ_REQ_NOWAIT); if (IS_ERR(*__clone)) { /* ENOMEM, requeue */ return r; @@ -483,7 +492,7 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, static void multipath_release_clone(struct request *clone) { - blk_put_request(clone); + blk_mq_free_request(clone); } /*