From: Alex Markuze <amarkuze@redhat.com>
To: ceph-devel@vger.kernel.org
Cc: idryomov@gmail.com, xiubo.li@clyso.com
Subject: [PATCH v7 08/14] ceph: add boutc wrappers for BLOG
Date: Thu, 24 Sep 2026 15:30:38 +0000 [thread overview]
Message-ID: <20260924153045.994784-9-amarkuze@redhat.com> (raw)
In-Reply-To: <20260924153045.994784-1-amarkuze@redhat.com>
Add boutc()/boutc_bounded()/boutc_formats() macros to ceph_debug.h as
drop-in replacements for doutc(). When BLOG is enabled they serialize
to binary; when disabled they fall back to doutc().
Resolve the optional binary context before choosing the backend.
Expand the doutc fallback only once per call site to avoid duplicate
dynamic-debug metadata and excessive VFS stack frames.
Signed-off-by: Alex Markuze <amarkuze@redhat.com>
Assisted-by: LLM
---
include/linux/ceph/ceph_debug.h | 81 ++++++++++++++++++++++++++++-----
1 file changed, 69 insertions(+), 12 deletions(-)
diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h
index 5f904591fa5f..e055091d5c3c 100644
--- a/include/linux/ceph/ceph_debug.h
+++ b/include/linux/ceph/ceph_debug.h
@@ -5,28 +5,22 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/string.h>
+#include <linux/jump_label.h>
#ifdef CONFIG_CEPH_LIB_PRETTYDEBUG
-/*
- * wrap pr_debug to include a filename:lineno prefix on each line.
- * this incurs some overhead (kernel size and execution time) due to
- * the extra function call at each call site.
- */
-
# if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
# define dout(fmt, ...) \
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 %llu] " fmt, \
+ pr_debug("%.*s %12.12s:%-4d : [%pU %llu] " 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, ...) \
no_printk(KERN_DEBUG fmt, ##__VA_ARGS__)
# define doutc(client, fmt, ...) \
@@ -38,16 +32,79 @@
#else
-/*
- * or, just wrap pr_debug
- */
# define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__)
# define doutc(client, fmt, ...) \
- pr_debug(" [%pU %llu] %s: " fmt, &client->fsid, \
+ pr_debug(" [%pU %llu] %s: " fmt, &client->fsid, \
client->monc.auth->global_id, __func__, ##__VA_ARGS__)
#endif
+/*
+ * boutc* -- binary-logging variants of doutc*.
+ *
+ * When Ceph BLOG tracing has been explicitly enabled and a BLOG context
+ * has been bound for the current task (via ceph_blog_enter()),
+ * these route through the BLOG serialization path. Otherwise they fall
+ * back to the traditional text-based doutc macros so that existing
+ * debug semantics remain unchanged.
+ *
+ * Must only be used from fs/ceph/ where client->private is a
+ * ceph_fs_client *. Do not call from net/ceph or RBD; ->private is not
+ * an fsc there (ceph_blog_key stays false, but the cast is still wrong).
+ */
+#define __ceph_blog_args(...) __VA_ARGS__
+#if IS_ENABLED(CONFIG_CEPH_FS) && IS_ENABLED(CONFIG_DEBUG_FS)
+# include <linux/ceph/ceph_blog.h>
+# define boutc(client, fmt, ...) \
+ do { \
+ struct blog_tls_ctx *__ctx = NULL; \
+ if (static_branch_unlikely(&ceph_blog_key)) \
+ __ctx = ceph_blog_get_cached_ctx( \
+ (struct ceph_fs_client *)(client)->private); \
+ if (__ctx) \
+ CEPH_BLOG_LOG_CLIENT(__ctx, client, fmt, ##__VA_ARGS__); \
+ else \
+ doutc(client, fmt, ##__VA_ARGS__); \
+ } while (0)
+# define boutc_bounded(client, fmt, blog_args, text_args) \
+ do { \
+ struct blog_tls_ctx *__ctx = NULL; \
+ if (static_branch_unlikely(&ceph_blog_key)) \
+ __ctx = ceph_blog_get_cached_ctx( \
+ (struct ceph_fs_client *)(client)->private); \
+ if (__ctx) \
+ CEPH_BLOG_LOG_CLIENT(__ctx, client, fmt, \
+ __ceph_blog_args blog_args); \
+ else \
+ doutc(client, fmt, __ceph_blog_args text_args); \
+ } while (0)
+# define boutc_formats(client, blog_fmt, text_fmt, blog_args, text_args) \
+ do { \
+ struct blog_tls_ctx *__ctx = NULL; \
+ if (static_branch_unlikely(&ceph_blog_key)) \
+ __ctx = ceph_blog_get_cached_ctx( \
+ (struct ceph_fs_client *)(client)->private); \
+ if (__ctx) \
+ CEPH_BLOG_LOG_CLIENT(__ctx, client, blog_fmt, \
+ __ceph_blog_args blog_args); \
+ else \
+ doutc(client, text_fmt, __ceph_blog_args text_args); \
+ } while (0)
+#else
+# define boutc(client, fmt, ...) doutc(client, fmt, ##__VA_ARGS__)
+# define boutc_bounded(client, fmt, blog_args, text_args) \
+ do { \
+ (void)sizeof(#blog_args); \
+ doutc(client, fmt, __ceph_blog_args text_args); \
+ } while (0)
+# define boutc_formats(client, blog_fmt, text_fmt, blog_args, text_args) \
+ do { \
+ (void)sizeof(blog_fmt); \
+ (void)sizeof(#blog_args); \
+ doutc(client, text_fmt, __ceph_blog_args text_args); \
+ } while (0)
+#endif
+
#define pr_notice_client(client, fmt, ...) \
pr_notice("[%pU %llu]: " fmt, &client->fsid, \
client->monc.auth->global_id, ##__VA_ARGS__)
--
2.34.1
next prev parent reply other threads:[~2026-09-24 15:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 15:30 [PATCH v7 00/14] ceph: add binary logging (BLOG) for CephFS Alex Markuze
2026-09-24 15:30 ` [PATCH v7 01/14] ceph: add BLOG private headers Alex Markuze
2026-09-24 15:30 ` [PATCH v7 02/14] ceph: add BLOG deserialization support Alex Markuze
2026-09-24 15:30 ` [PATCH v7 03/14] ceph: add BLOG page-fragment allocator Alex Markuze
2026-09-24 15:30 ` [PATCH v7 04/14] ceph: add BLOG magazine batch allocator Alex Markuze
2026-09-24 15:30 ` [PATCH v7 05/14] ceph: add BLOG logger core Alex Markuze
2026-09-24 15:30 ` [PATCH v7 06/14] ceph: add BLOG per-module context management Alex Markuze
2026-09-24 15:30 ` [PATCH v7 07/14] ceph: add Ceph BLOG scaffolding Alex Markuze
2026-09-24 15:30 ` Alex Markuze [this message]
2026-09-24 15:30 ` [PATCH v7 09/14] ceph: switch MDS request plumbing to struct ceph_journal_info Alex Markuze
2026-09-24 15:30 ` [PATCH v7 10/14] ceph: add BLOG debugfs interface Alex Markuze
2026-09-24 15:30 ` [PATCH v7 11/14] ceph: convert VFS inode and directory paths to BLOG logging Alex Markuze
2026-09-24 15:30 ` [PATCH v7 12/14] ceph: convert VFS data I/O " Alex Markuze
2026-09-24 15:30 ` [PATCH v7 13/14] ceph: convert capability and snapshot " Alex Markuze
2026-09-24 15:30 ` [PATCH v7 14/14] ceph: convert remaining helper " Alex Markuze
2026-10-01 13:25 ` [PATCH v7 00/14] ceph: add binary logging (BLOG) for CephFS 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=20260924153045.994784-9-amarkuze@redhat.com \
--to=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=xiubo.li@clyso.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.