Skip to content

Commit 8bfb40b

Browse files
linke librauner
authored andcommitted
fs/dcache: Re-use value stored to dentry->d_flags instead of re-reading
Currently, the __d_clear_type_and_inode() writes the value flags to dentry->d_flags, then immediately re-reads it in order to use it in a if statement. This re-read is useless because no other update to dentry->d_flags can occur at this point. This commit therefore re-use flags in the if statement instead of re-reading dentry->d_flags. Signed-off-by: linke li <lilinke99@qq.com> Link: https://lore.kernel.org/r/tencent_5E187BD0A61BA28605E85405F15228254D0A@qq.com Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 886b94d commit 8bfb40b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/dcache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ static inline void __d_clear_type_and_inode(struct dentry *dentry)
355355
flags &= ~DCACHE_ENTRY_TYPE;
356356
WRITE_ONCE(dentry->d_flags, flags);
357357
dentry->d_inode = NULL;
358-
if (dentry->d_flags & DCACHE_LRU_LIST)
358+
if (flags & DCACHE_LRU_LIST)
359359
this_cpu_inc(nr_dentry_negative);
360360
}
361361

0 commit comments

Comments
 (0)