Re: [RFC PATCH 5/5] ceph: Activate BLOG logging
From: Viacheslav Dubeyko
Date: Mon Nov 03 2025 - 16:00:53 EST
On Fri, 2025-10-24 at 08:42 +0000, Alex Markuze wrote:
> Convert all debug logging calls from dout/doutc to bout/boutc throughout
> the Ceph filesystem code, enabling binary logging for improved performance
> and reduced overhead on hot paths.
>
> **Scope of changes:**
> This commit is a mechanical transformation that replaces every instance of
> the traditional text-based logging macros (dout/doutc) with their binary
> logging equivalents (bout/boutc) across the entire Ceph client codebase.
>
> **Modified subsystems:**
> - **Address space operations** (addr.c): Page cache, writeback, readahead
> - **Capability management** (caps.c): MDS capability tracking and revocation
> - **Crypto operations** (crypto.c): Encryption context handling
> - **Directory operations** (dir.c): Lookups, readdir, dcache management
> - **Export operations** (export.c): NFS export support
> - **File operations** (file.c): Open, read, write, mmap, fsync
> - **Inode operations** (inode.c): Inode lifecycle, attribute updates
> - **Ioctl operations** (ioctl.c): Special file operations
> - **POSIX locks** (locks.c): File locking operations
> - **MDS client** (mds_client.c): Metadata server communication and sessions
> - **MDS map** (mdsmap.c): MDS cluster topology tracking
> - **Quota management** (quota.c): Directory quota enforcement
> - **Snapshot operations** (snap.c): Snapshot realm management
> - **Superblock operations** (super.c): Mount, unmount, statfs
> - **Extended attributes** (xattr.c): Getxattr, setxattr, listxattr
>
> **ceph_debug.h modifications:**
> Updated the debug header to define bout/boutc as the primary logging
> interface when CONFIG_BLOG is enabled, with automatic fallback to dout/doutc
> when BLOG is disabled. This ensures the code builds and runs correctly in
> both configurations.
>
> **Performance impact:**
> Binary logging significantly reduces the overhead of debug logging by:
> - Deferring string formatting to userspace deserialization time
> - Using lock-free TLS contexts for log buffer allocation
> - Eliminating sprintf overhead on hot paths
> - Reducing cache pressure from format string processing
>
> Debug logs can now be enabled in production with minimal performance impact,
> providing valuable diagnostic data without the overhead of traditional text
> logging. The binary format also enables more sophisticated analysis tools
> and higher log throughput.
>
> **Compatibility:**
> The logging semantics remain identical - same log levels, same subsystem
> filtering, same conditional logic. Existing log analysis workflows can be
> adapted by deserializing BLOG buffers exported through debugfs (introduced
> in the previous commit).
>
> After this commit, the Ceph filesystem uses BLOG for all debug logging when
> CONFIG_BLOG is enabled. Userspace tools can read binary logs from debugfs
> and deserialize them back to human-readable format using the format strings
> registered in the BLOG source ID registry.
I am slightly lost myself in the code. And, probably, I am missing the point.
But, as far as I can see, the doutc macro has simply being renamed on boutc:
-# define doutc(client, fmt, ...) \
+# define boutc(client, fmt, ...) \
pr_debug(" [%pU %llu] %s: " fmt, &client-
>fsid, \
client->monc.auth->global_id, __func__, ##__VA_ARGS__)
But how does it use the BLOG subsystem?
I am simply trying to understand how the Ceph's debugging subsystem can work
with enabled and disabled CONFIG_BLOB compilation option.
Thanks,
Slava.