aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/dcache.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:34:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:34:18 -0500
commit9bc9ccd7db1c9f043f75380b5a5b94912046a60e (patch)
treedd0a1b3396ae9414f668b0110cc39d11268ad3ed /include/linux/dcache.h
parentf0230294271f511b41797305b685365a9e569a09 (diff)
parentbdd3536618443809d18868563eeafa63b9d29603 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro: "All kinds of stuff this time around; some more notable parts: - RCU'd vfsmounts handling - new primitives for coredump handling - files_lock is gone - Bruce's delegations handling series - exportfs fixes plus misc stuff all over the place" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (101 commits) ecryptfs: ->f_op is never NULL locks: break delegations on any attribute modification locks: break delegations on link locks: break delegations on rename locks: helper functions for delegation breaking locks: break delegations on unlink namei: minor vfs_unlink cleanup locks: implement delegations locks: introduce new FL_DELEG lock flag vfs: take i_mutex on renamed file vfs: rename I_MUTEX_QUOTA now that it's not used for quotas vfs: don't use PARENT/CHILD lock classes for non-directories vfs: pull ext4's double-i_mutex-locking into common code exportfs: fix quadratic behavior in filehandle lookup exportfs: better variable name exportfs: move most of reconnect_path to helper function exportfs: eliminate unused "noprogress" counter exportfs: stop retrying once we race with rename/remove exportfs: clear DISCONNECTED on all parents sooner exportfs: more detailed comment for path_reconnect ...
Diffstat (limited to 'include/linux/dcache.h')
-rw-r--r--include/linux/dcache.h104
1 files changed, 84 insertions, 20 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 59066e0b4ff1..57e87e749a48 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -169,13 +169,13 @@ struct dentry_operations {
169 */ 169 */
170 170
171/* d_flags entries */ 171/* d_flags entries */
172#define DCACHE_OP_HASH 0x0001 172#define DCACHE_OP_HASH 0x00000001
173#define DCACHE_OP_COMPARE 0x0002 173#define DCACHE_OP_COMPARE 0x00000002
174#define DCACHE_OP_REVALIDATE 0x0004 174#define DCACHE_OP_REVALIDATE 0x00000004
175#define DCACHE_OP_DELETE 0x0008 175#define DCACHE_OP_DELETE 0x00000008
176#define DCACHE_OP_PRUNE 0x0010 176#define DCACHE_OP_PRUNE 0x00000010
177 177
178#define DCACHE_DISCONNECTED 0x0020 178#define DCACHE_DISCONNECTED 0x00000020
179 /* This dentry is possibly not currently connected to the dcache tree, in 179 /* This dentry is possibly not currently connected to the dcache tree, in
180 * which case its parent will either be itself, or will have this flag as 180 * which case its parent will either be itself, or will have this flag as
181 * well. nfsd will not use a dentry with this bit set, but will first 181 * well. nfsd will not use a dentry with this bit set, but will first
@@ -186,30 +186,38 @@ struct dentry_operations {
186 * dentry into place and return that dentry rather than the passed one, 186 * dentry into place and return that dentry rather than the passed one,
187 * typically using d_splice_alias. */ 187 * typically using d_splice_alias. */
188 188
189#define DCACHE_REFERENCED 0x0040 /* Recently used, don't discard. */ 189#define DCACHE_REFERENCED 0x00000040 /* Recently used, don't discard. */
190#define DCACHE_RCUACCESS 0x0080 /* Entry has ever been RCU-visible */ 190#define DCACHE_RCUACCESS 0x00000080 /* Entry has ever been RCU-visible */
191 191
192#define DCACHE_CANT_MOUNT 0x0100 192#define DCACHE_CANT_MOUNT 0x00000100
193#define DCACHE_GENOCIDE 0x0200 193#define DCACHE_GENOCIDE 0x00000200
194#define DCACHE_SHRINK_LIST 0x0400 194#define DCACHE_SHRINK_LIST 0x00000400
195 195
196#define DCACHE_OP_WEAK_REVALIDATE 0x0800 196#define DCACHE_OP_WEAK_REVALIDATE 0x00000800
197 197
198#define DCACHE_NFSFS_RENAMED 0x1000 198#define DCACHE_NFSFS_RENAMED 0x00001000
199 /* this dentry has been "silly renamed" and has to be deleted on the last 199 /* this dentry has been "silly renamed" and has to be deleted on the last
200 * dput() */ 200 * dput() */
201#define DCACHE_COOKIE 0x2000 /* For use by dcookie subsystem */ 201#define DCACHE_COOKIE 0x00002000 /* For use by dcookie subsystem */
202#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x4000 202#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x00004000
203 /* Parent inode is watched by some fsnotify listener */ 203 /* Parent inode is watched by some fsnotify listener */
204 204
205#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */ 205#define DCACHE_DENTRY_KILLED 0x00008000
206#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */ 206
207#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */ 207#define DCACHE_MOUNTED 0x00010000 /* is a mountpoint */
208#define DCACHE_NEED_AUTOMOUNT 0x00020000 /* handle automount on this dir */
209#define DCACHE_MANAGE_TRANSIT 0x00040000 /* manage transit from this dirent */
208#define DCACHE_MANAGED_DENTRY \ 210#define DCACHE_MANAGED_DENTRY \
209 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 211 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
210 212
211#define DCACHE_LRU_LIST 0x80000 213#define DCACHE_LRU_LIST 0x00080000
212#define DCACHE_DENTRY_KILLED 0x100000 214
215#define DCACHE_ENTRY_TYPE 0x00700000
216#define DCACHE_MISS_TYPE 0x00000000 /* Negative dentry */
217#define DCACHE_DIRECTORY_TYPE 0x00100000 /* Normal directory */
218#define DCACHE_AUTODIR_TYPE 0x00200000 /* Lookupless directory (presumed automount) */
219#define DCACHE_SYMLINK_TYPE 0x00300000 /* Symlink */
220#define DCACHE_FILE_TYPE 0x00400000 /* Other file type */
213 221
214extern seqlock_t rename_lock; 222extern seqlock_t rename_lock;
215 223
@@ -224,6 +232,7 @@ static inline int dname_external(const struct dentry *dentry)
224extern void d_instantiate(struct dentry *, struct inode *); 232extern void d_instantiate(struct dentry *, struct inode *);
225extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); 233extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *);
226extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); 234extern struct dentry * d_materialise_unique(struct dentry *, struct inode *);
235extern int d_instantiate_no_diralias(struct dentry *, struct inode *);
227extern void __d_drop(struct dentry *dentry); 236extern void __d_drop(struct dentry *dentry);
228extern void d_drop(struct dentry *dentry); 237extern void d_drop(struct dentry *dentry);
229extern void d_delete(struct dentry *); 238extern void d_delete(struct dentry *);
@@ -393,6 +402,61 @@ static inline bool d_mountpoint(const struct dentry *dentry)
393 return dentry->d_flags & DCACHE_MOUNTED; 402 return dentry->d_flags & DCACHE_MOUNTED;
394} 403}
395 404
405/*
406 * Directory cache entry type accessor functions.
407 */
408static inline void __d_set_type(struct dentry *dentry, unsigned type)
409{
410 dentry->d_flags = (dentry->d_flags & ~DCACHE_ENTRY_TYPE) | type;
411}
412
413static inline void __d_clear_type(struct dentry *dentry)
414{
415 __d_set_type(dentry, DCACHE_MISS_TYPE);
416}
417
418static inline void d_set_type(struct dentry *dentry, unsigned type)
419{
420 spin_lock(&dentry->d_lock);
421 __d_set_type(dentry, type);
422 spin_unlock(&dentry->d_lock);
423}
424
425static inline unsigned __d_entry_type(const struct dentry *dentry)
426{
427 return dentry->d_flags & DCACHE_ENTRY_TYPE;
428}
429
430static inline bool d_is_directory(const struct dentry *dentry)
431{
432 return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE;
433}
434
435static inline bool d_is_autodir(const struct dentry *dentry)
436{
437 return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE;
438}
439
440static inline bool d_is_symlink(const struct dentry *dentry)
441{
442 return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE;
443}
444
445static inline bool d_is_file(const struct dentry *dentry)
446{
447 return __d_entry_type(dentry) == DCACHE_FILE_TYPE;
448}
449
450static inline bool d_is_negative(const struct dentry *dentry)
451{
452 return __d_entry_type(dentry) == DCACHE_MISS_TYPE;
453}
454
455static inline bool d_is_positive(const struct dentry *dentry)
456{
457 return !d_is_negative(dentry);
458}
459
396extern int sysctl_vfs_cache_pressure; 460extern int sysctl_vfs_cache_pressure;
397 461
398static inline unsigned long vfs_pressure_ratio(unsigned long val) 462static inline unsigned long vfs_pressure_ratio(unsigned long val)