Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0d80ea3 authored by linke li's avatar linke li Committed by Greg Kroah-Hartman
Browse files

fs/dcache: Re-use value stored to dentry->d_flags instead of re-reading



[ Upstream commit 8bfb40be31ddea0cb4664b352e1797cfe6c91976 ]

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: default avatarlinke li <lilinke99@qq.com>
Link: https://lore.kernel.org/r/tencent_5E187BD0A61BA28605E85405F15228254D0A@qq.com


Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
Stable-dep-of: aabfe57ebaa7 ("vfs: don't mod negative dentry count when on shrinker list")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 1cbbb3d9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ static inline void __d_clear_type_and_inode(struct dentry *dentry)
	flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU);
	WRITE_ONCE(dentry->d_flags, flags);
	dentry->d_inode = NULL;
	if (dentry->d_flags & DCACHE_LRU_LIST)
	if (flags & DCACHE_LRU_LIST)
		this_cpu_inc(nr_dentry_negative);
}