[PATCH] staging/lustre: fix build errors

Peng, Tao tao.peng at emc.com
Tue Jun 4 08:45:41 UTC 2013


From 369398c782c914e5f0548d5bbad22c00c6b58b6a Mon Sep 17 00:00:00 2001
From: Peng Tao <bergwolf at gmail.com>
Date: Tue, 4 Jun 2013 15:48:17 +0800
Subject: [PATCH] staging/lustre: fix build errors

There are several issues:
1. set_cpus_allowed() is not available with CONFIG_CPUMASK_OFFSTACK on
2. CONFIG_MODULES may not be defined
3. CONFIG_MODULE_UNLOAD may not be defined

Signed-off-by: Peng Tao <tao.peng at emc.com>
---
Stephen, please see if this fixes your build failure. I have tested it locally but only on X86 architecture, with CONFIG_CPUMASK_OFFSTACK on and CONFIG_MODULES/CONFIG_MODULE_UNLOAD off.

 .../lustre/include/linux/libcfs/linux/linux-prim.h |    2 --
 .../include/linux/libcfs/linux/portals_compat25.h  |    2 --
 .../staging/lustre/lustre/libcfs/linux/linux-cpu.c |    2 +-
 drivers/staging/lustre/lustre/obdclass/lu_object.c |    6 ++++++
 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c     |    4 ++--
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-prim.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-prim.h
index c346bcd..a4963a8 100644
--- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-prim.h
+++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-prim.h
@@ -79,8 +79,6 @@
 #define NR_CPUS     1
 #endif
 
-#define cfs_set_cpus_allowed(t, mask)  set_cpus_allowed(t, mask)
-
 /*
  * cache
  */
diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/portals_compat25.h b/drivers/staging/lustre/include/linux/libcfs/linux/portals_compat25.h
index 2b94872..132a4be 100644
--- a/drivers/staging/lustre/include/linux/libcfs/linux/portals_compat25.h
+++ b/drivers/staging/lustre/include/linux/libcfs/linux/portals_compat25.h
@@ -109,8 +109,6 @@ int proc_call_handler(void *data, int write,
 #define NR_CPUS     1
 #endif
 
-#define cfs_set_cpus_allowed(t, mask)  set_cpus_allowed(t, mask)
-
 #define cfs_register_sysctl_table(t, a) register_sysctl_table(t)
 
 #endif /* _PORTALS_COMPAT_H */
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
index 6e255ff..95142d1 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c
@@ -627,7 +627,7 @@ cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt)
 		if (cpu_isset(i, *cpumask))
 			continue;
 
-		rc = set_cpus_allowed(current, *cpumask);
+		rc = set_cpus_allowed_ptr(current, cpumask);
 		set_mems_allowed(*nodemask);
 		if (rc == 0)
 			schedule(); /* switch to allowed CPU */
diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c b/drivers/staging/lustre/lustre/obdclass/lu_object.c
index 1cbbb6f..da459e1 100644
--- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
@@ -1351,7 +1351,9 @@ static void key_fini(struct lu_context *ctx, int index)
 
 		LASSERT(key->lct_owner != NULL);
 		if ((ctx->lc_tags & LCT_NOREF) == 0) {
+#ifdef CONFIG_MODULE_UNLOAD
 			LINVRNT(module_refcount(key->lct_owner) > 0);
+#endif
 			module_put(key->lct_owner);
 		}
 		ctx->lc_value[index] = NULL;
@@ -1933,7 +1935,11 @@ void lu_context_keys_dump(void)
 			       i, key, key->lct_tags,
 			       key->lct_init, key->lct_fini, key->lct_exit,
 			       key->lct_index, atomic_read(&key->lct_used),
+#ifdef CONFIG_MODULES
 			       key->lct_owner ? key->lct_owner->name : "",
+#else
+			       "",
+#endif
 			       key->lct_owner);
 			lu_ref_print(&key->lct_reference);
 		}
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
index 185841f..5a66a1b 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
@@ -395,8 +395,8 @@ static int ptlrpcd(void *arg)
 				if (++index >= num_possible_cpus())
 					index = 0;
 			}
-			cfs_set_cpus_allowed(current,
-				     *cpumask_of_node(cpu_to_node(index)));
+			set_cpus_allowed_ptr(current,
+					cpumask_of_node(cpu_to_node(index)));
 		}
 	}
 #endif
-- 
1.7.1



More information about the devel mailing list