Skip to content

Commit 1b327b5

Browse files
author
Al Viro
committed
kill DCACHE_MAY_FREE
With the new ordering in __dentry_kill() it has become redundant - it's set if and only if both DCACHE_DENTRY_KILLED and DCACHE_SHRINK_LIST are set. We set it in __dentry_kill(), after having set DCACHE_DENTRY_KILLED with the only condition being that DCACHE_SHRINK_LIST is there; all of that is done without dropping ->d_lock and the only place that checks that flag (shrink_dentry_list()) does so under ->d_lock, after having found the victim on its shrink list. Since DCACHE_SHRINK_LIST is set only when placing dentry into shrink list and removed only by shrink_dentry_list() itself, a check for DCACHE_DENTRY_KILLED in there would be equivalent to check for DCACHE_MAY_FREE. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 119dcc7 commit 1b327b5

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

fs/dcache.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,10 +614,8 @@ static struct dentry *__dentry_kill(struct dentry *dentry)
614614
}
615615
spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
616616
dentry_unlist(dentry);
617-
if (dentry->d_flags & DCACHE_SHRINK_LIST) {
618-
dentry->d_flags |= DCACHE_MAY_FREE;
617+
if (dentry->d_flags & DCACHE_SHRINK_LIST)
619618
can_free = false;
620-
}
621619
spin_unlock(&dentry->d_lock);
622620
if (likely(can_free))
623621
dentry_free(dentry);
@@ -1072,7 +1070,7 @@ void shrink_dentry_list(struct list_head *list)
10721070
bool can_free;
10731071
rcu_read_unlock();
10741072
d_shrink_del(dentry);
1075-
can_free = dentry->d_flags & DCACHE_MAY_FREE;
1073+
can_free = dentry->d_flags & DCACHE_DENTRY_KILLED;
10761074
spin_unlock(&dentry->d_lock);
10771075
if (can_free)
10781076
dentry_free(dentry);

include/linux/dcache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ struct dentry_operations {
202202
#define DCACHE_SPECIAL_TYPE (5 << 20) /* Other file type */
203203
#define DCACHE_SYMLINK_TYPE (6 << 20) /* Symlink */
204204

205-
#define DCACHE_MAY_FREE BIT(23)
206205
#define DCACHE_NOKEY_NAME BIT(25) /* Encrypted name encoded without key */
207206
#define DCACHE_OP_REAL BIT(26)
208207

0 commit comments

Comments
 (0)