dm-mpath: move the place of decrementing repeat_count
PATCH 1/1 dm-mpath: move the place of decrementing repeat_count
Hi Alasdair,
'repeat_count' counting code is a little bit difficult to understand why decrementing it before using m->current_pgpath. 'repeat_count' should be decremented only when an I/O is mapped to m->current_pgpath.
This patch changes the place of decrementing 'repeat_count' for easy understanding.
Basically, no functional change, but there is a minor behavior change when '0' is specified for 'repeat_count':
before: No path switching happens
after : Path switching happens everytime
I think that no one should specify '0'.
This patch can be applied on top of 2.6.26-rc5.
Please review and apply.
Thanks,
Kiyoshi Ueda
Signed-off-by Kiyoshi Ueda <[email protected]>
Signed-off-by Jun'ichi Nomura <[email protected]>
--- drivers/md/dm-mpath.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/md/dm-mpath.c +5 -4
@@ -314,8 +314,7 @@ static int map_io(struct multipath *m, sspin_lock_irqsave (&m->lock, flags);/* Do we need to select a new pgpath? */ -if (!m->current_pgpath || - (!m->queue_io && (m->repeat_count && --m->repeat_count ==0 ))) +if (!m->current_pgpath || (!m->queue_io && m->repeat_count ==0 ))__choose_pgpath (m); pgpath = m->current_pgpath;
@@ -333,9 +332,11 @@ static int map_io(struct multipath *m, squeue_work (kmultipathd, &m->process_queued_ios); pgpath =NULL ; r =DM_MAPIO_SUBMITTED ; - }else if (pgpath) + }else if (pgpath) { bio->bi_bdev = pgpath->path.dev->bdev; -else if (__must_push_back (m)) +if (m->repeat_count) + --m->repeat_count; + }else if (__must_push_back (m)) r =DM_MAPIO_REQUEUE ;else r = -EIO ;/* Failed */