]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
md/raid5-cache: stripe reclaim only counts valid stripes
authorShaohua Li <shli@fb.com>
Sat, 11 Feb 2017 00:18:08 +0000 (16:18 -0800)
committerShaohua Li <shli@fb.com>
Mon, 13 Feb 2017 17:20:02 +0000 (09:20 -0800)
When log space is tight, we try to reclaim stripes from log head. There
are stripes which can't be reclaimed right now if some conditions are
met. We skip such stripes but accidentally count them, which might cause
no stripes are claimed. Fixing this by only counting valid stripes.

Cc: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid5-cache.c

index caae85331a0250dda356e122e0755fdb9dd5b6d0..a01f4daeb390fa79f72777cf2fa63a77105b2d00 100644 (file)
@@ -1418,9 +1418,9 @@ static void r5c_do_reclaim(struct r5conf *conf)
                            !test_bit(STRIPE_HANDLE, &sh->state) &&
                            atomic_read(&sh->count) == 0) {
                                r5c_flush_stripe(conf, sh);
+                               if (count++ >= R5C_RECLAIM_STRIPE_GROUP)
+                                       break;
                        }
-                       if (count++ >= R5C_RECLAIM_STRIPE_GROUP)
-                               break;
                }
                spin_unlock(&conf->device_lock);
                spin_unlock_irqrestore(&log->stripe_in_journal_lock, flags);