Skip to content

Commit 5c5f0d2

Browse files
lxbszidryomov
authored andcommitted
libceph: add doutc and *_client debug macros support
This will help print the fsid and client's global_id in debug logs, and also print the function names. [ idryomov: %lld -> %llu, leading space for doutc(), don't include __func__ in pr_*() variants ] Link: https://tracker.ceph.com/issues/61590 Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Patrick Donnelly <pdonnell@redhat.com> Reviewed-by: Milind Changire <mchangir@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent ffc2532 commit 5c5f0d2

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

include/linux/ceph/ceph_debug.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,25 @@
1919
pr_debug("%.*s %12.12s:%-4d : " fmt, \
2020
8 - (int)sizeof(KBUILD_MODNAME), " ", \
2121
kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
22+
# define doutc(client, fmt, ...) \
23+
pr_debug("%.*s %12.12s:%-4d : [%pU %llu] " fmt, \
24+
8 - (int)sizeof(KBUILD_MODNAME), " ", \
25+
kbasename(__FILE__), __LINE__, \
26+
&client->fsid, client->monc.auth->global_id, \
27+
##__VA_ARGS__)
2228
# else
2329
/* faux printk call just to see any compiler warnings. */
2430
# define dout(fmt, ...) do { \
2531
if (0) \
2632
printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
2733
} while (0)
34+
# define doutc(client, fmt, ...) do { \
35+
if (0) \
36+
printk(KERN_DEBUG "[%pU %llu] " fmt, \
37+
&client->fsid, \
38+
client->monc.auth->global_id, \
39+
##__VA_ARGS__); \
40+
} while (0)
2841
# endif
2942

3043
#else
@@ -33,7 +46,32 @@
3346
* or, just wrap pr_debug
3447
*/
3548
# define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__)
49+
# define doutc(client, fmt, ...) \
50+
pr_debug(" [%pU %llu] %s: " fmt, &client->fsid, \
51+
client->monc.auth->global_id, __func__, ##__VA_ARGS__)
3652

3753
#endif
3854

55+
#define pr_notice_client(client, fmt, ...) \
56+
pr_notice("[%pU %llu]: " fmt, &client->fsid, \
57+
client->monc.auth->global_id, ##__VA_ARGS__)
58+
#define pr_info_client(client, fmt, ...) \
59+
pr_info("[%pU %llu]: " fmt, &client->fsid, \
60+
client->monc.auth->global_id, ##__VA_ARGS__)
61+
#define pr_warn_client(client, fmt, ...) \
62+
pr_warn("[%pU %llu]: " fmt, &client->fsid, \
63+
client->monc.auth->global_id, ##__VA_ARGS__)
64+
#define pr_warn_once_client(client, fmt, ...) \
65+
pr_warn_once("[%pU %llu]: " fmt, &client->fsid, \
66+
client->monc.auth->global_id, ##__VA_ARGS__)
67+
#define pr_err_client(client, fmt, ...) \
68+
pr_err("[%pU %llu]: " fmt, &client->fsid, \
69+
client->monc.auth->global_id, ##__VA_ARGS__)
70+
#define pr_warn_ratelimited_client(client, fmt, ...) \
71+
pr_warn_ratelimited("[%pU %llu]: " fmt, &client->fsid, \
72+
client->monc.auth->global_id, ##__VA_ARGS__)
73+
#define pr_err_ratelimited_client(client, fmt, ...) \
74+
pr_err_ratelimited("[%pU %llu]: " fmt, &client->fsid, \
75+
client->monc.auth->global_id, ##__VA_ARGS__)
76+
3977
#endif

0 commit comments

Comments
 (0)