@@ -36,6 +36,7 @@
*/
#define DEBUG_SUBSYSTEM S_CLASS
+#include <linux/kconfig.h>
#include <linux/libcfs/libcfs_cpu.h>
#include <obd_class.h>
#include <lustre_log.h>
@@ -97,7 +98,7 @@ static struct obd_type *class_get_type(const char *name)
rcu_read_lock();
type = class_search_type(name);
-
+#if IS_MODULE(CONFIG_LUSTRE_FS)
if (!type) {
const char *modname = name;
@@ -111,6 +112,7 @@ static struct obd_type *class_get_type(const char *name)
rcu_read_lock();
type = class_search_type(name);
}
+#endif
if (type) {
/*
* Holding rcu_read_lock() matches the synchronize_rcu() call
@@ -2556,22 +2556,22 @@ static struct lnet_lnd *lnet_load_lnd(u32 lnd_type)
mutex_lock(&the_lnet.ln_lnd_mutex);
lnd = lnet_find_lnd_by_type(lnd_type);
if (!lnd) {
+#if IS_MODULE(CONFIG_LNET)
mutex_unlock(&the_lnet.ln_lnd_mutex);
rc = request_module("%s", libcfs_lnd2modname(lnd_type));
mutex_lock(&the_lnet.ln_lnd_mutex);
lnd = lnet_find_lnd_by_type(lnd_type);
if (!lnd) {
- mutex_unlock(&the_lnet.ln_lnd_mutex);
CERROR("Can't load LND %s, module %s, rc=%d\n",
libcfs_lnd2str(lnd_type),
libcfs_lnd2modname(lnd_type), rc);
-#ifndef HAVE_MODULE_LOADING_SUPPORT
- LCONSOLE_ERROR_MSG(0x104,
- "Your kernel must be compiled with kernel module loading support.");
-#endif
- return ERR_PTR(-EINVAL);
+ lnd = ERR_PTR(-EINVAL);
}
+#else
+ LCONSOLE_ERROR("Could not find LND %s\n", libcfs_lnd2str(lnd_type));
+ lnd = ERR_PTR(-EINVAL);
+#endif
}
mutex_unlock(&the_lnet.ln_lnd_mutex);