Skip to content

Commit 830c0f0

Browse files
committed
vfs: renumber DCACHE_xyz flags, remove some stale ones
Gcc tends to generate better code with small integers, including the DCACHE_xyz flag tests - so move the common ones to be first in the list. Also just remove the unused DCACHE_INOTIFY_PARENT_WATCHED and DCACHE_AUTOFS_PENDING values, their users no longer exists in the source tree. And add a "unlikely()" to the DCACHE_OP_COMPARE test, since we want the common case to be a nice straight-line fall-through. Signed-off-by: Linus Torvalds <[email protected]>
1 parent 7cd4767 commit 830c0f0

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

fs/dcache.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name,
17291729
*/
17301730
if (read_seqcount_retry(&dentry->d_seq, *seq))
17311731
goto seqretry;
1732-
if (parent->d_flags & DCACHE_OP_COMPARE) {
1732+
if (unlikely(parent->d_flags & DCACHE_OP_COMPARE)) {
17331733
if (parent->d_op->d_compare(parent, *inode,
17341734
dentry, i,
17351735
tlen, tname, name))

include/linux/dcache.h

+13-17
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ struct dentry_operations {
180180
*/
181181

182182
/* d_flags entries */
183-
#define DCACHE_AUTOFS_PENDING 0x0001 /* autofs: "under construction" */
184-
#define DCACHE_NFSFS_RENAMED 0x0002
185-
/* this dentry has been "silly renamed" and has to be deleted on the last
186-
* dput() */
183+
#define DCACHE_OP_HASH 0x0001
184+
#define DCACHE_OP_COMPARE 0x0002
185+
#define DCACHE_OP_REVALIDATE 0x0004
186+
#define DCACHE_OP_DELETE 0x0008
187187

188-
#define DCACHE_DISCONNECTED 0x0004
188+
#define DCACHE_DISCONNECTED 0x0010
189189
/* This dentry is possibly not currently connected to the dcache tree, in
190190
* which case its parent will either be itself, or will have this flag as
191191
* well. nfsd will not use a dentry with this bit set, but will first
@@ -196,22 +196,18 @@ struct dentry_operations {
196196
* dentry into place and return that dentry rather than the passed one,
197197
* typically using d_splice_alias. */
198198

199-
#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
200-
#define DCACHE_RCUACCESS 0x0010 /* Entry has ever been RCU-visible */
201-
#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020
202-
/* Parent inode is watched by inotify */
203-
204-
#define DCACHE_COOKIE 0x0040 /* For use by dcookie subsystem */
205-
#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080
206-
/* Parent inode is watched by some fsnotify listener */
199+
#define DCACHE_REFERENCED 0x0020 /* Recently used, don't discard. */
200+
#define DCACHE_RCUACCESS 0x0040 /* Entry has ever been RCU-visible */
207201

208202
#define DCACHE_CANT_MOUNT 0x0100
209203
#define DCACHE_GENOCIDE 0x0200
210204

211-
#define DCACHE_OP_HASH 0x1000
212-
#define DCACHE_OP_COMPARE 0x2000
213-
#define DCACHE_OP_REVALIDATE 0x4000
214-
#define DCACHE_OP_DELETE 0x8000
205+
#define DCACHE_NFSFS_RENAMED 0x1000
206+
/* this dentry has been "silly renamed" and has to be deleted on the last
207+
* dput() */
208+
#define DCACHE_COOKIE 0x2000 /* For use by dcookie subsystem */
209+
#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x4000
210+
/* Parent inode is watched by some fsnotify listener */
215211

216212
#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */
217213
#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */

0 commit comments

Comments
 (0)