Blame view
include/linux/dcache.h
18.6 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4c Linux-2.6.12-rc2 |
2 3 |
#ifndef __LINUX_DCACHE_H #define __LINUX_DCACHE_H |
60063497a atomic: use <linu... |
4 |
#include <linux/atomic.h> |
1da177e4c Linux-2.6.12-rc2 |
5 |
#include <linux/list.h> |
82524746c rcu: split list.h... |
6 |
#include <linux/rculist.h> |
ceb5bdc2d fs: dcache per-bu... |
7 |
#include <linux/rculist_bl.h> |
1da177e4c Linux-2.6.12-rc2 |
8 |
#include <linux/spinlock.h> |
31e6b01f4 fs: rcu-walk for ... |
9 |
#include <linux/seqlock.h> |
1da177e4c Linux-2.6.12-rc2 |
10 11 |
#include <linux/cache.h> #include <linux/rcupdate.h> |
98474236f vfs: make the den... |
12 |
#include <linux/lockref.h> |
f4bcbe792 Pull out string h... |
13 |
#include <linux/stringhash.h> |
f9411ebe3 rcu: Separate the... |
14 |
#include <linux/wait.h> |
1da177e4c Linux-2.6.12-rc2 |
15 |
|
cf28b4863 d_path: Make d_pa... |
16 |
struct path; |
1da177e4c Linux-2.6.12-rc2 |
17 18 19 20 21 22 23 24 25 26 27 28 |
struct vfsmount; /* * linux/include/linux/dcache.h * * Dirent cache data structures * * (C) Copyright 1997 Thomas Schoebel-Theuer, * with heavy changes by Linus Torvalds */ #define IS_ROOT(x) ((x) == (x)->d_parent) |
26fe57502 vfs: make it poss... |
29 30 |
/* The hash is always the low bits of hash_len */ #ifdef __LITTLE_ENDIAN |
2bd03e49d include/linux/dca... |
31 |
#define HASH_LEN_DECLARE u32 hash; u32 len |
a5c21dcef dcache: allow wor... |
32 |
#define bytemask_from_count(cnt) (~(~0ul << (cnt)*8)) |
26fe57502 vfs: make it poss... |
33 |
#else |
2bd03e49d include/linux/dca... |
34 |
#define HASH_LEN_DECLARE u32 len; u32 hash |
a5c21dcef dcache: allow wor... |
35 |
#define bytemask_from_count(cnt) (~(~0ul >> (cnt)*8)) |
26fe57502 vfs: make it poss... |
36 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
37 38 39 40 41 42 43 44 |
/* * "quick string" -- eases parameter passing, but more importantly * saves "metadata" about the string (ie length and the hash). * * hash comes first so it snuggles against d_parent in the * dentry. */ struct qstr { |
26fe57502 vfs: make it poss... |
45 46 47 48 49 50 |
union { struct { HASH_LEN_DECLARE; }; u64 hash_len; }; |
1da177e4c Linux-2.6.12-rc2 |
51 52 |
const unsigned char *name; }; |
26fe57502 vfs: make it poss... |
53 |
#define QSTR_INIT(n,l) { { { .len = l } }, .name = n } |
26fe57502 vfs: make it poss... |
54 |
|
cdf01226b VFS: Provide empt... |
55 |
extern const struct qstr empty_name; |
cdf01226b VFS: Provide empt... |
56 |
extern const struct qstr slash_name; |
1da177e4c Linux-2.6.12-rc2 |
57 |
struct dentry_stat_t { |
3942c07cc fs: bump inode an... |
58 59 |
long nr_dentry; long nr_unused; |
af0c9af1b fs/dcache: Track ... |
60 61 62 63 |
long age_limit; /* age in seconds */ long want_pages; /* pages requested by system */ long nr_negative; /* # of unused negative dentries */ long dummy; /* Reserved for future use */ |
1da177e4c Linux-2.6.12-rc2 |
64 65 |
}; extern struct dentry_stat_t dentry_stat; |
c2452f327 shrink struct dentry |
66 67 68 69 70 71 |
/* * Try to keep struct dentry aligned on 64 byte cachelines (this will * give reasonable cacheline footprint with larger lines without the * large memory footprint increase). */ #ifdef CONFIG_64BIT |
44a7d7a87 fs: cache optimis... |
72 |
# define DNAME_INLINE_LEN 32 /* 192 bytes */ |
c2452f327 shrink struct dentry |
73 |
#else |
44a7d7a87 fs: cache optimis... |
74 75 76 77 78 |
# ifdef CONFIG_SMP # define DNAME_INLINE_LEN 36 /* 128 bytes */ # else # define DNAME_INLINE_LEN 40 /* 128 bytes */ # endif |
c2452f327 shrink struct dentry |
79 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
80 |
|
98474236f vfs: make the den... |
81 |
#define d_lock d_lockref.lock |
1da177e4c Linux-2.6.12-rc2 |
82 |
struct dentry { |
44a7d7a87 fs: cache optimis... |
83 |
/* RCU lookup touched fields */ |
1da177e4c Linux-2.6.12-rc2 |
84 |
unsigned int d_flags; /* protected by d_lock */ |
264753719 vfs: Use sequence... |
85 |
seqcount_spinlock_t d_seq; /* per dentry seqlock */ |
ceb5bdc2d fs: dcache per-bu... |
86 |
struct hlist_bl_node d_hash; /* lookup hash list */ |
1da177e4c Linux-2.6.12-rc2 |
87 88 |
struct dentry *d_parent; /* parent directory */ struct qstr d_name; |
44a7d7a87 fs: cache optimis... |
89 90 91 92 93 |
struct inode *d_inode; /* Where the name belongs to - NULL is * negative */ unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */ /* Ref lookup also touches following */ |
98474236f vfs: make the den... |
94 |
struct lockref d_lockref; /* per-dentry lock and refcount */ |
44a7d7a87 fs: cache optimis... |
95 96 97 98 |
const struct dentry_operations *d_op; struct super_block *d_sb; /* The root of the dentry tree */ unsigned long d_time; /* used by d_revalidate */ void *d_fsdata; /* fs-specific data */ |
1da177e4c Linux-2.6.12-rc2 |
99 |
|
d9171b934 parallel lookups ... |
100 101 102 103 |
union { struct list_head d_lru; /* LRU list */ wait_queue_head_t *d_wait; /* in-lookup ones only */ }; |
946e51f2b move d_rcu from o... |
104 105 |
struct list_head d_child; /* child of parent list */ struct list_head d_subdirs; /* our children */ |
5160ee6fc [PATCH] shrink de... |
106 |
/* |
946e51f2b move d_rcu from o... |
107 |
* d_alias and d_rcu can share memory |
5160ee6fc [PATCH] shrink de... |
108 109 |
*/ union { |
946e51f2b move d_rcu from o... |
110 |
struct hlist_node d_alias; /* inode alias list */ |
94bdd655c parallel lookups ... |
111 |
struct hlist_bl_node d_in_lookup_hash; /* only for in-lookup ones */ |
5160ee6fc [PATCH] shrink de... |
112 113 |
struct rcu_head d_rcu; } d_u; |
3859a271a randstruct: Mark ... |
114 |
} __randomize_layout; |
1da177e4c Linux-2.6.12-rc2 |
115 |
|
a90b9c05d [PATCH] lockdep: ... |
116 117 118 119 120 121 122 123 124 125 126 |
/* * dentry->d_lock spinlock nesting subclasses: * * 0: normal * 1: nested */ enum dentry_d_lock_class { DENTRY_D_LOCK_NORMAL, /* implicitly used by plain spin_lock() APIs. */ DENTRY_D_LOCK_NESTED }; |
1da177e4c Linux-2.6.12-rc2 |
127 |
struct dentry_operations { |
0b728e191 stop passing name... |
128 |
int (*d_revalidate)(struct dentry *, unsigned int); |
ecf3d1f1a vfs: kill FS_REVA... |
129 |
int (*d_weak_revalidate)(struct dentry *, unsigned int); |
da53be12b Don't pass inode ... |
130 |
int (*d_hash)(const struct dentry *, struct qstr *); |
6fa67e707 get rid of 'paren... |
131 |
int (*d_compare)(const struct dentry *, |
621e155a3 fs: change d_comp... |
132 |
unsigned int, const char *, const struct qstr *); |
fe15ce446 fs: change d_dele... |
133 |
int (*d_delete)(const struct dentry *); |
285b102d3 vfs: new d_init m... |
134 |
int (*d_init)(struct dentry *); |
1da177e4c Linux-2.6.12-rc2 |
135 |
void (*d_release)(struct dentry *); |
f0023bc61 vfs: add d_prune ... |
136 |
void (*d_prune)(struct dentry *); |
1da177e4c Linux-2.6.12-rc2 |
137 |
void (*d_iput)(struct dentry *, struct inode *); |
c23fbb6bc VFS: delay the de... |
138 |
char *(*d_dname)(struct dentry *, char *, int); |
9875cf806 Add a dentry op t... |
139 |
struct vfsmount *(*d_automount)(struct path *); |
fb5f51c74 vfs: change d_man... |
140 |
int (*d_manage)(const struct path *, bool); |
fb16043b4 vfs: remove open_... |
141 |
struct dentry *(*d_real)(struct dentry *, const struct inode *); |
f37e05049 ANDROID: vfs: d_c... |
142 |
void (*d_canonical_path)(const struct path *, struct path *); |
44a7d7a87 fs: cache optimis... |
143 |
} ____cacheline_aligned; |
1da177e4c Linux-2.6.12-rc2 |
144 |
|
5eef7fa90 fs: dcache docume... |
145 146 |
/* * Locking rules for dentry_operations callbacks are to be found in |
ec23eb54f docs: fs: convert... |
147 |
* Documentation/filesystems/locking.rst. Keep it updated! |
5eef7fa90 fs: dcache docume... |
148 |
* |
5c437fa29 docs: fs: fix bro... |
149 |
* FUrther descriptions are found in Documentation/filesystems/vfs.rst. |
621e155a3 fs: change d_comp... |
150 |
* Keep it updated too! |
1da177e4c Linux-2.6.12-rc2 |
151 152 153 |
*/ /* d_flags entries */ |
b18825a7c VFS: Put a small ... |
154 155 156 157 158 |
#define DCACHE_OP_HASH 0x00000001 #define DCACHE_OP_COMPARE 0x00000002 #define DCACHE_OP_REVALIDATE 0x00000004 #define DCACHE_OP_DELETE 0x00000008 #define DCACHE_OP_PRUNE 0x00000010 |
5f57cbcc0 fs: dcache remove... |
159 |
|
b18825a7c VFS: Put a small ... |
160 |
#define DCACHE_DISCONNECTED 0x00000020 |
5f57cbcc0 fs: dcache remove... |
161 162 163 164 165 166 167 168 169 |
/* This dentry is possibly not currently connected to the dcache tree, in * which case its parent will either be itself, or will have this flag as * well. nfsd will not use a dentry with this bit set, but will first * endeavour to clear the bit either by discovering that it is connected, * or by performing lookup operations. Any filesystem which supports * nfsd_operations MUST have a lookup function which, if it finds a * directory inode with a DCACHE_DISCONNECTED dentry, will d_move that * dentry into place and return that dentry rather than the passed one, * typically using d_splice_alias. */ |
1da177e4c Linux-2.6.12-rc2 |
170 |
|
b18825a7c VFS: Put a small ... |
171 |
#define DCACHE_REFERENCED 0x00000040 /* Recently used, don't discard. */ |
c28f7e56e fsnotify: parent ... |
172 |
|
2c567af41 fs: Introduce DCA... |
173 |
#define DCACHE_DONTCACHE 0x00000080 /* Purge from memory on final dput() */ |
b18825a7c VFS: Put a small ... |
174 175 176 |
#define DCACHE_CANT_MOUNT 0x00000100 #define DCACHE_GENOCIDE 0x00000200 #define DCACHE_SHRINK_LIST 0x00000400 |
5f57cbcc0 fs: dcache remove... |
177 |
|
b18825a7c VFS: Put a small ... |
178 |
#define DCACHE_OP_WEAK_REVALIDATE 0x00000800 |
ecf3d1f1a vfs: kill FS_REVA... |
179 |
|
b18825a7c VFS: Put a small ... |
180 |
#define DCACHE_NFSFS_RENAMED 0x00001000 |
830c0f0ed vfs: renumber DCA... |
181 182 |
/* this dentry has been "silly renamed" and has to be deleted on the last * dput() */ |
b18825a7c VFS: Put a small ... |
183 184 |
#define DCACHE_COOKIE 0x00002000 /* For use by dcookie subsystem */ #define DCACHE_FSNOTIFY_PARENT_WATCHED 0x00004000 |
830c0f0ed vfs: renumber DCA... |
185 |
/* Parent inode is watched by some fsnotify listener */ |
fb045adb9 fs: dcache reduce... |
186 |
|
b18825a7c VFS: Put a small ... |
187 188 189 190 191 |
#define DCACHE_DENTRY_KILLED 0x00008000 #define DCACHE_MOUNTED 0x00010000 /* is a mountpoint */ #define DCACHE_NEED_AUTOMOUNT 0x00020000 /* handle automount on this dir */ #define DCACHE_MANAGE_TRANSIT 0x00040000 /* manage transit from this dirent */ |
9875cf806 Add a dentry op t... |
192 |
#define DCACHE_MANAGED_DENTRY \ |
cc53ce53c Add a dentry op t... |
193 |
(DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) |
9875cf806 Add a dentry op t... |
194 |
|
b18825a7c VFS: Put a small ... |
195 196 197 |
#define DCACHE_LRU_LIST 0x00080000 #define DCACHE_ENTRY_TYPE 0x00700000 |
e7f7d2253 VFS: Add a whiteo... |
198 199 200 201 |
#define DCACHE_MISS_TYPE 0x00000000 /* Negative dentry (maybe fallthru to nowhere) */ #define DCACHE_WHITEOUT_TYPE 0x00100000 /* Whiteout dentry (stop pathwalk) */ #define DCACHE_DIRECTORY_TYPE 0x00200000 /* Normal directory */ #define DCACHE_AUTODIR_TYPE 0x00300000 /* Lookupless directory (presumed automount) */ |
44bdb5e5f VFS: Split DCACHE... |
202 203 204 |
#define DCACHE_REGULAR_TYPE 0x00400000 /* Regular file type (or fallthru to such) */ #define DCACHE_SPECIAL_TYPE 0x00500000 /* Other file type (or fallthru to such) */ #define DCACHE_SYMLINK_TYPE 0x00600000 /* Symlink (or fallthru to such) */ |
b161dfa69 vfs: dcache: use ... |
205 |
|
41edf278f dentry_kill(): do... |
206 |
#define DCACHE_MAY_FREE 0x00800000 |
df1a085af VFS: Add a fallth... |
207 |
#define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */ |
501e43fbe fscrypt: rename D... |
208 |
#define DCACHE_NOKEY_NAME 0x02000000 /* Encrypted name encoded without key */ |
2d902671c vfs: merge .d_sel... |
209 |
#define DCACHE_OP_REAL 0x04000000 |
0b81d0779 fs crypto: move p... |
210 |
|
85c7f8104 beginning of tran... |
211 |
#define DCACHE_PAR_LOOKUP 0x10000000 /* being looked up (with parent locked shared) */ |
ba65dc5ef much milder d_wal... |
212 |
#define DCACHE_DENTRY_CURSOR 0x20000000 |
5467a68cb dcache: sort the ... |
213 |
#define DCACHE_NORCU 0x40000000 /* No RCU delay for freeing */ |
85c7f8104 beginning of tran... |
214 |
|
74c3cbe33 [PATCH] audit: wa... |
215 |
extern seqlock_t rename_lock; |
1da177e4c Linux-2.6.12-rc2 |
216 |
|
1da177e4c Linux-2.6.12-rc2 |
217 218 219 220 |
/* * These are the low-level FS interfaces to the dcache.. */ extern void d_instantiate(struct dentry *, struct inode *); |
1e2e547a9 do d_instantiate/... |
221 |
extern void d_instantiate_new(struct dentry *, struct inode *); |
1da177e4c Linux-2.6.12-rc2 |
222 |
extern struct dentry * d_instantiate_unique(struct dentry *, struct inode *); |
f9c34674b vfs: factor out h... |
223 |
extern struct dentry * d_instantiate_anon(struct dentry *, struct inode *); |
789680d1e fs: dcache scale ... |
224 225 |
extern void __d_drop(struct dentry *dentry); extern void d_drop(struct dentry *dentry); |
1da177e4c Linux-2.6.12-rc2 |
226 |
extern void d_delete(struct dentry *); |
fb045adb9 fs: dcache reduce... |
227 |
extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op); |
1da177e4c Linux-2.6.12-rc2 |
228 229 230 |
/* allocate/de-allocate */ extern struct dentry * d_alloc(struct dentry *, const struct qstr *); |
f9c34674b vfs: factor out h... |
231 |
extern struct dentry * d_alloc_anon(struct super_block *); |
d9171b934 parallel lookups ... |
232 233 |
extern struct dentry * d_alloc_parallel(struct dentry *, const struct qstr *, wait_queue_head_t *); |
1da177e4c Linux-2.6.12-rc2 |
234 |
extern struct dentry * d_splice_alias(struct inode *, struct dentry *); |
e45b590b9 [PATCH] change d_... |
235 |
extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); |
668d0cd56 replace d_add_uni... |
236 |
extern struct dentry * d_exact_alias(struct dentry *, struct inode *); |
46f72b349 vfs: export symbo... |
237 |
extern struct dentry *d_find_any_alias(struct inode *inode); |
4ea3ada29 [PATCH] new helpe... |
238 |
extern struct dentry * d_obtain_alias(struct inode *); |
1a0a397e4 dcache: d_obtain_... |
239 |
extern struct dentry * d_obtain_root(struct inode *); |
1da177e4c Linux-2.6.12-rc2 |
240 241 |
extern void shrink_dcache_sb(struct super_block *); extern void shrink_dcache_parent(struct dentry *); |
c636ebdb1 [PATCH] VFS: Dest... |
242 |
extern void shrink_dcache_for_umount(struct super_block *); |
5542aa2fa vfs: Make d_inval... |
243 |
extern void d_invalidate(struct dentry *); |
1da177e4c Linux-2.6.12-rc2 |
244 245 |
/* only used at mount-time */ |
adc0e91ab vfs: new helper -... |
246 |
extern struct dentry * d_make_root(struct inode *); |
1da177e4c Linux-2.6.12-rc2 |
247 248 249 |
/* <clickety>-<click> the ramfs-type tree */ extern void d_genocide(struct dentry *); |
60545d0d4 [O_TMPFILE] it's ... |
250 |
extern void d_tmpfile(struct dentry *, struct inode *); |
1da177e4c Linux-2.6.12-rc2 |
251 252 253 254 |
extern struct dentry *d_find_alias(struct inode *); extern void d_prune_aliases(struct inode *); /* test whether we have any submounts in a subdir tree */ |
01619491a vfs: add path_has... |
255 |
extern int path_has_submounts(const struct path *); |
1da177e4c Linux-2.6.12-rc2 |
256 257 258 259 260 |
/* * This adds the entry to the hash queues. */ extern void d_rehash(struct dentry *); |
1da177e4c Linux-2.6.12-rc2 |
261 |
|
34d0d19dc uninline d_add() |
262 |
extern void d_add(struct dentry *, struct inode *); |
1da177e4c Linux-2.6.12-rc2 |
263 |
|
1da177e4c Linux-2.6.12-rc2 |
264 265 |
/* used for rename() and baskets */ extern void d_move(struct dentry *, struct dentry *); |
da1ce0670 vfs: add cross-re... |
266 |
extern void d_exchange(struct dentry *, struct dentry *); |
e2761a116 [PATCH vfs-2.6 2/... |
267 |
extern struct dentry *d_ancestor(struct dentry *, struct dentry *); |
1da177e4c Linux-2.6.12-rc2 |
268 269 |
/* appendix may either be NULL or be used for transname suffixes */ |
da2d8455e constify d_lookup... |
270 |
extern struct dentry *d_lookup(const struct dentry *, const struct qstr *); |
31e6b01f4 fs: rcu-walk for ... |
271 |
extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); |
a713ca2ab constify __d_look... |
272 |
extern struct dentry *__d_lookup(const struct dentry *, const struct qstr *); |
8966be903 vfs: trivial __d_... |
273 |
extern struct dentry *__d_lookup_rcu(const struct dentry *parent, |
da53be12b Don't pass inode ... |
274 |
const struct qstr *name, unsigned *seq); |
31e6b01f4 fs: rcu-walk for ... |
275 |
|
24924a20d vfs: constify den... |
276 |
static inline unsigned d_count(const struct dentry *dentry) |
84d08fa88 helper for readin... |
277 |
{ |
98474236f vfs: make the den... |
278 |
return dentry->d_lockref.count; |
84d08fa88 helper for readin... |
279 |
} |
c23fbb6bc VFS: delay the de... |
280 281 282 |
/* * helper function for dentry_operations.d_dname() members */ |
8db148606 include, lib: add... |
283 284 |
extern __printf(4, 5) char *dynamic_dname(struct dentry *, char *, int, const char *, ...); |
c23fbb6bc VFS: delay the de... |
285 |
|
02125a826 fix apparmor dere... |
286 287 |
extern char *__d_path(const struct path *, const struct path *, char *, int); extern char *d_absolute_path(const struct path *, char *, int); |
20d4fdc1a [patch 2/4] fs: m... |
288 |
extern char *d_path(const struct path *, char *, int); |
ec2447c27 hostfs: simplify ... |
289 |
extern char *dentry_path_raw(struct dentry *, char *, int); |
6092d0481 [patch 1/7] vfs: ... |
290 |
extern char *dentry_path(struct dentry *, char *, int); |
cf28b4863 d_path: Make d_pa... |
291 |
|
1da177e4c Linux-2.6.12-rc2 |
292 293 294 |
/* Allocation counts.. */ /** |
dc0474be3 fs: dcache ration... |
295 |
* dget, dget_dlock - get a reference to a dentry |
1da177e4c Linux-2.6.12-rc2 |
296 297 298 299 |
* @dentry: dentry to get a reference to * * Given a dentry or %NULL pointer increment the reference count * if appropriate and return the dentry. A dentry will not be |
dc0474be3 fs: dcache ration... |
300 |
* destroyed when it has references. |
1da177e4c Linux-2.6.12-rc2 |
301 |
*/ |
b7ab39f63 fs: dcache scale ... |
302 303 |
static inline struct dentry *dget_dlock(struct dentry *dentry) { |
dc0474be3 fs: dcache ration... |
304 |
if (dentry) |
98474236f vfs: make the den... |
305 |
dentry->d_lockref.count++; |
b7ab39f63 fs: dcache scale ... |
306 307 |
return dentry; } |
2fd6b7f50 fs: dcache scale ... |
308 |
|
1da177e4c Linux-2.6.12-rc2 |
309 310 |
static inline struct dentry *dget(struct dentry *dentry) { |
98474236f vfs: make the den... |
311 312 |
if (dentry) lockref_get(&dentry->d_lockref); |
1da177e4c Linux-2.6.12-rc2 |
313 314 |
return dentry; } |
b7ab39f63 fs: dcache scale ... |
315 |
extern struct dentry *dget_parent(struct dentry *dentry); |
1da177e4c Linux-2.6.12-rc2 |
316 317 318 319 320 321 322 323 |
/** * d_unhashed - is dentry hashed * @dentry: entry to check * * Returns true if the dentry passed is not currently hashed. */ |
f0d3b3ded constify dcache.c... |
324 |
static inline int d_unhashed(const struct dentry *dentry) |
1da177e4c Linux-2.6.12-rc2 |
325 |
{ |
dea3667bc vfs: get rid of i... |
326 |
return hlist_bl_unhashed(&dentry->d_hash); |
1da177e4c Linux-2.6.12-rc2 |
327 |
} |
f0d3b3ded constify dcache.c... |
328 |
static inline int d_unlinked(const struct dentry *dentry) |
f3da392e9 dcache: extrace a... |
329 330 331 |
{ return d_unhashed(dentry) && !IS_ROOT(dentry); } |
f0d3b3ded constify dcache.c... |
332 |
static inline int cant_mount(const struct dentry *dentry) |
d83c49f3e Fix the regressio... |
333 334 335 336 337 338 339 340 341 342 |
{ return (dentry->d_flags & DCACHE_CANT_MOUNT); } static inline void dont_mount(struct dentry *dentry) { spin_lock(&dentry->d_lock); dentry->d_flags |= DCACHE_CANT_MOUNT; spin_unlock(&dentry->d_lock); } |
85c7f8104 beginning of tran... |
343 |
extern void __d_lookup_done(struct dentry *); |
4ded097be constify more dca... |
344 |
static inline int d_in_lookup(const struct dentry *dentry) |
85c7f8104 beginning of tran... |
345 346 347 348 349 350 351 352 353 354 355 356 |
{ return dentry->d_flags & DCACHE_PAR_LOOKUP; } static inline void d_lookup_done(struct dentry *dentry) { if (unlikely(d_in_lookup(dentry))) { spin_lock(&dentry->d_lock); __d_lookup_done(dentry); spin_unlock(&dentry->d_lock); } } |
1da177e4c Linux-2.6.12-rc2 |
357 |
extern void dput(struct dentry *); |
f0d3b3ded constify dcache.c... |
358 |
static inline bool d_managed(const struct dentry *dentry) |
cc53ce53c Add a dentry op t... |
359 360 361 |
{ return dentry->d_flags & DCACHE_MANAGED_DENTRY; } |
f0d3b3ded constify dcache.c... |
362 |
static inline bool d_mountpoint(const struct dentry *dentry) |
1da177e4c Linux-2.6.12-rc2 |
363 |
{ |
5f57cbcc0 fs: dcache remove... |
364 |
return dentry->d_flags & DCACHE_MOUNTED; |
1da177e4c Linux-2.6.12-rc2 |
365 |
} |
b18825a7c VFS: Put a small ... |
366 367 368 |
/* * Directory cache entry type accessor functions. */ |
b18825a7c VFS: Put a small ... |
369 370 |
static inline unsigned __d_entry_type(const struct dentry *dentry) { |
a528aca7f use ->d_seq to ge... |
371 |
return dentry->d_flags & DCACHE_ENTRY_TYPE; |
b18825a7c VFS: Put a small ... |
372 |
} |
e7f7d2253 VFS: Add a whiteo... |
373 374 375 376 377 378 379 380 381 |
static inline bool d_is_miss(const struct dentry *dentry) { return __d_entry_type(dentry) == DCACHE_MISS_TYPE; } static inline bool d_is_whiteout(const struct dentry *dentry) { return __d_entry_type(dentry) == DCACHE_WHITEOUT_TYPE; } |
44b1d5304 vfs: add d_is_dir() |
382 |
static inline bool d_can_lookup(const struct dentry *dentry) |
b18825a7c VFS: Put a small ... |
383 384 385 386 387 388 389 390 |
{ return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE; } static inline bool d_is_autodir(const struct dentry *dentry) { return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE; } |
44b1d5304 vfs: add d_is_dir() |
391 392 393 394 |
static inline bool d_is_dir(const struct dentry *dentry) { return d_can_lookup(dentry) || d_is_autodir(dentry); } |
b18825a7c VFS: Put a small ... |
395 396 397 398 |
static inline bool d_is_symlink(const struct dentry *dentry) { return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE; } |
44bdb5e5f VFS: Split DCACHE... |
399 400 401 402 403 404 405 406 407 |
static inline bool d_is_reg(const struct dentry *dentry) { return __d_entry_type(dentry) == DCACHE_REGULAR_TYPE; } static inline bool d_is_special(const struct dentry *dentry) { return __d_entry_type(dentry) == DCACHE_SPECIAL_TYPE; } |
b18825a7c VFS: Put a small ... |
408 409 |
static inline bool d_is_file(const struct dentry *dentry) { |
44bdb5e5f VFS: Split DCACHE... |
410 |
return d_is_reg(dentry) || d_is_special(dentry); |
b18825a7c VFS: Put a small ... |
411 412 413 414 |
} static inline bool d_is_negative(const struct dentry *dentry) { |
e7f7d2253 VFS: Add a whiteo... |
415 416 |
// TODO: check d_is_whiteout(dentry) also. return d_is_miss(dentry); |
b18825a7c VFS: Put a small ... |
417 |
} |
d41efb522 fs/namei.c: pull ... |
418 419 420 421 |
static inline bool d_flags_negative(unsigned flags) { return (flags & DCACHE_ENTRY_TYPE) == DCACHE_MISS_TYPE; } |
b18825a7c VFS: Put a small ... |
422 423 424 425 |
static inline bool d_is_positive(const struct dentry *dentry) { return !d_is_negative(dentry); } |
525d27b23 VFS: Add owner-fi... |
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
/** * d_really_is_negative - Determine if a dentry is really negative (ignoring fallthroughs) * @dentry: The dentry in question * * Returns true if the dentry represents either an absent name or a name that * doesn't map to an inode (ie. ->d_inode is NULL). The dentry could represent * a true miss, a whiteout that isn't represented by a 0,0 chardev or a * fallthrough marker in an opaque directory. * * Note! (1) This should be used *only* by a filesystem to examine its own * dentries. It should not be used to look at some other filesystem's * dentries. (2) It should also be used in combination with d_inode() to get * the inode. (3) The dentry may have something attached to ->d_lower and the * type field of the flags may be set to something other than miss or whiteout. */ static inline bool d_really_is_negative(const struct dentry *dentry) { return dentry->d_inode == NULL; } /** * d_really_is_positive - Determine if a dentry is really positive (ignoring fallthroughs) * @dentry: The dentry in question * * Returns true if the dentry represents a name that maps to an inode * (ie. ->d_inode is not NULL). The dentry might still represent a whiteout if * that is represented on medium as a 0,0 chardev. * * Note! (1) This should be used *only* by a filesystem to examine its own * dentries. It should not be used to look at some other filesystem's * dentries. (2) It should also be used in combination with d_inode() to get * the inode. */ static inline bool d_really_is_positive(const struct dentry *dentry) { return dentry->d_inode != NULL; } |
4ded097be constify more dca... |
463 |
static inline int simple_positive(const struct dentry *dentry) |
dc3f4198e make simple_posit... |
464 465 466 |
{ return d_really_is_positive(dentry) && !d_unhashed(dentry); } |
df1a085af VFS: Add a fallth... |
467 468 469 470 471 472 |
extern void d_set_fallthru(struct dentry *dentry); static inline bool d_is_fallthru(const struct dentry *dentry) { return dentry->d_flags & DCACHE_FALLTHRU; } |
1da177e4c Linux-2.6.12-rc2 |
473 |
extern int sysctl_vfs_cache_pressure; |
55f841ce9 super: fix calcul... |
474 475 476 477 |
static inline unsigned long vfs_pressure_ratio(unsigned long val) { return mult_frac(val, sysctl_vfs_cache_pressure, 100); } |
155e35d4d VFS: Introduce in... |
478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
/** * d_inode - Get the actual inode of this dentry * @dentry: The dentry to query * * This is the helper normal filesystems should use to get at their own inodes * in their own dentries and ignore the layering superimposed upon them. */ static inline struct inode *d_inode(const struct dentry *dentry) { return dentry->d_inode; } /** |
66702eb59 locking/atomics, ... |
492 |
* d_inode_rcu - Get the actual inode of this dentry with READ_ONCE() |
155e35d4d VFS: Introduce in... |
493 494 495 496 497 498 499 |
* @dentry: The dentry to query * * This is the helper normal filesystems should use to get at their own inodes * in their own dentries and ignore the layering superimposed upon them. */ static inline struct inode *d_inode_rcu(const struct dentry *dentry) { |
66702eb59 locking/atomics, ... |
500 |
return READ_ONCE(dentry->d_inode); |
155e35d4d VFS: Introduce in... |
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 |
} /** * d_backing_inode - Get upper or lower inode we should be using * @upper: The upper layer * * This is the helper that should be used to get at the inode that will be used * if this dentry were to be opened as a file. The inode may be on the upper * dentry or it may be on a lower dentry pinned by the upper. * * Normal filesystems should not use this to access their own inodes. */ static inline struct inode *d_backing_inode(const struct dentry *upper) { struct inode *inode = upper->d_inode; return inode; } /** * d_backing_dentry - Get upper or lower dentry we should be using * @upper: The upper layer * * This is the helper that should be used to get the dentry of the inode that * will be used if this dentry were opened as a file. It may be the upper * dentry or it may be a lower dentry pinned by the upper. * * Normal filesystems should not use this to access their own dentries. */ static inline struct dentry *d_backing_dentry(struct dentry *upper) { return upper; } |
e698b8a43 vfs: document ->d... |
534 535 536 537 |
/** * d_real - Return the real dentry * @dentry: the dentry to query * @inode: inode to select the dentry from multiple layers (can be NULL) |
e698b8a43 vfs: document ->d... |
538 |
* |
03440c4e5 scripts/spelling.... |
539 |
* If dentry is on a union/overlay, then return the underlying, real dentry. |
e698b8a43 vfs: document ->d... |
540 541 |
* Otherwise return the dentry itself. * |
5c437fa29 docs: fs: fix bro... |
542 |
* See also: Documentation/filesystems/vfs.rst |
e698b8a43 vfs: document ->d... |
543 |
*/ |
2d902671c vfs: merge .d_sel... |
544 |
static inline struct dentry *d_real(struct dentry *dentry, |
fb16043b4 vfs: remove open_... |
545 |
const struct inode *inode) |
d101a1259 fs: add file_dent... |
546 547 |
{ if (unlikely(dentry->d_flags & DCACHE_OP_REAL)) |
fb16043b4 vfs: remove open_... |
548 |
return dentry->d_op->d_real(dentry, inode); |
d101a1259 fs: add file_dent... |
549 550 551 |
else return dentry; } |
a11808443 vfs: add d_real_i... |
552 553 554 555 |
/** * d_real_inode - Return the real inode * @dentry: The dentry to query * |
03440c4e5 scripts/spelling.... |
556 |
* If dentry is on a union/overlay, then return the underlying, real inode. |
a11808443 vfs: add d_real_i... |
557 558 |
* Otherwise return d_inode(). */ |
7b1742eb0 vfs: make argumen... |
559 |
static inline struct inode *d_real_inode(const struct dentry *dentry) |
a11808443 vfs: add d_real_i... |
560 |
{ |
7b1742eb0 vfs: make argumen... |
561 |
/* This usage of d_real() results in const dentry */ |
fb16043b4 vfs: remove open_... |
562 |
return d_backing_inode(d_real((struct dentry *) dentry, NULL)); |
a11808443 vfs: add d_real_i... |
563 |
} |
49d31c2f3 dentry name snaps... |
564 |
struct name_snapshot { |
230c6402b ovl_lookup_real_o... |
565 |
struct qstr name; |
0a2c13d9c include/linux/dca... |
566 |
unsigned char inline_name[DNAME_INLINE_LEN]; |
49d31c2f3 dentry name snaps... |
567 568 569 |
}; void take_dentry_name_snapshot(struct name_snapshot *, struct dentry *); void release_dentry_name_snapshot(struct name_snapshot *); |
54d5ca871 vfs: add vfs_sele... |
570 |
|
1da177e4c Linux-2.6.12-rc2 |
571 |
#endif /* __LINUX_DCACHE_H */ |