aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2014-02-28 09:33:48 -0500
committerMike Snitzer <snitzer@redhat.com>2014-03-27 16:56:25 -0400
commit9bf59a611a5eb479f321fae34adc9f948de0a42f (patch)
tree0ad88aa4377521d9c082b1a5251e00fa01bd987d
parent36fcffcc6500228efdfaf3a36761dd57a38366e3 (diff)
dm mpath: remove extra nesting in map function
Return early for case when no path exists, and when the pathgroup isn't ready. This eliminates the need for extra nesting for the the common case. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Hannes Reinecke <hare@suse.de>
-rw-r--r--drivers/md/dm-mpath.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 07ca77f29438..e7d80baf8d69 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -398,29 +398,31 @@ static int multipath_map(struct dm_target *ti, struct request *clone,
398 398
399 pgpath = m->current_pgpath; 399 pgpath = m->current_pgpath;
400 400
401 if (pgpath) { 401 if (!pgpath) {
402 if (pg_ready(m)) { 402 if (!__must_push_back(m))
403 if (set_mapinfo(m, map_context) < 0) 403 r = -EIO; /* Failed */
404 /* ENOMEM, requeue */ 404 goto out_unlock;
405 goto out_unlock; 405 }
406 406 if (!pg_ready(m)) {
407 bdev = pgpath->path.dev->bdev;
408 clone->q = bdev_get_queue(bdev);
409 clone->rq_disk = bdev->bd_disk;
410 clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
411 mpio = map_context->ptr;
412 mpio->pgpath = pgpath;
413 mpio->nr_bytes = nr_bytes;
414 if (pgpath->pg->ps.type->start_io)
415 pgpath->pg->ps.type->start_io(&pgpath->pg->ps,
416 &pgpath->path,
417 nr_bytes);
418 r = DM_MAPIO_REMAPPED;
419 goto out_unlock;
420 }
421 __pg_init_all_paths(m); 407 __pg_init_all_paths(m);
422 } else if (!__must_push_back(m)) 408 goto out_unlock;
423 r = -EIO; /* Failed */ 409 }
410 if (set_mapinfo(m, map_context) < 0)
411 /* ENOMEM, requeue */
412 goto out_unlock;
413
414 bdev = pgpath->path.dev->bdev;
415 clone->q = bdev_get_queue(bdev);
416 clone->rq_disk = bdev->bd_disk;
417 clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
418 mpio = map_context->ptr;
419 mpio->pgpath = pgpath;
420 mpio->nr_bytes = nr_bytes;
421 if (pgpath->pg->ps.type->start_io)
422 pgpath->pg->ps.type->start_io(&pgpath->pg->ps,
423 &pgpath->path,
424 nr_bytes);
425 r = DM_MAPIO_REMAPPED;
424 426
425out_unlock: 427out_unlock:
426 spin_unlock_irqrestore(&m->lock, flags); 428 spin_unlock_irqrestore(&m->lock, flags);