diff options
author | Shaohua Li <shli@fb.com> | 2017-02-10 16:18:08 -0800 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-02-13 09:20:02 -0800 |
commit | e8fd52eec2cd25b917983b3f3aa738b722522376 (patch) | |
tree | d47554c2afa2ee5bb8e4bce797779c7c5c4eff7e /drivers/md | |
parent | 5a6265f9cd98b82d89778b806bc50b3d368c8273 (diff) | |
download | linux-e8fd52eec2cd25b917983b3f3aa738b722522376.tar.gz linux-e8fd52eec2cd25b917983b3f3aa738b722522376.tar.bz2 linux-e8fd52eec2cd25b917983b3f3aa738b722522376.zip |
md/raid5-cache: stripe reclaim only counts valid stripes
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>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid5-cache.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index caae85331a02..a01f4daeb390 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c @@ -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); |