Skip to content

Commit e8fd52e

Browse files
committed
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>
1 parent 5a6265f commit e8fd52e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/md/raid5-cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,9 +1418,9 @@ static void r5c_do_reclaim(struct r5conf *conf)
14181418
!test_bit(STRIPE_HANDLE, &sh->state) &&
14191419
atomic_read(&sh->count) == 0) {
14201420
r5c_flush_stripe(conf, sh);
1421+
if (count++ >= R5C_RECLAIM_STRIPE_GROUP)
1422+
break;
14211423
}
1422-
if (count++ >= R5C_RECLAIM_STRIPE_GROUP)
1423-
break;
14241424
}
14251425
spin_unlock(&conf->device_lock);
14261426
spin_unlock_irqrestore(&log->stripe_in_journal_lock, flags);

0 commit comments

Comments
 (0)