diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-07-09 23:29:35 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-07-09 23:29:35 +0000 |
commit | 35385d7a83b4cae6d5ea5f80f3b3377d94178344 (patch) | |
tree | 49494d95dfef31ba4f9a697d31e4028cf65a57bd /include/linux/dcache.h | |
parent | d9d8062e7b49943b2a2fb034f817a9fc217fd40f (diff) |
Merge with 2.4.0-test3-pre7.
Diffstat (limited to 'include/linux/dcache.h')
-rw-r--r-- | include/linux/dcache.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 7c0acf4bb..4c3f211cc 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -217,23 +217,30 @@ extern char * __d_path(struct dentry *, struct vfsmount *, struct dentry *, /* Allocation counts.. */ /** - * dget - get a reference to a dentry + * dget, dget_locked - get a reference to a dentry * @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 - * destroyed when it has references. + * destroyed when it has references. dget() should never be + * called for dentries with zero reference counter. For these cases + * (preferably none, functions in dcache.c are sufficient for normal + * needs and they take necessary precautions) you should hold dcache_lock + * and call dget_locked() instead of dget(). */ static __inline__ struct dentry * dget(struct dentry *dentry) { - if (!atomic_read(&dentry->d_count)) - BUG(); - if (dentry) + if (dentry) { + if (!atomic_read(&dentry->d_count)) + BUG(); atomic_inc(&dentry->d_count); + } return dentry; } +extern struct dentry * dget_locked(struct dentry *); + /** * d_unhashed - is dentry hashed * @dentry: entry to check |