From: James Simmons Date: Wed, 11 Dec 2013 15:29:41 +0000 (-0500) Subject: LU-3974 llite: dentry d_compare changes in 3.11 X-Git-Tag: 2.5.53~5 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=5fa98dce891b5531e7749142a4debc94a372dba3 LU-3974 llite: dentry d_compare changes in 3.11 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 Change-Id: I363057e4d0a119ad43a9907ec26e7e0079f7c305 Reviewed-on: http://review.whamcloud.com/7746 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Peng Tao Reviewed-by: Bob Glossman Reviewed-by: Yang Sheng Reviewed-by: Oleg Drokin --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index f47bc5f..7f9bb45 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 +],[ + ((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], @@ -1405,6 +1423,7 @@ AC_DEFUN([LC_PROG_LINUX], LC_BLKDEV_RELEASE_RETURN_INT # 3.11 + LC_D_COMPARE_5ARGS LC_HAVE_DCOUNT # diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 6fca4cb..8a8c100 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -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) +#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 { -#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) @@ -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); -#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, @@ -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(1); + RETURN(1); - RETURN(0); + RETURN(0); } static inline int return_if_equal(struct ldlm_lock *lock, void *data) diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index daeac51..9da81ca 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -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); -#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);