summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2026-04-11 03:06:39 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2026-06-05 00:34:55 -0400
commit500590a897d9edadfffaed09f25f67ed7cd1813b (patch)
tree5f747d8401bb66b09cfba0c53d450d8365632605
parentcb2ae3c99214013bde780a5e4c575588cf301eba (diff)
downloadlinux-500590a897d9edadfffaed09f25f67ed7cd1813b.tar.gz
linux-500590a897d9edadfffaed09f25f67ed7cd1813b.zip
fold lock_for_kill() into shrink_kill()
Both callers have exact same shape. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/dcache.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index ffaaf48533e6..3325ca535bf6 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1211,14 +1211,15 @@ EXPORT_SYMBOL(d_prune_aliases);
static inline void shrink_kill(struct dentry *victim)
{
- do {
+ while (lock_for_kill(victim)) {
rcu_read_unlock();
victim = __dentry_kill(victim);
+ if (!victim)
+ return;
rcu_read_lock();
- } while (victim && lock_for_kill(victim));
+ }
+ spin_unlock(&victim->d_lock);
rcu_read_unlock();
- if (victim)
- spin_unlock(&victim->d_lock);
}
void shrink_dentry_list(struct list_head *list)
@@ -1235,12 +1236,7 @@ void shrink_dentry_list(struct list_head *list)
continue;
}
rcu_read_lock();
- if (!lock_for_kill(dentry)) {
- spin_unlock(&dentry->d_lock);
- rcu_read_unlock();
- } else {
- shrink_kill(dentry);
- }
+ shrink_kill(dentry);
}
}
EXPORT_SYMBOL(shrink_dentry_list);
@@ -1688,12 +1684,7 @@ static void shrink_dcache_tree(struct dentry *parent, bool for_umount)
wait_for_completion(&wait.completion);
continue;
}
- if (!lock_for_kill(v)) {
- spin_unlock(&v->d_lock);
- rcu_read_unlock();
- } else {
- shrink_kill(v);
- }
+ shrink_kill(v);
}
if (!list_empty(&data.dispose))
shrink_dentry_list(&data.dispose);