From: Andreas Dilger Date: Thu, 18 Jul 2019 19:52:11 +0000 (-0600) Subject: LU-12034 obdclass: disable server-only code on client X-Git-Tag: 2.12.3-RC1~84 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=bc74a0e9929cf438e099d4e21ea41e3b140109f6;p=fs%2Flustre-release.git LU-12034 obdclass: disable server-only code on client 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 Change-Id: I15f4d4de583bb3f9d16adad3ea16f961853ebbe5 Reviewed-on: https://review.whamcloud.com/35566 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 36bdb5a..4cd2c49 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -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 */ diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 252eb84..0f7918b 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -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(); }