Whamcloud - gitweb
LU-9868 lustre: switch to use of ->d_init()
[fs/lustre-release.git] / lustre / llite / llite_internal.h
index c28d7ca..c3f8a4e 100644 (file)
@@ -1187,8 +1187,19 @@ void ll_io_set_mirror(struct cl_io *io, const struct file *file);
 
 /* llite/dcache.c */
 
-int ll_d_init(struct dentry *de);
 extern const struct dentry_operations ll_d_ops;
+#ifndef HAVE_D_INIT
+bool ll_d_setup(struct dentry *de, bool do_put);
+
+static inline bool lld_is_init(struct dentry *dentry)
+{
+       return ll_d2d(dentry);
+}
+#else
+#define ll_d_setup(de, do_put) (true)
+#define lld_is_init(dentry) (true)
+#endif
+
 void ll_intent_drop_lock(struct lookup_intent *);
 void ll_intent_release(struct lookup_intent *);
 void ll_prune_aliases(struct inode *inode);
@@ -1633,17 +1644,7 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode,
 
 static inline int d_lustre_invalid(const struct dentry *dentry)
 {
-       struct ll_dentry_data *lld = ll_d2d(dentry);
-
-       return (lld == NULL) || lld->lld_invalid;
-}
-
-static inline void __d_lustre_invalidate(struct dentry *dentry)
-{
-       struct ll_dentry_data *lld = ll_d2d(dentry);
-
-       if (lld != NULL)
-               lld->lld_invalid = 1;
+       return !ll_d2d(dentry) || ll_d2d(dentry)->lld_invalid;
 }
 
 /*
@@ -1659,14 +1660,15 @@ static inline void d_lustre_invalidate(struct dentry *dentry)
               dentry->d_parent, dentry->d_inode, ll_d_count(dentry));
 
        spin_lock(&dentry->d_lock);
-       __d_lustre_invalidate(dentry);
+       if (lld_is_init(dentry))
+               ll_d2d(dentry)->lld_invalid = 1;
        spin_unlock(&dentry->d_lock);
 }
 
 static inline void d_lustre_revalidate(struct dentry *dentry)
 {
        spin_lock(&dentry->d_lock);
-       LASSERT(ll_d2d(dentry) != NULL);
+       LASSERT(ll_d2d(dentry));
        ll_d2d(dentry)->lld_invalid = 0;
        spin_unlock(&dentry->d_lock);
 }