Commit 9bf59a61 authored by Mike Snitzer's avatar Mike Snitzer

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: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
parent 36fcffcc
...@@ -398,29 +398,31 @@ static int multipath_map(struct dm_target *ti, struct request *clone, ...@@ -398,29 +398,31 @@ static int multipath_map(struct dm_target *ti, struct request *clone,
pgpath = m->current_pgpath; pgpath = m->current_pgpath;
if (pgpath) { if (!pgpath) {
if (pg_ready(m)) { if (!__must_push_back(m))
if (set_mapinfo(m, map_context) < 0) r = -EIO; /* Failed */
/* ENOMEM, requeue */ goto out_unlock;
goto out_unlock; }
if (!pg_ready(m)) {
bdev = pgpath->path.dev->bdev;
clone->q = bdev_get_queue(bdev);
clone->rq_disk = bdev->bd_disk;
clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
mpio = map_context->ptr;
mpio->pgpath = pgpath;
mpio->nr_bytes = nr_bytes;
if (pgpath->pg->ps.type->start_io)
pgpath->pg->ps.type->start_io(&pgpath->pg->ps,
&pgpath->path,
nr_bytes);
r = DM_MAPIO_REMAPPED;
goto out_unlock;
}
__pg_init_all_paths(m); __pg_init_all_paths(m);
} else if (!__must_push_back(m)) goto out_unlock;
r = -EIO; /* Failed */ }
if (set_mapinfo(m, map_context) < 0)
/* ENOMEM, requeue */
goto out_unlock;
bdev = pgpath->path.dev->bdev;
clone->q = bdev_get_queue(bdev);
clone->rq_disk = bdev->bd_disk;
clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
mpio = map_context->ptr;
mpio->pgpath = pgpath;
mpio->nr_bytes = nr_bytes;
if (pgpath->pg->ps.type->start_io)
pgpath->pg->ps.type->start_io(&pgpath->pg->ps,
&pgpath->path,
nr_bytes);
r = DM_MAPIO_REMAPPED;
out_unlock: out_unlock:
spin_unlock_irqrestore(&m->lock, flags); spin_unlock_irqrestore(&m->lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment