diff options
Diffstat (limited to 'include/linux/dcache.h')
-rw-r--r-- | include/linux/dcache.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index ca648685f0cc..c2e7390289cc 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/list.h> | 5 | #include <linux/list.h> |
6 | #include <linux/rculist.h> | 6 | #include <linux/rculist.h> |
7 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock.h> |
8 | #include <linux/seqlock.h> | ||
8 | #include <linux/cache.h> | 9 | #include <linux/cache.h> |
9 | #include <linux/rcupdate.h> | 10 | #include <linux/rcupdate.h> |
10 | 11 | ||
@@ -90,6 +91,7 @@ struct dentry { | |||
90 | unsigned int d_count; /* protected by d_lock */ | 91 | unsigned int d_count; /* protected by d_lock */ |
91 | unsigned int d_flags; /* protected by d_lock */ | 92 | unsigned int d_flags; /* protected by d_lock */ |
92 | spinlock_t d_lock; /* per dentry lock */ | 93 | spinlock_t d_lock; /* per dentry lock */ |
94 | seqcount_t d_seq; /* per dentry seqlock */ | ||
93 | int d_mounted; | 95 | int d_mounted; |
94 | struct inode *d_inode; /* Where the name belongs to - NULL is | 96 | struct inode *d_inode; /* Where the name belongs to - NULL is |
95 | * negative */ | 97 | * negative */ |
@@ -266,9 +268,33 @@ extern void d_move(struct dentry *, struct dentry *); | |||
266 | extern struct dentry *d_ancestor(struct dentry *, struct dentry *); | 268 | extern struct dentry *d_ancestor(struct dentry *, struct dentry *); |
267 | 269 | ||
268 | /* appendix may either be NULL or be used for transname suffixes */ | 270 | /* appendix may either be NULL or be used for transname suffixes */ |
269 | extern struct dentry * d_lookup(struct dentry *, struct qstr *); | 271 | extern struct dentry *d_lookup(struct dentry *, struct qstr *); |
270 | extern struct dentry * __d_lookup(struct dentry *, struct qstr *); | 272 | extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); |
271 | extern struct dentry * d_hash_and_lookup(struct dentry *, struct qstr *); | 273 | extern struct dentry *__d_lookup(struct dentry *, struct qstr *); |
274 | extern struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, | ||
275 | unsigned *seq, struct inode **inode); | ||
276 | |||
277 | /** | ||
278 | * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok | ||
279 | * @dentry: dentry to take a ref on | ||
280 | * @seq: seqcount to verify against | ||
281 | * @Returns: 0 on failure, else 1. | ||
282 | * | ||
283 | * __d_rcu_to_refcount operates on a dentry,seq pair that was returned | ||
284 | * by __d_lookup_rcu, to get a reference on an rcu-walk dentry. | ||
285 | */ | ||
286 | static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq) | ||
287 | { | ||
288 | int ret = 0; | ||
289 | |||
290 | assert_spin_locked(&dentry->d_lock); | ||
291 | if (!read_seqcount_retry(&dentry->d_seq, seq)) { | ||
292 | ret = 1; | ||
293 | dentry->d_count++; | ||
294 | } | ||
295 | |||
296 | return ret; | ||
297 | } | ||
272 | 298 | ||
273 | /* validate "insecure" dentry pointer */ | 299 | /* validate "insecure" dentry pointer */ |
274 | extern int d_validate(struct dentry *, struct dentry *); | 300 | extern int d_validate(struct dentry *, struct dentry *); |