RFC: FROMLIST: locking/percpu-rwsem: Optimize readers and reduce global impact
[firefly-linux-kernel-4.4.55.git] / include / linux / dcache.h
index e4221f7c5b53a82492a2a03ac5d47bcd93d3ee5e..702b6c53c12ff5bcfcd0bb8d41340fb035edb625 100644 (file)
@@ -161,7 +161,7 @@ struct dentry_operations {
        struct vfsmount *(*d_automount)(struct path *);
        int (*d_manage)(struct dentry *, bool);
        struct inode *(*d_select_inode)(struct dentry *, unsigned);
-       void (*d_canonical_path)(const struct dentry *, struct path *);
+       void (*d_canonical_path)(const struct path *, struct path *);
        struct dentry *(*d_real)(struct dentry *, struct inode *);
 } ____cacheline_aligned;
 
@@ -593,4 +593,28 @@ static inline struct dentry *d_real(struct dentry *dentry)
                return dentry;
 }
 
+static inline struct inode *vfs_select_inode(struct dentry *dentry,
+                                            unsigned open_flags)
+{
+       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;
+}
+
+/**
+ * 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)
+{
+       return d_backing_inode(d_real(dentry));
+}
+
+
 #endif /* __LINUX_DCACHE_H */