Whamcloud - gitweb
LU-4664 libcfs: allow file/func/line passed to CDEBUG() 88/33588/7
authorAndreas Dilger <adilger@whamcloud.com>
Tue, 6 Nov 2018 11:23:00 +0000 (04:23 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 11 Feb 2019 03:21:58 +0000 (03:21 +0000)
Allow the file, function, and line number to be passed to CDEBUG()
messages so that they are not duplicated in helper functions that
may be called from multiple places.

This patch is largely a no-op in terms of code, with the exception
of one call in osc_extent_sanity_check0() to OSC_EXTENT_DUMP() that
is changed to OSC_EXTENT_DUMP_WITH_LOC().

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I0bd866b94daff904c16523d11c710f562a3ebbe5
Reviewed-on: https://review.whamcloud.com/33588
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_debug.h
libcfs/libcfs/tracefile.h
lustre/osc/osc_cache.c

index e847b90..a167cf3 100644 (file)
@@ -86,24 +86,28 @@ struct libcfs_debug_msg_data {
        struct cfs_debug_limit_state    *msg_cdls;
 };
 
        struct cfs_debug_limit_state    *msg_cdls;
 };
 
-#define LIBCFS_DEBUG_MSG_DATA_INIT(data, mask, cdls)        \
-do {                                                        \
-        (data)->msg_subsys = DEBUG_SUBSYSTEM;               \
-        (data)->msg_file   = __FILE__;                      \
-        (data)->msg_fn     = __FUNCTION__;                  \
-        (data)->msg_line   = __LINE__;                      \
-        (data)->msg_cdls   = (cdls);                        \
-        (data)->msg_mask   = (mask);                        \
+#define LIBCFS_DEBUG_MSG_DATA_INIT(file, func, line, msgdata, mask, cdls)\
+do {                                                                   \
+       (msgdata)->msg_subsys = DEBUG_SUBSYSTEM;                        \
+       (msgdata)->msg_file   = (file);                                 \
+       (msgdata)->msg_fn     = (func);                                 \
+       (msgdata)->msg_line   = (line);                                 \
+       (msgdata)->msg_mask   = (mask);                                 \
+       (msgdata)->msg_cdls   = (cdls);                                 \
 } while (0)
 
 } while (0)
 
-#define LIBCFS_DEBUG_MSG_DATA_DECL(dataname, mask, cdls)    \
-        static struct libcfs_debug_msg_data dataname = {    \
-               .msg_subsys = DEBUG_SUBSYSTEM,               \
-               .msg_file   = __FILE__,                      \
-               .msg_fn     = __FUNCTION__,                  \
-               .msg_line   = __LINE__,                      \
-               .msg_cdls   = (cdls)         };              \
-        dataname.msg_mask   = (mask);
+#define LIBCFS_DEBUG_MSG_DATA_DECL_LOC(file, func, line, msgdata, mask, cdls)\
+       static struct libcfs_debug_msg_data msgdata = {                 \
+               .msg_subsys = DEBUG_SUBSYSTEM,                          \
+               .msg_file   = (file),                                   \
+               .msg_fn     = (func),                                   \
+               .msg_line   = (line),                                   \
+               .msg_cdls   = (cdls) };                                 \
+       msgdata.msg_mask   = (mask)
+
+#define LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, cdls)                        \
+       LIBCFS_DEBUG_MSG_DATA_DECL_LOC(__FILE__, __func__, __LINE__,    \
+                                      msgdata, mask, cdls)
 
 #ifdef CDEBUG_ENABLED
 
 
 #ifdef CDEBUG_ENABLED
 
@@ -118,60 +122,67 @@ do {                                                        \
                           (THREAD_SIZE - 1)))
 # endif /* __ia64__ */
 
                           (THREAD_SIZE - 1)))
 # endif /* __ia64__ */
 
-#define __CHECK_STACK(msgdata, mask, cdls)                             \
+#define __CHECK_STACK_WITH_LOC(file, func, line, msgdata, mask, cdls)  \
 do {                                                                   \
        if (unlikely(CDEBUG_STACK() > libcfs_stack)) {                  \
 do {                                                                   \
        if (unlikely(CDEBUG_STACK() > libcfs_stack)) {                  \
-               LIBCFS_DEBUG_MSG_DATA_INIT(msgdata, D_WARNING, NULL);   \
+               LIBCFS_DEBUG_MSG_DATA_INIT(file, func, line, msgdata,   \
+                                          D_WARNING, NULL);            \
                libcfs_stack = CDEBUG_STACK();                          \
                libcfs_stack = CDEBUG_STACK();                          \
-               libcfs_debug_msg(msgdata,                               \
-                                "maximum lustre stack %lu\n",          \
-                                CDEBUG_STACK());                       \
+               libcfs_debug_msg(msgdata, "maximum lustre stack %u\n",  \
+                                libcfs_stack);                         \
                (msgdata)->msg_mask = mask;                             \
                (msgdata)->msg_cdls = cdls;                             \
                dump_stack();                                           \
                /*panic("LBUG");*/                                      \
        }                                                               \
 } while (0)
                (msgdata)->msg_mask = mask;                             \
                (msgdata)->msg_cdls = cdls;                             \
                dump_stack();                                           \
                /*panic("LBUG");*/                                      \
        }                                                               \
 } while (0)
-#define CFS_CHECK_STACK(msgdata, mask, cdls)  __CHECK_STACK(msgdata, mask, cdls)
 #else /* __x86_64__ */
 #else /* __x86_64__ */
-#define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while (0)
 #define CDEBUG_STACK() (0L)
 #define CDEBUG_STACK() (0L)
+#define __CHECK_STACK_WITH_LOC(file, func, line, msgdata, mask, cdls)  \
+       do {} while (0)
 #endif /* __x86_64__ */
 
 #endif /* __x86_64__ */
 
+#define CFS_CHECK_STACK(msgdata, mask, cdls)                           \
+       __CHECK_STACK_WITH_LOC(__FILE__, __func__, __LINE__,            \
+                              msgdata, mask, cdls)
 /**
  * Filters out logging messages based on mask and subsystem.
  */
 static inline int cfs_cdebug_show(unsigned int mask, unsigned int subsystem)
 {
 /**
  * Filters out logging messages based on mask and subsystem.
  */
 static inline int cfs_cdebug_show(unsigned int mask, unsigned int subsystem)
 {
-        return mask & D_CANTMASK ||
-                ((libcfs_debug & mask) && (libcfs_subsystem_debug & subsystem));
+       return mask & D_CANTMASK ||
+              ((libcfs_debug & mask) && (libcfs_subsystem_debug & subsystem));
 }
 
 }
 
-#  define __CDEBUG(cdls, mask, format, ...)                            \
-do {                                                                    \
-        static struct libcfs_debug_msg_data msgdata;                    \
-                                                                        \
-        CFS_CHECK_STACK(&msgdata, mask, cdls);                          \
-                                                                        \
-        if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {                   \
-                LIBCFS_DEBUG_MSG_DATA_INIT(&msgdata, mask, cdls);       \
-                libcfs_debug_msg(&msgdata, format, ## __VA_ARGS__);     \
-        }                                                               \
+#  define __CDEBUG_WITH_LOC(file, func, line, mask, cdls, format, ...) \
+do {                                                                   \
+       static struct libcfs_debug_msg_data msgdata;                    \
+                                                                       \
+       __CHECK_STACK_WITH_LOC(file, func, line, &msgdata, mask, cdls); \
+                                                                       \
+       if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {                   \
+               LIBCFS_DEBUG_MSG_DATA_INIT(file, func, line,            \
+                                          &msgdata, mask, cdls);       \
+               libcfs_debug_msg(&msgdata, format, ## __VA_ARGS__);     \
+       }                                                               \
 } while (0)
 
 } while (0)
 
-#  define CDEBUG(mask, format, ...) __CDEBUG(NULL, mask, format, ## __VA_ARGS__)
+#  define CDEBUG(mask, format, ...)                                    \
+       __CDEBUG_WITH_LOC(__FILE__, __func__, __LINE__,                 \
+                         mask, NULL, format, ## __VA_ARGS__)
 
 #  define CDEBUG_LIMIT(mask, format, ...)                              \
 do {                                                                   \
        static struct cfs_debug_limit_state cdls;                       \
                                                                        \
 
 #  define CDEBUG_LIMIT(mask, format, ...)                              \
 do {                                                                   \
        static struct cfs_debug_limit_state cdls;                       \
                                                                        \
-       __CDEBUG(&cdls, mask, format, ## __VA_ARGS__);                  \
+       __CDEBUG_WITH_LOC(__FILE__, __func__, __LINE__,                 \
+                         mask, &cdls, format, ## __VA_ARGS__);         \
 } while (0)
 
 # else /* !CDEBUG_ENABLED */
 static inline int cfs_cdebug_show(unsigned int mask, unsigned int subsystem)
 {
 } while (0)
 
 # else /* !CDEBUG_ENABLED */
 static inline int cfs_cdebug_show(unsigned int mask, unsigned int subsystem)
 {
-        return 0;
+       return 0;
 }
 #  define CDEBUG(mask, format, ...) (void)(0)
 #  define CDEBUG_LIMIT(mask, format, ...) (void)(0)
 }
 #  define CDEBUG(mask, format, ...) (void)(0)
 #  define CDEBUG_LIMIT(mask, format, ...) (void)(0)
@@ -197,37 +208,38 @@ static inline int cfs_cdebug_show(unsigned int mask, unsigned int subsystem)
                            "%x-%x: " format, errnum, LERRCHKSUM(errnum), ## __VA_ARGS__)
 #define LCONSOLE_ERROR(format, ...) LCONSOLE_ERROR_MSG(0x00, format, ## __VA_ARGS__)
 
                            "%x-%x: " format, errnum, LERRCHKSUM(errnum), ## __VA_ARGS__)
 #define LCONSOLE_ERROR(format, ...) LCONSOLE_ERROR_MSG(0x00, format, ## __VA_ARGS__)
 
-#define LCONSOLE_EMERG(format, ...) CDEBUG(D_CONSOLE | D_EMERG, format, ## __VA_ARGS__)
+#define LCONSOLE_EMERG(format, ...) \
+       CDEBUG(D_CONSOLE | D_EMERG, format, ## __VA_ARGS__)
 
 #if defined(CDEBUG_ENTRY_EXIT)
 
 void libcfs_log_goto(struct libcfs_debug_msg_data *goto_data,
                     const char *label, long rc);
 
 
 #if defined(CDEBUG_ENTRY_EXIT)
 
 void libcfs_log_goto(struct libcfs_debug_msg_data *goto_data,
                     const char *label, long rc);
 
-# define GOTO(label, rc)                                               \
-do {                                                                   \
-       if (cfs_cdebug_show(D_TRACE, DEBUG_SUBSYSTEM)) {                \
-               LIBCFS_DEBUG_MSG_DATA_DECL(_goto_data, D_TRACE, NULL);  \
-               libcfs_log_goto(&_goto_data, #label, (long)(rc));       \
-       } else {                                                        \
-               (void)(rc);                                             \
-       }                                                               \
-                                                                       \
-       goto label;                                                     \
+# define GOTO(label, rc)                                                     \
+do {                                                                         \
+       if (cfs_cdebug_show(D_TRACE, DEBUG_SUBSYSTEM)) {                      \
+               LIBCFS_DEBUG_MSG_DATA_DECL(_goto_data, D_TRACE, NULL);        \
+               libcfs_log_goto(&_goto_data, #label, (long)(rc));             \
+       } else {                                                              \
+               (void)(rc);                                                   \
+       }                                                                     \
+                                                                             \
+       goto label;                                                           \
 } while (0)
 
 
 long libcfs_log_return(struct libcfs_debug_msg_data *, long rc);
 # if BITS_PER_LONG > 32
 } while (0)
 
 
 long libcfs_log_return(struct libcfs_debug_msg_data *, long rc);
 # if BITS_PER_LONG > 32
-#  define RETURN(rc)                                                   \
-do {                                                                   \
-       if (cfs_cdebug_show(D_TRACE, DEBUG_SUBSYSTEM)) {                \
-                LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_TRACE, NULL);    \
-                return (typeof(rc))libcfs_log_return(&msgdata,         \
-                                                     (long)(rc));      \
-       }                                                               \
-                                                                       \
-       return (rc);                                                    \
+#  define RETURN(rc)                                                         \
+do {                                                                         \
+       if (cfs_cdebug_show(D_TRACE, DEBUG_SUBSYSTEM)) {                      \
+               LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_TRACE, NULL);           \
+               return (typeof(rc))libcfs_log_return(&msgdata,                \
+                                                    (long)(rc));             \
+       }                                                                     \
+                                                                             \
+       return rc;                                                            \
 } while (0)
 # else /* BITS_PER_LONG == 32 */
 /* We need an on-stack variable, because we cannot case a 32-bit pointer
 } while (0)
 # else /* BITS_PER_LONG == 32 */
 /* We need an on-stack variable, because we cannot case a 32-bit pointer
@@ -235,16 +247,16 @@ do {                                                                      \
  * casting directly to (long) will truncate 64-bit return values. The log
  * values will print as 32-bit values, but they always have been. LU-1436
  */
  * casting directly to (long) will truncate 64-bit return values. The log
  * values will print as 32-bit values, but they always have been. LU-1436
  */
-#  define RETURN(rc)                                                   \
-do {                                                                   \
-       if (cfs_cdebug_show(D_TRACE, DEBUG_SUBSYSTEM)) {                \
-               typeof(rc) __rc = (rc);                                 \
-               LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_TRACE, NULL);     \
-               libcfs_log_return(&msgdata, (long)__rc);                \
-               return __rc;                                            \
-       }                                                               \
-                                                                       \
-       return (rc);                                                    \
+#  define RETURN(rc)                                                         \
+do {                                                                         \
+       if (cfs_cdebug_show(D_TRACE, DEBUG_SUBSYSTEM)) {                      \
+               typeof(rc) __rc = (rc);                                       \
+               LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_TRACE, NULL);           \
+               libcfs_log_return(&msgdata, (long)__rc);                      \
+               return __rc;                                                  \
+       }                                                                     \
+                                                                             \
+       return rc;                                                            \
 } while (0)
 
 # endif /* BITS_PER_LONG > 32 */
 } while (0)
 
 # endif /* BITS_PER_LONG > 32 */
index c6ca34d..7994ab6 100644 (file)
@@ -297,21 +297,21 @@ extern void cfs_trace_assertion_failed(const char *str,
                                        struct libcfs_debug_msg_data *m);
 
 /* ASSERTION that is safe to use within the debug system */
                                        struct libcfs_debug_msg_data *m);
 
 /* ASSERTION that is safe to use within the debug system */
-#define __LASSERT(cond)                                                 \
-do {                                                                    \
-        if (unlikely(!(cond))) {                                        \
-                LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_EMERG, NULL);     \
-                cfs_trace_assertion_failed("ASSERTION("#cond") failed", \
-                                           &msgdata);                   \
-        }                                                               \
+#define __LASSERT(cond)                                                        \
+do {                                                                   \
+       if (unlikely(!(cond))) {                                        \
+               LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_EMERG, NULL);     \
+               cfs_trace_assertion_failed("ASSERTION("#cond") failed", \
+                                          &msgdata);                   \
+       }                                                               \
 } while (0)
 
 } while (0)
 
-#define __LASSERT_TAGE_INVARIANT(tage)                                  \
-do {                                                                    \
-        __LASSERT(tage != NULL);                                        \
-        __LASSERT(tage->page != NULL);                                  \
-       __LASSERT(tage->used <= PAGE_SIZE);                         \
-       __LASSERT(page_count(tage->page) > 0);                      \
+#define __LASSERT_TAGE_INVARIANT(tage)                                 \
+do {                                                                   \
+       __LASSERT(tage != NULL);                                        \
+       __LASSERT(tage->page != NULL);                                  \
+       __LASSERT(tage->used <= PAGE_SIZE);                             \
+       __LASSERT(page_count(tage->page) > 0);                          \
 } while (0)
 
 #endif /* LUSTRE_TRACEFILE_PRIVATE */
 } while (0)
 
 #endif /* LUSTRE_TRACEFILE_PRIVATE */
index 7721c13..67187c5 100644 (file)
@@ -57,10 +57,10 @@ static int osc_io_unplug_async(const struct lu_env *env,
 static void osc_free_grant(struct client_obd *cli, unsigned int nr_pages,
                           unsigned int lost_grant, unsigned int dirty_grant);
 
 static void osc_free_grant(struct client_obd *cli, unsigned int nr_pages,
                           unsigned int lost_grant, unsigned int dirty_grant);
 
-static void osc_extent_tree_dump0(int level, struct osc_object *obj,
+static void osc_extent_tree_dump0(int mask, struct osc_object *obj,
                                  const char *func, int line);
                                  const char *func, int line);
-#define osc_extent_tree_dump(lvl, obj) \
-       osc_extent_tree_dump0(lvl, obj, __func__, __LINE__)
+#define osc_extent_tree_dump(mask, obj) \
+       osc_extent_tree_dump0(mask, obj, __func__, __LINE__)
 
 static void osc_unreserve_grant(struct client_obd *cli, unsigned int reserved,
                                unsigned int unused);
 
 static void osc_unreserve_grant(struct client_obd *cli, unsigned int reserved,
                                unsigned int unused);
@@ -104,18 +104,19 @@ static inline char list_empty_marker(struct list_head *list)
 static const char *oes_strings[] = {
        "inv", "active", "cache", "locking", "lockdone", "rpc", "trunc", NULL };
 
 static const char *oes_strings[] = {
        "inv", "active", "cache", "locking", "lockdone", "rpc", "trunc", NULL };
 
-#define OSC_EXTENT_DUMP(lvl, extent, fmt, ...) do {                          \
+#define OSC_EXTENT_DUMP_WITH_LOC(file, func, line, mask, extent, fmt, ...) do {\
+       static struct cfs_debug_limit_state cdls;                             \
        struct osc_extent *__ext = (extent);                                  \
        char __buf[16];                                                       \
                                                                              \
        struct osc_extent *__ext = (extent);                                  \
        char __buf[16];                                                       \
                                                                              \
-       CDEBUG(lvl,                                                           \
+       __CDEBUG_WITH_LOC(file, func, line, mask, &cdls,                      \
                "extent %p@{" EXTSTR ", "                                     \
                "[%d|%d|%c|%s|%s|%p], [%d|%d|%c|%c|%p|%u|%p]} " fmt,          \
                /* ----- extent part 0 ----- */                               \
                __ext, EXTPARA(__ext),                                        \
                /* ----- part 1 ----- */                                      \
                "extent %p@{" EXTSTR ", "                                     \
                "[%d|%d|%c|%s|%s|%p], [%d|%d|%c|%c|%p|%u|%p]} " fmt,          \
                /* ----- extent part 0 ----- */                               \
                __ext, EXTPARA(__ext),                                        \
                /* ----- part 1 ----- */                                      \
-               atomic_read(&__ext->oe_refc),                         \
-               atomic_read(&__ext->oe_users),                        \
+               atomic_read(&__ext->oe_refc),                                 \
+               atomic_read(&__ext->oe_users),                                \
                list_empty_marker(&__ext->oe_link),                           \
                oes_strings[__ext->oe_state], ext_flags(__ext, __buf),        \
                __ext->oe_obj,                                                \
                list_empty_marker(&__ext->oe_link),                           \
                oes_strings[__ext->oe_state], ext_flags(__ext, __buf),        \
                __ext->oe_obj,                                                \
@@ -126,12 +127,16 @@ static const char *oes_strings[] = {
                __ext->oe_dlmlock, __ext->oe_mppr, __ext->oe_owner,           \
                /* ----- part 4 ----- */                                      \
                ## __VA_ARGS__);                                              \
                __ext->oe_dlmlock, __ext->oe_mppr, __ext->oe_owner,           \
                /* ----- part 4 ----- */                                      \
                ## __VA_ARGS__);                                              \
-       if (lvl == D_ERROR && __ext->oe_dlmlock != NULL)                      \
+       if (mask == D_ERROR && __ext->oe_dlmlock != NULL)                     \
                LDLM_ERROR(__ext->oe_dlmlock, "extent: %p", __ext);           \
        else                                                                  \
                LDLM_DEBUG(__ext->oe_dlmlock, "extent: %p", __ext);           \
 } while (0)
 
                LDLM_ERROR(__ext->oe_dlmlock, "extent: %p", __ext);           \
        else                                                                  \
                LDLM_DEBUG(__ext->oe_dlmlock, "extent: %p", __ext);           \
 } while (0)
 
+#define OSC_EXTENT_DUMP(mask, ext, fmt, ...)                           \
+       OSC_EXTENT_DUMP_WITH_LOC(__FILE__, __func__, __LINE__,          \
+                                mask, ext, fmt, ## __VA_ARGS__)
+
 #undef EASSERTF
 #define EASSERTF(expr, ext, fmt, args...) do {                         \
        if (!(expr)) {                                                  \
 #undef EASSERTF
 #define EASSERTF(expr, ext, fmt, args...) do {                         \
        if (!(expr)) {                                                  \
@@ -263,9 +268,9 @@ static int osc_extent_sanity_check0(struct osc_extent *ext,
 
 out:
        if (rc != 0)
 
 out:
        if (rc != 0)
-               OSC_EXTENT_DUMP(D_ERROR, ext,
-                               "%s:%d sanity check %p failed with rc = %d\n",
-                               func, line, ext, rc);
+               OSC_EXTENT_DUMP_WITH_LOC(__FILE__, func, line, D_ERROR, ext,
+                                        "sanity check %p failed: rc = %d\n",
+                                        ext, rc);
        return rc;
 }
 
        return rc;
 }
 
@@ -1228,34 +1233,34 @@ out:
        RETURN(rc);
 }
 
        RETURN(rc);
 }
 
-static void osc_extent_tree_dump0(int level, struct osc_object *obj,
+static void osc_extent_tree_dump0(int mask, struct osc_object *obj,
                                  const char *func, int line)
 {
        struct osc_extent *ext;
        int cnt;
 
                                  const char *func, int line)
 {
        struct osc_extent *ext;
        int cnt;
 
-       if (!cfs_cdebug_show(level, DEBUG_SUBSYSTEM))
+       if (!cfs_cdebug_show(mask, DEBUG_SUBSYSTEM))
                return;
 
                return;
 
-       CDEBUG(level, "Dump object %p extents at %s:%d, mppr: %u.\n",
+       CDEBUG(mask, "Dump object %p extents at %s:%d, mppr: %u.\n",
               obj, func, line, osc_cli(obj)->cl_max_pages_per_rpc);
 
        /* osc_object_lock(obj); */
        cnt = 1;
        for (ext = first_extent(obj); ext != NULL; ext = next_extent(ext))
               obj, func, line, osc_cli(obj)->cl_max_pages_per_rpc);
 
        /* osc_object_lock(obj); */
        cnt = 1;
        for (ext = first_extent(obj); ext != NULL; ext = next_extent(ext))
-               OSC_EXTENT_DUMP(level, ext, "in tree %d.\n", cnt++);
+               OSC_EXTENT_DUMP(mask, ext, "in tree %d.\n", cnt++);
 
        cnt = 1;
        list_for_each_entry(ext, &obj->oo_hp_exts, oe_link)
 
        cnt = 1;
        list_for_each_entry(ext, &obj->oo_hp_exts, oe_link)
-               OSC_EXTENT_DUMP(level, ext, "hp %d.\n", cnt++);
+               OSC_EXTENT_DUMP(mask, ext, "hp %d.\n", cnt++);
 
        cnt = 1;
        list_for_each_entry(ext, &obj->oo_urgent_exts, oe_link)
 
        cnt = 1;
        list_for_each_entry(ext, &obj->oo_urgent_exts, oe_link)
-               OSC_EXTENT_DUMP(level, ext, "urgent %d.\n", cnt++);
+               OSC_EXTENT_DUMP(mask, ext, "urgent %d.\n", cnt++);
 
        cnt = 1;
        list_for_each_entry(ext, &obj->oo_reading_exts, oe_link)
 
        cnt = 1;
        list_for_each_entry(ext, &obj->oo_reading_exts, oe_link)
-               OSC_EXTENT_DUMP(level, ext, "reading %d.\n", cnt++);
+               OSC_EXTENT_DUMP(mask, ext, "reading %d.\n", cnt++);
        /* osc_object_unlock(obj); */
 }
 
        /* osc_object_unlock(obj); */
 }
 
@@ -1375,9 +1380,9 @@ static int osc_completion(const struct lu_env *env, struct osc_async_page *oap,
        RETURN(0);
 }
 
        RETURN(0);
 }
 
-#define OSC_DUMP_GRANT(lvl, cli, fmt, args...) do {                    \
+#define OSC_DUMP_GRANT(mask, cli, fmt, args...) do {                   \
        struct client_obd *__tmp = (cli);                               \
        struct client_obd *__tmp = (cli);                               \
-       CDEBUG(lvl, "%s: grant { dirty: %ld/%ld dirty_pages: %ld/%lu "  \
+       CDEBUG(mask, "%s: grant { dirty: %ld/%ld dirty_pages: %ld/%lu " \
               "dropped: %ld avail: %ld, dirty_grant: %ld, "            \
               "reserved: %ld, flight: %d } lru {in list: %ld, "        \
               "left: %ld, waiters: %d }" fmt "\n",                     \
               "dropped: %ld avail: %ld, dirty_grant: %ld, "            \
               "reserved: %ld, flight: %d } lru {in list: %ld, "        \
               "left: %ld, waiters: %d }" fmt "\n",                     \