From 4a50afa42e67244398158a2b68ae68fc0eb68cd7 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Thu, 2 Mar 2017 22:48:44 +0300 Subject: [PATCH] LU-9183 llite: handle removal of parent argument of ->d_compare() In commit 6fa67e707559303e086303aeecc9e8b91ef497d5 the parent parameter for ->d_compare() was removed. Change-Id: Ia241619c3ade13036154973a19f44a2083a9bc53 Signed-off-by: Dmitry Eremin Reviewed-on: https://review.whamcloud.com/25818 Reviewed-by: James Simmons Reviewed-by: Jinshan Xiong Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 19 +++++++++++++++++++ lustre/llite/dcache.c | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 73160ae..2ea8caa 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2307,6 +2307,24 @@ posix_acl_valid, [ ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS # +# LC_D_COMPARE_4ARGS +# +# Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5 +# get rid of 'parent' argument of ->d_compare() +# +AC_DEFUN([LC_D_COMPARE_4ARGS], [ +LB_CHECK_COMPILE([if 'd_compare' taken 4 arguments], +d_compare_4args, [ + #include +],[ + ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL); +],[ + AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1, + [d_compare need 4 arguments]) +]) +]) # LC_D_COMPARE_4ARGS + +# # LC_PROG_LINUX # # Lustre linux kernel checks @@ -2497,6 +2515,7 @@ AC_DEFUN([LC_PROG_LINUX], [ # 4.8 LC_HAVE_POSIX_ACL_VALID_USER_NS + LC_D_COMPARE_4ARGS # AS_IF([test "x$enable_server" != xno], [ diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index b9c3589..a8fb890 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -88,12 +88,15 @@ static int ll_dcompare(const struct dentry *parent, const struct inode *pinode, static int ll_dcompare(const struct dentry *parent, const struct dentry *dentry, unsigned int len, const char *str, const struct qstr *name) +#elif defined(HAVE_D_COMPARE_4ARGS) +static int ll_dcompare(const struct dentry *dentry, unsigned int len, + const char *str, const struct qstr *name) #else static int ll_dcompare(struct dentry *parent, struct qstr *d_name, struct qstr *name) #endif { -#if !defined(HAVE_D_COMPARE_7ARGS) && !defined(HAVE_D_COMPARE_5ARGS) +#if !defined(HAVE_D_COMPARE_7ARGS) && !defined(HAVE_D_COMPARE_5ARGS) && !defined(HAVE_D_COMPARE_4ARGS) /* 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; -- 1.8.3.1