Whamcloud - gitweb
LU-12034 obdclass: disable server-only code on client 66/35566/3
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 18 Jul 2019 19:52:11 +0000 (13:52 -0600)
committerOleg Drokin <green@whamcloud.com>
Thu, 12 Sep 2019 03:46:05 +0000 (03:46 +0000)
The lu_env_add(), lu_env_remove(), and lu_env_find() functions are
only used on the server.  Conditionally remove them when doing a
client-only build.

Fixes: fce8d80624fd ("LU-12034 obdclass: put all service env on list")

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I15f4d4de583bb3f9d16adad3ea16f961853ebbe5
Reviewed-on: https://review.whamcloud.com/35566
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lu_object.h
lustre/obdclass/lu_object.c

index 36bdb5a..4cd2c49 100644 (file)
@@ -1249,9 +1249,23 @@ void lu_env_fini  (struct lu_env *env);
 int  lu_env_refill(struct lu_env *env);
 int  lu_env_refill_by_tags(struct lu_env *env, __u32 ctags, __u32 stags);
 
+#ifdef HAVE_SERVER_SUPPORT
 struct lu_env *lu_env_find(void);
 int lu_env_add(struct lu_env *env);
 void lu_env_remove(struct lu_env *env);
+#else
+static inline struct lu_env *lu_env_find(void)
+{
+       return NULL;
+}
+static inline int lu_env_add(struct lu_env *env)
+{
+       return 0;
+}
+static inline void lu_env_remove(struct lu_env *env)
+{
+}
+#endif /* HAVE_SERVER_SUPPORT */
 
 /** @} lu_context */
 
index 252eb84..0f7918b 100644 (file)
@@ -1901,7 +1901,7 @@ int lu_env_refill_by_tags(struct lu_env *env, __u32 ctags,
 }
 EXPORT_SYMBOL(lu_env_refill_by_tags);
 
-
+#ifdef HAVE_SERVER_SUPPORT
 struct lu_env_item {
        struct task_struct *lei_task;   /* rhashtable key */
        struct rhash_head lei_linkage;
@@ -1913,7 +1913,7 @@ static const struct rhashtable_params lu_env_rhash_params = {
        .key_len     = sizeof(struct task_struct *),
        .key_offset  = offsetof(struct lu_env_item, lei_task),
        .head_offset = offsetof(struct lu_env_item, lei_linkage),
-    };
+};
 
 struct rhashtable lu_env_rhash;
 
@@ -2007,6 +2007,12 @@ struct lu_env *lu_env_find(void)
        return env;
 }
 EXPORT_SYMBOL(lu_env_find);
+#define lu_env_rhash_init(rhash, params) rhashtable_init(rhash, params)
+#define lu_env_rhash_destroy(rhash)     rhashtable_destroy(rhash)
+#else
+#define lu_env_rhash_init(rhash, params) 0
+#define lu_env_rhash_destroy(rhash)     do {} while (0)
+#endif /* HAVE_SERVER_SUPPORT */
 
 static struct shrinker *lu_site_shrinker;
 
@@ -2258,7 +2264,7 @@ int lu_global_init(void)
         if (lu_site_shrinker == NULL)
                 return -ENOMEM;
 
-       result = rhashtable_init(&lu_env_rhash, &lu_env_rhash_params);
+       result = lu_env_rhash_init(&lu_env_rhash, &lu_env_rhash_params);
 
         return result;
 }
@@ -2283,7 +2289,7 @@ void lu_global_fini(void)
         lu_env_fini(&lu_shrink_env);
        up_write(&lu_sites_guard);
 
-       rhashtable_destroy(&lu_env_rhash);
+       lu_env_rhash_destroy(&lu_env_rhash);
 
         lu_ref_global_fini();
 }