[PATCH v2 1/6] ceph: add the *_client debug macros support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Xiubo Li <xiubli@xxxxxxxxxx>

This will help print the client's global_id in debug logs.

URL: https://tracker.ceph.com/issues/61590
Cc: Patrick Donnelly <pdonnell@xxxxxxxxxx>
Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
---
 include/linux/ceph/ceph_debug.h | 38 ++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h
index d5a5da838caf..41bfbdb5dd85 100644
--- a/include/linux/ceph/ceph_debug.h
+++ b/include/linux/ceph/ceph_debug.h
@@ -19,12 +19,22 @@
 	pr_debug("%.*s %12.12s:%-4d : " fmt,				\
 		 8 - (int)sizeof(KBUILD_MODNAME), "    ",		\
 		 kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
+#  define dout_client(client, fmt, ...)					\
+	pr_debug("%.*s %12.12s:%-4d : [client.%lld] " fmt,		\
+		 8 - (int)sizeof(KBUILD_MODNAME), "    ",		\
+		 kbasename(__FILE__), __LINE__,				\
+		 client->monc.auth->global_id,				\
+		 ##__VA_ARGS__)
 # else
 /* faux printk call just to see any compiler warnings. */
 #  define dout(fmt, ...)	do {				\
 		if (0)						\
 			printk(KERN_DEBUG fmt, ##__VA_ARGS__);	\
 	} while (0)
+#  define dout_client(client, fmt, ...)	do {			\
+		if (0)						\
+			printk(KERN_DEBUG fmt, ##__VA_ARGS__);	\
+	} while (0)
 # endif
 
 #else
@@ -33,7 +43,33 @@
  * or, just wrap pr_debug
  */
 # define dout(fmt, ...)	pr_debug(" " fmt, ##__VA_ARGS__)
-
+# define dout_client(client, fmt, ...)					 \
+	pr_debug(" [client.%lld] " fmt,	client->monc.auth->global_id,	 \
+		 ##__VA_ARGS__)
 #endif
 
+# define pr_notice_client(client, fmt, ...)				 \
+	pr_notice(" [client.%lld] " fmt, client->monc.auth->global_id,	 \
+		##__VA_ARGS__)
+# define pr_info_client(client, fmt, ...)				 \
+	pr_info(" [client.%lld] " fmt, client->monc.auth->global_id,	 \
+		##__VA_ARGS__)
+# define pr_warn_client(client, fmt, ...)				 \
+	pr_warn(" [client.%lld] " fmt, client->monc.auth->global_id,	 \
+		##__VA_ARGS__)
+# define pr_warn_once_client(client, fmt, ...)				 \
+	pr_warn_once(" [client.%lld] " fmt, client->monc.auth->global_id,\
+		##__VA_ARGS__)
+# define pr_err_client(client, fmt, ...)				 \
+	pr_err(" [client.%lld] " fmt, client->monc.auth->global_id,	 \
+		##__VA_ARGS__)
+# define pr_warn_ratelimited_client(client, fmt, ...)			 \
+	pr_warn_ratelimited(" [client.%lld] " fmt,			 \
+			    client->monc.auth->global_id,		 \
+			    ##__VA_ARGS__)
+# define pr_err_ratelimited_client(client, fmt, ...)			 \
+	pr_err_ratelimited(" [client.%lld] " fmt,			 \
+			    client->monc.auth->global_id,		 \
+			    ##__VA_ARGS__)
+
 #endif
-- 
2.40.1




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux