Whamcloud - gitweb
LU-6215 ldlm: handle percpu_counter_init change in 3.18+ kernels 49/16649/6
authorJames Simmons <uja.ornl@yahoo.com>
Thu, 1 Oct 2015 18:59:15 +0000 (14:59 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 7 Oct 2015 17:39:41 +0000 (17:39 +0000)
Starting in 3.18 kernels the function percpu_counter_init()
started to take memory allocation flags GFP_*. This patch
detects and handles this new case thus enabling lustre servers
to function up to 4.2.1 kernels.

Change-Id: Ibdb716987c367dc6ea93f6f9747fb70fd7ac2cbb
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/16649
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Jenkins
Reviewed-by: Frank Zago <fzago@cray.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/autoconf/lustre-core.m4
lustre/ldlm/ldlm_reclaim.c

index ac3c74b..dbd055b 100644 (file)
@@ -1768,6 +1768,25 @@ EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_NFS_FILLDIR_USE_CTX
 
 #
 ]) # LC_NFS_FILLDIR_USE_CTX
 
 #
+# LC_PERCPU_COUNTER_INIT
+#
+# 3.18 For kernels 3.18 and after percpu_counter_init starts
+#      to pass a GFP_* memory allocation flag for internal
+#      memory allocation purposes.
+#
+AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
+LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
+percpu_counter_init, [
+       #include <linux/percpu_counter.h>
+],[
+       percpu_counter_init(NULL, 0, GFP_KERNEL);
+],[
+       AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
+               [percpu_counter_init uses GFP_* flag])
+])
+]) # LC_PERCPU_COUNTER_INIT
+
+#
 # LC_KIOCB_HAS_NBYTES
 #
 # 3.19 kernel removed ki_nbytes from struct kiocb
 # LC_KIOCB_HAS_NBYTES
 #
 # 3.19 kernel removed ki_nbytes from struct kiocb
@@ -2067,6 +2086,7 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_KEY_MATCH_DATA
 
        # 3.18
        LC_KEY_MATCH_DATA
 
        # 3.18
+       LC_PERCPU_COUNTER_INIT
        LC_NFS_FILLDIR_USE_CTX
 
        # 3.19
        LC_NFS_FILLDIR_USE_CTX
 
        # 3.19
index d256c64..7fda5cf 100644 (file)
@@ -370,7 +370,11 @@ int ldlm_reclaim_setup(void)
        ldlm_last_reclaim_age = LDLM_RECLAIM_AGE_MAX;
        ldlm_last_reclaim_time = cfs_time_current();
 
        ldlm_last_reclaim_age = LDLM_RECLAIM_AGE_MAX;
        ldlm_last_reclaim_time = cfs_time_current();
 
+#ifdef HAVE_PERCPU_COUNTER_INIT_GFP_FLAG
+       return percpu_counter_init(&ldlm_granted_total, 0, GFP_KERNEL);
+#else
        return percpu_counter_init(&ldlm_granted_total, 0);
        return percpu_counter_init(&ldlm_granted_total, 0);
+#endif
 }
 
 void ldlm_reclaim_cleanup(void)
 }
 
 void ldlm_reclaim_cleanup(void)