diff options
Diffstat (limited to 'include/linux/dcache.h')
| -rw-r--r-- | include/linux/dcache.h | 104 |
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 | ||
| 214 | extern seqlock_t rename_lock; | 222 | extern seqlock_t rename_lock; |
| 215 | 223 | ||
| @@ -224,6 +232,7 @@ static inline int dname_external(const struct dentry *dentry) | |||
| 224 | extern void d_instantiate(struct dentry *, struct inode *); | 232 | extern void d_instantiate(struct dentry *, struct inode *); |
| 225 | extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); | 233 | extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); |
| 226 | extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); | 234 | extern struct dentry * d_materialise_unique(struct dentry *, struct inode *); |
| 235 | extern int d_instantiate_no_diralias(struct dentry *, struct inode *); | ||
| 227 | extern void __d_drop(struct dentry *dentry); | 236 | extern void __d_drop(struct dentry *dentry); |
| 228 | extern void d_drop(struct dentry *dentry); | 237 | extern void d_drop(struct dentry *dentry); |
| 229 | extern void d_delete(struct dentry *); | 238 | extern 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 | */ | ||
| 408 | static inline void __d_set_type(struct dentry *dentry, unsigned type) | ||
| 409 | { | ||
| 410 | dentry->d_flags = (dentry->d_flags & ~DCACHE_ENTRY_TYPE) | type; | ||
| 411 | } | ||
| 412 | |||
| 413 | static inline void __d_clear_type(struct dentry *dentry) | ||
| 414 | { | ||
| 415 | __d_set_type(dentry, DCACHE_MISS_TYPE); | ||
| 416 | } | ||
| 417 | |||
| 418 | static 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 | |||
| 425 | static inline unsigned __d_entry_type(const struct dentry *dentry) | ||
| 426 | { | ||
| 427 | return dentry->d_flags & DCACHE_ENTRY_TYPE; | ||
| 428 | } | ||
| 429 | |||
| 430 | static inline bool d_is_directory(const struct dentry *dentry) | ||
| 431 | { | ||
| 432 | return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE; | ||
| 433 | } | ||
| 434 | |||
| 435 | static inline bool d_is_autodir(const struct dentry *dentry) | ||
| 436 | { | ||
| 437 | return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE; | ||
| 438 | } | ||
| 439 | |||
| 440 | static inline bool d_is_symlink(const struct dentry *dentry) | ||
| 441 | { | ||
| 442 | return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE; | ||
| 443 | } | ||
| 444 | |||
| 445 | static inline bool d_is_file(const struct dentry *dentry) | ||
| 446 | { | ||
| 447 | return __d_entry_type(dentry) == DCACHE_FILE_TYPE; | ||
| 448 | } | ||
| 449 | |||
| 450 | static inline bool d_is_negative(const struct dentry *dentry) | ||
| 451 | { | ||
| 452 | return __d_entry_type(dentry) == DCACHE_MISS_TYPE; | ||
| 453 | } | ||
| 454 | |||
| 455 | static inline bool d_is_positive(const struct dentry *dentry) | ||
| 456 | { | ||
| 457 | return !d_is_negative(dentry); | ||
| 458 | } | ||
| 459 | |||
| 396 | extern int sysctl_vfs_cache_pressure; | 460 | extern int sysctl_vfs_cache_pressure; |
| 397 | 461 | ||
| 398 | static inline unsigned long vfs_pressure_ratio(unsigned long val) | 462 | static inline unsigned long vfs_pressure_ratio(unsigned long val) |
