From d86c446837e0ca9b3086639fa63b7bbb2516863d Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Wed, 31 Oct 2012 15:03:46 +0800 Subject: [PATCH] LU-2335 kernel: add CONFIG_ prefix to config values Kernel uses CONFIG_ prefix for all values that comes from Kconfig. So do the same for Lustre. Rename OBD_MAX_IOCTL_BUFFER to CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER, LNET_MAX_PAYLOAD to CONFIG_LNET_MAX_PAYLOAD, and INVARIANT_CHECK to CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK. Signed-off-by: Peng Tao Change-Id: I3b1fdea02ba195ce7ff0793c218ac1f505243bb3 Reviewed-on: http://review.whamcloud.com/4646 Tested-by: Hudson Reviewed-by: Andreas Dilger Reviewed-by: Fan Yong Tested-by: Maloo --- libcfs/include/libcfs/libcfs_private.h | 4 ++-- lnet/autoconf/lustre-lnet.m4 | 8 ++++---- lnet/include/lnet/types.h | 5 +++-- lustre/autoconf/lustre-core.m4 | 4 ++-- lustre/include/lclient.h | 8 ++++---- lustre/include/lustre_lib.h | 1 + lustre/obdclass/cl_page.c | 8 ++++---- lustre/obdclass/darwin/darwin-module.c | 6 +++++- lustre/osc/osc_cl_internal.h | 2 +- lustre/osc/osc_lock.c | 4 ++-- lustre/osc/osc_object.c | 2 +- lustre/osc/osc_page.c | 2 +- 12 files changed, 30 insertions(+), 24 deletions(-) diff --git a/libcfs/include/libcfs/libcfs_private.h b/libcfs/include/libcfs/libcfs_private.h index f699862..921431a 100644 --- a/libcfs/include/libcfs/libcfs_private.h +++ b/libcfs/include/libcfs/libcfs_private.h @@ -107,7 +107,7 @@ do { \ # define LASSERTF(cond, ...) ((void)sizeof!!(cond)) #endif /* !LIBCFS_DEBUG */ -#ifdef INVARIANT_CHECK +#ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK /** * This is for more expensive checks that one doesn't want to be enabled all * the time. LINVRNT() has to be explicitly enabled by --enable-invariants @@ -274,7 +274,7 @@ do { \ assert(cond); \ } while (0) # define LBUG() assert(0) -# ifdef INVARIANT_CHECK +# ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK # define LINVRNT(exp) LASSERT(exp) # else # define LINVRNT(exp) ((void)sizeof!!(exp)) diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 index 01c2794..0a1232e 100644 --- a/lnet/autoconf/lustre-lnet.m4 +++ b/lnet/autoconf/lustre-lnet.m4 @@ -10,13 +10,13 @@ AC_ARG_WITH([max-payload-mb], [set maximum lnet payload in MBytes]), [ AC_MSG_RESULT([$with_max_payload_mb]) - LNET_MAX_PAYLOAD_MB=$with_max_payload_mb - LNET_MAX_PAYLOAD="(($with_max_payload_mb)<<20)" + CONFIG_LNET_MAX_PAYLOAD_MB=$with_max_payload_mb + CONFIG_LNET_MAX_PAYLOAD="(($with_max_payload_mb)<<20)" ], [ AC_MSG_RESULT([no]) - LNET_MAX_PAYLOAD="LNET_MTU" + CONFIG_LNET_MAX_PAYLOAD="LNET_MTU" ]) - AC_DEFINE_UNQUOTED(LNET_MAX_PAYLOAD, $LNET_MAX_PAYLOAD, + AC_DEFINE_UNQUOTED(CONFIG_LNET_MAX_PAYLOAD, $CONFIG_LNET_MAX_PAYLOAD, [Max LNET payload]) ]) diff --git a/lnet/include/lnet/types.h b/lnet/include/lnet/types.h index 2e7d269..eb82bb0 100644 --- a/lnet/include/lnet/types.h +++ b/lnet/include/lnet/types.h @@ -279,9 +279,10 @@ typedef struct { #define LNET_MAX_IOV 256 /* Max payload size */ -#ifndef LNET_MAX_PAYLOAD -# error "LNET_MAX_PAYLOAD must be defined in config.h" +#ifndef CONFIG_LNET_MAX_PAYLOAD +# error "CONFIG_LNET_MAX_PAYLOAD must be defined in config.h" #else +# define LNET_MAX_PAYLOAD CONFIG_LNET_MAX_PAYLOAD # if (LNET_MAX_PAYLOAD < LNET_MTU) # error "LNET_MAX_PAYLOAD too small - error in configure --with-max-payload-mb" # elif defined(__KERNEL__) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 067090f..d769124 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -62,7 +62,7 @@ AC_ARG_WITH([obd-buffer-size], OBD_BUFFER_SIZE=8192 ]) AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes]) -AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size]) +AC_DEFINE_UNQUOTED(CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size]) ]) # @@ -2829,7 +2829,7 @@ AC_ARG_ENABLE([invariants], AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)]) AC_MSG_RESULT([$enable_invariants]) if test x$enable_invariants = xyes ; then - AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking]) + AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1, [enable invariant checking]) fi AC_ARG_ENABLE([lu_ref], diff --git a/lustre/include/lclient.h b/lustre/include/lclient.h index f0e456f..ae8f0c7 100644 --- a/lustre/include/lclient.h +++ b/lustre/include/lclient.h @@ -390,7 +390,7 @@ __u16 ll_dirent_type_get(struct lu_dirent *ent); __u64 cl_fid_build_ino(const struct lu_fid *fid, int api32); __u32 cl_fid_build_gen(const struct lu_fid *fid); -#ifdef INVARIANT_CHECK +#ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK # define CLOBINVRNT(env, clob, expr) \ do { \ if (unlikely(!(expr))) { \ @@ -398,10 +398,10 @@ __u32 cl_fid_build_gen(const struct lu_fid *fid); LINVRNT(0); \ } \ } while (0) -#else /* !INVARIANT_CHECK */ +#else /* !CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK */ # define CLOBINVRNT(env, clob, expr) \ - ((void)sizeof(env), (void)sizeof(clob), (void)sizeof !!(expr)) -#endif /* !INVARIANT_CHECK */ + ((void)sizeof(env), (void)sizeof(clob), (void)sizeof !!(expr)) +#endif /* !CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK */ int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp); int cl_ocd_update(struct obd_device *host, diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index 2a008fe..92fc0d1 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -94,6 +94,7 @@ int do_set_info_async(struct obd_import *imp, struct ptlrpc_request_set *set); #define OBD_RECOVERY_MAX_TIME (obd_timeout * 18) /* b13079 */ +#define OBD_MAX_IOCTL_BUFFER CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id); diff --git a/lustre/obdclass/cl_page.c b/lustre/obdclass/cl_page.c index e837d30..cfa1f60 100644 --- a/lustre/obdclass/cl_page.c +++ b/lustre/obdclass/cl_page.c @@ -64,7 +64,7 @@ static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg, ((void)sizeof(env), (void)sizeof(page), (void)sizeof !!(exp)) #endif /* !LIBCFS_DEBUG */ -#ifdef INVARIANT_CHECK +#ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK # define PINVRNT(env, page, expr) \ do { \ if (unlikely(!(expr))) { \ @@ -72,10 +72,10 @@ static void cl_page_delete0(const struct lu_env *env, struct cl_page *pg, LINVRNT(0); \ } \ } while (0) -#else /* !INVARIANT_CHECK */ +#else /* !CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK */ # define PINVRNT(env, page, exp) \ - ((void)sizeof(env), (void)sizeof(page), (void)sizeof !!(exp)) -#endif /* !INVARIANT_CHECK */ + ((void)sizeof(env), (void)sizeof(page), (void)sizeof !!(exp)) +#endif /* !CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK */ /* Disable page statistic by default due to huge performance penalty. */ #ifdef CONFIG_DEBUG_PAGESTATE_TRACKING diff --git a/lustre/obdclass/darwin/darwin-module.c b/lustre/obdclass/darwin/darwin-module.c index ee9db9a..f5969d2 100644 --- a/lustre/obdclass/darwin/darwin-module.c +++ b/lustre/obdclass/darwin/darwin-module.c @@ -48,7 +48,11 @@ #include #ifndef OBD_MAX_IOCTL_BUFFER -#define OBD_MAX_IOCTL_BUFFER 8192 +#ifdef CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER +#define OBD_MAX_IOCTL_BUFFER CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER +#else +#define OBD_MAX_IOCTL_BUFFER 8192 +#endif #endif /* buffer MUST be at least the size of obd_ioctl_hdr */ diff --git a/lustre/osc/osc_cl_internal.h b/lustre/osc/osc_cl_internal.h index 0dea7b5..d53c29f 100644 --- a/lustre/osc/osc_cl_internal.h +++ b/lustre/osc/osc_cl_internal.h @@ -123,7 +123,7 @@ struct osc_object { */ int oo_contended; cfs_time_t oo_contention_time; -#ifdef INVARIANT_CHECK +#ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK /** * IO context used for invariant checks in osc_lock_has_pages(). */ diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index 7404845..f32ba86 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -1354,7 +1354,7 @@ static void osc_lock_cancel(const struct lu_env *env, osc_lock_detach(env, olck); } -#ifdef INVARIANT_CHECK +#ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK static int check_cb(const struct lu_env *env, struct cl_io *io, struct cl_page *page, void *cbdata) { @@ -1425,7 +1425,7 @@ static int osc_lock_has_pages(struct osc_lock *olck) { return 0; } -#endif /* INVARIANT_CHECK */ +#endif /* CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK */ static void osc_lock_delete(const struct lu_env *env, const struct cl_lock_slice *slice) diff --git a/lustre/osc/osc_object.c b/lustre/osc/osc_object.c index 741cc48..2f02791 100644 --- a/lustre/osc/osc_object.c +++ b/lustre/osc/osc_object.c @@ -77,7 +77,7 @@ static int osc_object_init(const struct lu_env *env, struct lu_object *obj, int i; osc->oo_oinfo = cconf->u.coc_oinfo; -#ifdef INVARIANT_CHECK +#ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK mutex_init(&osc->oo_debug_mutex); #endif spin_lock_init(&osc->oo_seatbelt); diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index 6e89354..89c0aa0 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -529,7 +529,7 @@ int osc_page_init(const struct lu_env *env, struct cl_object *obj, * Cannot assert osc_page_protected() here as read-ahead * creates temporary pages outside of a lock. */ -#ifdef INVARIANT_CHECK +#ifdef CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK opg->ops_temp = !osc_page_protected(env, opg, CLM_READ, 1); #endif /* ops_inflight and ops_lru are the same field, but it doesn't -- 1.8.3.1