[sheepdog] [PATCH] sbd: redefine sbd_debug()
Hitoshi Mitake
mitake.hitoshi at gmail.com
Tue Jan 20 13:48:49 CET 2015
At Tue, 20 Jan 2015 18:19:18 +0800,
hujianyang wrote:
>
> Current marco sbd_debug() will always print debug message
> while CONFIG_DYNAMIC_DEBUG=y. That's because the missing
> condition check of *_DPRINTK_FLAGS_PRINT*.
>
> diff --git a/sbd/sbd.h b/sbd/sbd.h
> index c0b9ef3..97ab921 100644
> --- a/sbd/sbd.h
> +++ b/sbd/sbd.h
> @@ -131,6 +131,7 @@ static inline int sbd_dev_id_to_minor(int id)
> # define sbd_debug(fmt, ...) \
> ({ \
> SBD_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
> + if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
> __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
> ##__VA_ARGS__); \
>
> See include/linux/dynamic_debug.h line 77.
>
> But I don't think this implement is good. We could directly
> call *pr_debug* as other kernel modules do.
>
> This patch redefine sbd_debug() as pr_debug call without
> changing messages format and of course fix the messages
> always printing problem.
>
> Signed-off-by: hujianyang <hujianyang at huawei.com>
> ---
> sbd/sbd.h | 32 +++-----------------------------
> 1 files changed, 3 insertions(+), 29 deletions(-)
Applied, thanks.
Hitoshi
>
> diff --git a/sbd/sbd.h b/sbd/sbd.h
> index c0b9ef3..5da4a90 100644
> --- a/sbd/sbd.h
> +++ b/sbd/sbd.h
> @@ -112,34 +112,8 @@ static inline int sbd_dev_id_to_minor(int id)
> return id << SBD_MINORS_SHIFT;
> }
>
> -#if defined(CONFIG_DYNAMIC_DEBUG) && defined _DPRINTK_FLAGS_INCL_MODNAME
> -
> -# define _SBD_FLAGS ( _DPRINTK_FLAGS_INCL_MODNAME \
> - | _DPRINTK_FLAGS_INCL_FUNCNAME | _DPRINTK_FLAGS_INCL_LINENO)
> -
> -# define SBD_DYNAMIC_DEBUG_METADATA(name, fmt) \
> - static struct _ddebug __aligned(8) \
> - __attribute__((section("__verbose"))) name = { \
> - .modname = KBUILD_MODNAME, \
> - .function = __func__, \
> - .filename = __FILE__, \
> - .format = (fmt), \
> - .lineno = __LINE__, \
> - .flags = _SBD_FLAGS, \
> - }
> -
> -# define sbd_debug(fmt, ...) \
> -({ \
> - SBD_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
> - __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
> - ##__VA_ARGS__); \
> -})
> -
> -#else
> -
> -/* If -DDEBUG is not set, pr_debug = no_printk */
> -# define sbd_debug pr_debug
> -
> -#endif /* CONFIG_DYNAMIC_DEBUG */
> +#define sbd_debug(fmt, ...) \
> + pr_debug("%s:%s:%u " fmt, KBUILD_MODNAME, __func__, \
> + __LINE__, ##__VA_ARGS__)
>
> #endif /* _SBD_H_ */
> --
> 1.6.0.2
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog
More information about the sheepdog
mailing list