don't remove from shrink list in select_collect()
If we find something already on a shrink list, just increment data->found and do nothing else. Loops in shrink_dcache_parent() and check_submounts_and_drop() will do the right thing - everything we did put into our list will be evicted and if there had been nothing, but data->found got non-zero, well, we have somebody else shrinking those guys; just try again. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
41edf278fc
commit
fe91522a7b
1 changed files with 10 additions and 21 deletions
27
fs/dcache.c
27
fs/dcache.c
|
@ -1229,34 +1229,23 @@ static enum d_walk_ret select_collect(void *_data, struct dentry *dentry)
|
||||||
if (data->start == dentry)
|
if (data->start == dentry)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/*
|
if (dentry->d_flags & DCACHE_SHRINK_LIST) {
|
||||||
* move only zero ref count dentries to the dispose list.
|
data->found++;
|
||||||
*
|
} else {
|
||||||
* Those which are presently on the shrink list, being processed
|
if (dentry->d_flags & DCACHE_LRU_LIST)
|
||||||
* by shrink_dentry_list(), shouldn't be moved. Otherwise the
|
|
||||||
* loop in shrink_dcache_parent() might not make any progress
|
|
||||||
* and loop forever.
|
|
||||||
*/
|
|
||||||
if (dentry->d_lockref.count) {
|
|
||||||
dentry_lru_del(dentry);
|
|
||||||
} else if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) {
|
|
||||||
/*
|
|
||||||
* We can't use d_lru_shrink_move() because we
|
|
||||||
* need to get the global LRU lock and do the
|
|
||||||
* LRU accounting.
|
|
||||||
*/
|
|
||||||
d_lru_del(dentry);
|
d_lru_del(dentry);
|
||||||
|
if (!dentry->d_lockref.count) {
|
||||||
d_shrink_add(dentry, &data->dispose);
|
d_shrink_add(dentry, &data->dispose);
|
||||||
data->found++;
|
data->found++;
|
||||||
ret = D_WALK_NORETRY;
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* We can return to the caller if we have found some (this
|
* We can return to the caller if we have found some (this
|
||||||
* ensures forward progress). We'll be coming back to find
|
* ensures forward progress). We'll be coming back to find
|
||||||
* the rest.
|
* the rest.
|
||||||
*/
|
*/
|
||||||
if (data->found && need_resched())
|
if (!list_empty(&data->dispose))
|
||||||
ret = D_WALK_QUIT;
|
ret = need_resched() ? D_WALK_QUIT : D_WALK_NORETRY;
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue