traceevent/block: Add REQ_ATOMIC flag to block trace events
authorRitesh Harjani (IBM) <ritesh.list@gmail.com>
Thu, 22 May 2025 13:51:10 +0000 (19:21 +0530)
committerJens Axboe <axboe@kernel.dk>
Fri, 23 May 2025 15:18:48 +0000 (09:18 -0600)
Filesystems like XFS can implement atomic write I/O using either
REQ_ATOMIC flag set in the bio or via CoW operation. It will be useful
if we have a flag in trace events to distinguish between the two. This
patch adds char 'U' (Untorn writes) to rwbs field of the trace events
if REQ_ATOMIC flag is set in the bio.

<W/ REQ_ATOMIC>
=================
xfs_io-4238    [009] .....  4148.126843: block_rq_issue: 259,0 WFSU 16384 () 768 + 32 none,0,0 [xfs_io]
<idle>-0       [009] d.h1.  4148.129864: block_rq_complete: 259,0 WFSU () 768 + 32 none,0,0 [0]

<W/O REQ_ATOMIC>
===============
xfs_io-4237    [010] .....  4143.325616: block_rq_issue: 259,0 WS 16384 () 768 + 32 none,0,0 [xfs_io]
<idle>-0       [010] d.H1.  4143.329138: block_rq_complete: 259,0 WS () 768 + 32 none,0,0 [0]

Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Link: https://lore.kernel.org/r/44317cb2ec4588f6a2c1501a96684e6a1196e8ba.1747921498.git.ritesh.list@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/trace/events/block.h
kernel/trace/blktrace.c

index ad36e73b8579f1d7b7f0b83ea6d150c224fb42cd..14a924c0e3037ff5092222fba39decff5cbdaa12 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/tracepoint.h>
 #include <uapi/linux/ioprio.h>
 
-#define RWBS_LEN       8
+#define RWBS_LEN       9
 
 #define IOPRIO_CLASS_STRINGS \
        { IOPRIO_CLASS_NONE,    "none" }, \
index d5f36f415d9d022cd10c422a6cb989db4b8188b7..3f6a7bdc6edf68a8a36c77c974ed9346cb770a60 100644 (file)
@@ -1887,6 +1887,8 @@ void blk_fill_rwbs(char *rwbs, blk_opf_t opf)
                rwbs[i++] = 'S';
        if (opf & REQ_META)
                rwbs[i++] = 'M';
+       if (opf & REQ_ATOMIC)
+               rwbs[i++] = 'U';
 
        rwbs[i] = '\0';
 }