We only want to send the speedup to the lower layers when there's a shortage.

Only send a speedup when there's a shortage. While this is a little racy, lost
races aren't a big deal for this function. If there's a shorage just popping up
after we check these values, then we'll catch it next time. If there's a
shortage that's just clearing up, we may do some work at the lower layers a
little sooner than we otherwise would have. Sicne shortages are relatively rare
events, both races are acceptable.

Reviewed by: chs
Differential Revision: https://reviews.freebsd.org/D23182
This commit is contained in:
Warner Losh 2020-01-17 01:16:23 +00:00
parent 3cf5dd8401
commit 38b37b93d4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356820

View file

@ -13771,23 +13771,28 @@ check_clear_deps(mp)
struct mount *mp;
{
struct ufsmount *ump;
bool suj_susp;
/*
* Tell the lower layers that any TRIM or WRITE transactions
* that have been delayed for performance reasons should
* proceed to help alleviate the shortage faster.
* Tell the lower layers that any TRIM or WRITE transactions that have
* been delayed for performance reasons should proceed to help alleviate
* the shortage faster. The race between checking req_* and the softdep
* mutex (lk) is fine since this is an advisory operation that at most
* causes deferred work to be done sooner.
*/
ump = VFSTOUFS(mp);
FREE_LOCK(ump);
softdep_send_speedup(ump, 0, BIO_SPEEDUP_TRIM | BIO_SPEEDUP_WRITE);
ACQUIRE_LOCK(ump);
suj_susp = MOUNTEDSUJ(mp) && ump->softdep_jblocks->jb_suspended;
if (req_clear_remove || req_clear_inodedeps || suj_susp) {
FREE_LOCK(ump);
softdep_send_speedup(ump, 0, BIO_SPEEDUP_TRIM | BIO_SPEEDUP_WRITE);
ACQUIRE_LOCK(ump);
}
/*
* If we are suspended, it may be because of our using
* too many inodedeps, so help clear them out.
*/
if (MOUNTEDSUJ(mp) && VFSTOUFS(mp)->softdep_jblocks->jb_suspended)
if (suj_susp)
clear_inodedeps(mp);
/*