[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [PATCH] 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 <k-ueda ct jp nec com>
Signed-off-by: Jun'ichi Nomura <j-nomura ce jp nec com>
---
 drivers/md/dm-mpath.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

Index: 2.6.26-rc5/drivers/md/dm-mpath.c
===================================================================
--- 2.6.26-rc5.orig/drivers/md/dm-mpath.c
+++ 2.6.26-rc5/drivers/md/dm-mpath.c
@@ -314,8 +314,7 @@ static int map_io(struct multipath *m, s
 	spin_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, s
 			queue_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 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]