Whamcloud - gitweb
LU-3974 llite: dentry d_compare changes in 3.11 46/7746/5
authorJames Simmons <uja.ornl@gmail.com>
Wed, 11 Dec 2013 15:29:41 +0000 (10:29 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 28 Dec 2013 03:16:52 +0000 (03:16 +0000)
In the linux 3.11 kernel the d_compare function has
removed passing in any struct inode arguments. This
patch provides support to handle this case.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I363057e4d0a119ad43a9907ec26e7e0079f7c305
Reviewed-on: http://review.whamcloud.com/7746
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/autoconf/lustre-core.m4
lustre/llite/dcache.c
lustre/llite/llite_internal.h

index f47bc5f..7f9bb45 100644 (file)
@@ -1287,6 +1287,24 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
 ])
 
 #
+# 3.11 dentry_operations.d_compare() taken 5 arguments.
+#
+AC_DEFUN([LC_D_COMPARE_5ARGS],
+[AC_MSG_CHECKING([if d_compare taken 5 arguments])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/dcache.h>
+],[
+       ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
+],[
+       AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
+               [d_compare need 5 arguments])
+       AC_MSG_RESULT([yes])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
 # 3.11 need to access d_count to get dentry reference count
 #
 AC_DEFUN([LC_HAVE_DCOUNT],
 # 3.11 need to access d_count to get dentry reference count
 #
 AC_DEFUN([LC_HAVE_DCOUNT],
@@ -1405,6 +1423,7 @@ AC_DEFUN([LC_PROG_LINUX],
         LC_BLKDEV_RELEASE_RETURN_INT
 
         # 3.11
         LC_BLKDEV_RELEASE_RETURN_INT
 
         # 3.11
+        LC_D_COMPARE_5ARGS
         LC_HAVE_DCOUNT
 
         #
         LC_HAVE_DCOUNT
 
         #
index 6fca4cb..8a8c100 100644 (file)
@@ -89,11 +89,19 @@ static void ll_release(struct dentry *de)
 int ll_dcompare(const struct dentry *parent, const struct inode *pinode,
                const struct dentry *dentry, const struct inode *inode,
                unsigned int len, const char *str, const struct qstr *name)
 int ll_dcompare(const struct dentry *parent, const struct inode *pinode,
                const struct dentry *dentry, const struct inode *inode,
                unsigned int len, const char *str, const struct qstr *name)
+#elif defined(HAVE_D_COMPARE_5ARGS)
+int ll_dcompare(const struct dentry *parent, const struct dentry *dentry,
+               unsigned int len, const char *str, const struct qstr *name)
 #else
 int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name)
 #endif
 {
 #else
 int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name)
 #endif
 {
-#ifdef HAVE_D_COMPARE_7ARGS
+#if !defined(HAVE_D_COMPARE_7ARGS) && !defined(HAVE_D_COMPARE_5ARGS)
+       /* XXX: (ugh !) d_name must be in-dentry structure */
+       struct dentry *dentry = container_of(d_name, struct dentry, d_name);
+       unsigned int len = d_name->len;
+       const char *str = d_name->name;
+#endif
        ENTRY;
 
        if (len != name->len)
        ENTRY;
 
        if (len != name->len)
@@ -101,19 +109,6 @@ int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name)
 
        if (memcmp(str, name->name, len))
                RETURN(1);
 
        if (memcmp(str, name->name, len))
                RETURN(1);
-#else
-       struct dentry *dentry;
-       ENTRY;
-
-       if (d_name->len != name->len)
-               RETURN(1);
-
-       if (memcmp(d_name->name, name->name, name->len))
-               RETURN(1);
-
-       /* XXX: d_name must be in-dentry structure */
-       dentry = container_of(d_name, struct dentry, d_name); /* ugh */
-#endif
 
        CDEBUG(D_DENTRY, "found name %.*s(%p) flags %#x refc %d\n",
               name->len, name->name, dentry, dentry->d_flags,
 
        CDEBUG(D_DENTRY, "found name %.*s(%p) flags %#x refc %d\n",
               name->len, name->name, dentry, dentry->d_flags,
@@ -124,9 +119,9 @@ int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name)
                RETURN(0);
 
        if (d_lustre_invalid(dentry))
                RETURN(0);
 
        if (d_lustre_invalid(dentry))
-                RETURN(1);
+               RETURN(1);
 
 
-        RETURN(0);
+       RETURN(0);
 }
 
 static inline int return_if_equal(struct ldlm_lock *lock, void *data)
 }
 
 static inline int return_if_equal(struct ldlm_lock *lock, void *data)
index daeac51..9da81ca 100644 (file)
@@ -857,13 +857,6 @@ void ll_intent_release(struct lookup_intent *);
 void ll_invalidate_aliases(struct inode *);
 void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft);
 void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry);
 void ll_invalidate_aliases(struct inode *);
 void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft);
 void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry);
-#ifdef HAVE_D_COMPARE_7ARGS
-int ll_dcompare(const struct dentry *parent, const struct inode *pinode,
-               const struct dentry *dentry, const struct inode *inode,
-               unsigned int len, const char *str, const struct qstr *d_name);
-#else
-int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name);
-#endif
 int ll_revalidate_it_finish(struct ptlrpc_request *request,
                             struct lookup_intent *it, struct dentry *de);
 
 int ll_revalidate_it_finish(struct ptlrpc_request *request,
                             struct lookup_intent *it, struct dentry *de);