ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: xiubli@redhat.com
To: idryomov@gmail.com, ceph-devel@vger.kernel.org
Cc: jlayton@kernel.org, vshankar@redhat.com, mchangir@redhat.com,
	Xiubo Li <xiubli@redhat.com>,
	Patrick Donnelly <pdonnell@redhat.com>
Subject: [PATCH v4 1/6] ceph: add the *_client debug macros support
Date: Mon, 19 Jun 2023 15:14:33 +0800	[thread overview]
Message-ID: <20230619071438.7000-2-xiubli@redhat.com> (raw)
In-Reply-To: <20230619071438.7000-1-xiubli@redhat.com>

From: Xiubo Li <xiubli@redhat.com>

This will help print the fsid and client's global_id in debug logs,
and also print the function names.

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

diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h
index d5a5da838caf..0b5f210ca977 100644
--- a/include/linux/ceph/ceph_debug.h
+++ b/include/linux/ceph/ceph_debug.h
@@ -19,12 +19,26 @@
 	pr_debug("%.*s %12.12s:%-4d : " fmt,				\
 		 8 - (int)sizeof(KBUILD_MODNAME), "    ",		\
 		 kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
+#  define doutc(client, fmt, ...)					\
+	pr_debug("%.*s %12.12s:%-4d : [%pU %lld] " fmt,			\
+		 8 - (int)sizeof(KBUILD_MODNAME), "    ",		\
+		 kbasename(__FILE__), __LINE__,				\
+		 &client->fsid, 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 doutc(client, fmt, ...)	do {			\
+		if (0)						\
+			printk(KERN_DEBUG "[%pU %lld] " fmt,	\
+			&client->fsid,				\
+			client->monc.auth->global_id,		\
+			##__VA_ARGS__);				\
+		} while (0)
+
 # endif
 
 #else
@@ -33,7 +47,39 @@
  * or, just wrap pr_debug
  */
 # define dout(fmt, ...)	pr_debug(" " fmt, ##__VA_ARGS__)
-
+# define doutc(client, fmt, ...)					\
+	pr_debug("[%pU %lld] %s: " fmt, &client->fsid,			\
+		 client->monc.auth->global_id, __func__,		\
+		 ##__VA_ARGS__)
 #endif
 
+# define pr_notice_client(client, fmt, ...)				\
+	pr_notice("[%pU %lld] %s: " fmt, &client->fsid,			\
+		  client->monc.auth->global_id, __func__,		\
+		  ##__VA_ARGS__)
+# define pr_info_client(client, fmt, ...)				\
+	pr_info("[%pU %lld] %s: " fmt, &client->fsid,			\
+		client->monc.auth->global_id, __func__,			\
+		##__VA_ARGS__)
+# define pr_warn_client(client, fmt, ...)				\
+	pr_warn("[%pU %lld] %s: " fmt, &client->fsid,			\
+		client->monc.auth->global_id, __func__,			\
+		##__VA_ARGS__)
+# define pr_warn_once_client(client, fmt, ...)				\
+	pr_warn_once("[%pU %lld] %s: " fmt, &client->fsid,		\
+		     client->monc.auth->global_id, __func__,		\
+		     ##__VA_ARGS__)
+# define pr_err_client(client, fmt, ...)				\
+	pr_err("[%pU %lld] %s: " fmt, &client->fsid,			\
+	       client->monc.auth->global_id, __func__,			\
+	       ##__VA_ARGS__)
+# define pr_warn_ratelimited_client(client, fmt, ...)			\
+	pr_warn_ratelimited("[%pU %lld] %s: " fmt, &client->fsid,	\
+			    client->monc.auth->global_id, __func__,	\
+			    ##__VA_ARGS__)
+# define pr_err_ratelimited_client(client, fmt, ...)			\
+	pr_err_ratelimited("[%pU %lld] %s: " fmt, &client->fsid,	\
+			   client->monc.auth->global_id, __func__,	\
+			   ##__VA_ARGS__)
+
 #endif
-- 
2.40.1


  reply	other threads:[~2023-06-19  7:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19  7:14 [PATCH v4 0/6] ceph: print the client global id for debug logs xiubli
2023-06-19  7:14 ` xiubli [this message]
2023-09-04  9:27   ` [PATCH v4 1/6] ceph: add the *_client debug macros support Milind Changire
2023-06-19  7:14 ` [PATCH v4 2/6] ceph: pass the mdsc to several helpers xiubli
2023-09-04  9:28   ` Milind Changire
2023-06-19  7:14 ` [PATCH v4 3/6] ceph: rename _to_client() to _to_fs_client() xiubli
2023-09-04  9:28   ` Milind Changire
2023-06-19  7:14 ` [PATCH v4 4/6] ceph: move mdsmap.h to fs/ceph/ xiubli
2023-09-04  9:29   ` Milind Changire
2023-06-19  7:14 ` [PATCH v4 5/6] ceph: add ceph_inode_to_client() helper support xiubli
2023-09-04  9:30   ` Milind Changire
2023-06-19  7:20 ` [PATCH v4 0/6] ceph: print the client global id for debug logs Xiubo Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230619071438.7000-2-xiubli@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=mchangir@redhat.com \
    --cc=pdonnell@redhat.com \
    --cc=vshankar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).