]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
switch select_collect{,2}() to use of to_shrink_list()
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 31 Oct 2023 01:07:34 +0000 (21:07 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 25 Nov 2023 07:34:13 +0000 (02:34 -0500)
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/dcache.c

index 704676bf06fd5d154e6e673a2686f4c2d95c7a18..f68fe7c863e005529c44ace5b8a035c7e5bab448 100644 (file)
@@ -1495,13 +1495,9 @@ static enum d_walk_ret select_collect(void *_data, struct dentry *dentry)
 
        if (dentry->d_flags & DCACHE_SHRINK_LIST) {
                data->found++;
-       } else {
-               if (dentry->d_flags & DCACHE_LRU_LIST)
-                       d_lru_del(dentry);
-               if (!dentry->d_lockref.count) {
-                       d_shrink_add(dentry, &data->dispose);
-                       data->found++;
-               }
+       } else if (!dentry->d_lockref.count) {
+               to_shrink_list(dentry, &data->dispose);
+               data->found++;
        }
        /*
         * We can return to the caller if we have found some (this
@@ -1522,17 +1518,13 @@ static enum d_walk_ret select_collect2(void *_data, struct dentry *dentry)
        if (data->start == dentry)
                goto out;
 
-       if (dentry->d_flags & DCACHE_SHRINK_LIST) {
-               if (!dentry->d_lockref.count) {
+       if (!dentry->d_lockref.count) {
+               if (dentry->d_flags & DCACHE_SHRINK_LIST) {
                        rcu_read_lock();
                        data->victim = dentry;
                        return D_WALK_QUIT;
                }
-       } else {
-               if (dentry->d_flags & DCACHE_LRU_LIST)
-                       d_lru_del(dentry);
-               if (!dentry->d_lockref.count)
-                       d_shrink_add(dentry, &data->dispose);
+               to_shrink_list(dentry, &data->dispose);
        }
        /*
         * We can return to the caller if we have found some (this