vfs: document ->d_real()
[deliverable/linux.git] / include / linux / dcache.h
index f8506e8dd4d468418ce5c55242c8abdbade036a3..14df83609c7ff22634e35b7c028c554cf7d9b952 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/cache.h>
 #include <linux/rcupdate.h>
 #include <linux/lockref.h>
+#include <linux/stringhash.h>
 
 struct path;
 struct vfsmount;
@@ -52,9 +53,6 @@ struct qstr {
 };
 
 #define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
-#define hashlen_hash(hashlen) ((u32) (hashlen))
-#define hashlen_len(hashlen)  ((u32)((hashlen) >> 32))
-#define hashlen_create(hash,len) (((u64)(len)<<32)|(u32)(hash))
 
 struct dentry_stat_t {
        long nr_dentry;
@@ -65,29 +63,6 @@ struct dentry_stat_t {
 };
 extern struct dentry_stat_t dentry_stat;
 
-/* Name hashing routines. Initial hash value */
-/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */
-#define init_name_hash()               0
-
-/* partial hash update function. Assume roughly 4 bits per character */
-static inline unsigned long
-partial_name_hash(unsigned long c, unsigned long prevhash)
-{
-       return (prevhash + (c << 4) + (c >> 4)) * 11;
-}
-
-/*
- * Finally: cut down the number of bits to a int value (and try to avoid
- * losing bits)
- */
-static inline unsigned long end_name_hash(unsigned long hash)
-{
-       return (unsigned int) hash;
-}
-
-/* Compute the hash for a name string. */
-extern unsigned int full_name_hash(const unsigned char *, unsigned int);
-
 /*
  * Try to keep struct dentry aligned on 64 byte cachelines (this will
  * give reasonable cacheline footprint with larger lines without the
@@ -164,8 +139,8 @@ struct dentry_operations {
        char *(*d_dname)(struct dentry *, char *, int);
        struct vfsmount *(*d_automount)(struct path *);
        int (*d_manage)(struct dentry *, bool);
-       struct inode *(*d_select_inode)(struct dentry *, unsigned);
-       struct dentry *(*d_real)(struct dentry *, struct inode *);
+       struct dentry *(*d_real)(struct dentry *, const struct inode *,
+                                unsigned int);
 } ____cacheline_aligned;
 
 /*
@@ -231,12 +206,11 @@ struct dentry_operations {
 
 #define DCACHE_MAY_FREE                        0x00800000
 #define DCACHE_FALLTHRU                        0x01000000 /* Fall through to lower layer */
-#define DCACHE_OP_SELECT_INODE         0x02000000 /* Unioned entry: dcache op selects inode */
-
-#define DCACHE_ENCRYPTED_WITH_KEY      0x04000000 /* dir is encrypted with a valid key */
-#define DCACHE_OP_REAL                 0x08000000
+#define DCACHE_ENCRYPTED_WITH_KEY      0x02000000 /* dir is encrypted with a valid key */
+#define DCACHE_OP_REAL                 0x04000000
 
 #define DCACHE_PAR_LOOKUP              0x10000000 /* being looked up (with parent locked shared) */
+#define DCACHE_DENTRY_CURSOR           0x20000000
 
 extern seqlock_t rename_lock;
 
@@ -581,23 +555,37 @@ static inline struct dentry *d_backing_dentry(struct dentry *upper)
        return upper;
 }
 
-static inline struct dentry *d_real(struct dentry *dentry)
+/**
+ * d_real - Return the real dentry
+ * @dentry: the dentry to query
+ * @inode: inode to select the dentry from multiple layers (can be NULL)
+ * @flags: open flags to control copy-up behavior
+ *
+ * If dentry is on an union/overlay, then return the underlying, real dentry.
+ * Otherwise return the dentry itself.
+ *
+ * See also: Documentation/filesystems/vfs.txt
+ */
+static inline struct dentry *d_real(struct dentry *dentry,
+                                   const struct inode *inode,
+                                   unsigned int flags)
 {
        if (unlikely(dentry->d_flags & DCACHE_OP_REAL))
-               return dentry->d_op->d_real(dentry, NULL);
+               return dentry->d_op->d_real(dentry, inode, flags);
        else
                return dentry;
 }
 
-static inline struct inode *vfs_select_inode(struct dentry *dentry,
-                                            unsigned open_flags)
+/**
+ * d_real_inode - Return the real inode
+ * @dentry: The dentry to query
+ *
+ * If dentry is on an union/overlay, then return the underlying, real inode.
+ * Otherwise return d_inode().
+ */
+static inline struct inode *d_real_inode(struct dentry *dentry)
 {
-       struct inode *inode = d_inode(dentry);
-
-       if (inode && unlikely(dentry->d_flags & DCACHE_OP_SELECT_INODE))
-               inode = dentry->d_op->d_select_inode(dentry, open_flags);
-
-       return inode;
+       return d_backing_inode(d_real(dentry, NULL, 0));
 }
 
 
This page took 0.030291 seconds and 5 git commands to generate.