Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8fd52ee authored by Shaohua Li's avatar Shaohua Li
Browse files

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: default avatarShaohua Li <shli@fb.com>
parent 5a6265f9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1418,10 +1418,10 @@ 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;
			}
		}
		spin_unlock(&conf->device_lock);
		spin_unlock_irqrestore(&log->stripe_in_journal_lock, flags);
	}