[dm-devel] [PATCH 6/7] dm-mpath: Avoid code duplication in __multipath_map()
Mike Snitzer
snitzer at redhat.com
Wed Nov 16 00:39:36 UTC 2016
On Tue, Nov 15 2016 at 6:34pm -0500,
Bart Van Assche <bart.vanassche at sandisk.com> wrote:
> Move common code out of if (clone) { ... } else { ... }.
>
> Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
> ---
> drivers/md/dm-mpath.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
> index 5c73818..7559537 100644
> --- a/drivers/md/dm-mpath.c
> +++ b/drivers/md/dm-mpath.c
> @@ -574,8 +574,6 @@ static int __multipath_map(struct dm_target *ti, struct request *clone,
> * Used by: .request_fn 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; used by both:
> @@ -591,9 +589,9 @@ static int __multipath_map(struct dm_target *ti, struct request *clone,
> }
> *__clone = clone;
> clone->bio = clone->biotail = NULL;
> - clone->rq_disk = bdev->bd_disk;
> - clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
> }
> + clone->rq_disk = bdev->bd_disk;
> + clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
>
> if (pgpath->pg->ps.type->start_io)
> pgpath->pg->ps.type->start_io(&pgpath->pg->ps,
> --
> 2.10.1
I conciously left this duplication to avoid sprawling setup of the clone
request. This isn't a lot of duplication here...
More information about the dm-devel
mailing list