]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
blktrace: add definitions for struct blk_io_trace2
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Wed, 22 Oct 2025 11:41:08 +0000 (13:41 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 22 Oct 2025 17:14:05 +0000 (11:14 -0600)
Add definitions for the extended version of the blktrace protocol using a
wider action type to be able to record new actions in the kernel.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/uapi/linux/blktrace_api.h
kernel/trace/blktrace.c

index a6958708d4778163061216c6b4744bf5a6d6a26e..9f9834d76e009bf37ae91421cd28eef88aab9e54 100644 (file)
@@ -94,6 +94,7 @@ enum blktrace_notify {
 
 #define BLK_IO_TRACE_MAGIC     0x65617400
 #define BLK_IO_TRACE_VERSION   0x07
+#define BLK_IO_TRACE2_VERSION  0x08
 
 /*
  * The trace itself
@@ -113,6 +114,21 @@ struct blk_io_trace {
        /* cgroup id will be stored here if exists */
 };
 
+struct blk_io_trace2 {
+       __u32 magic;            /* MAGIC << 8 | BLK_IO_TRACE2_VERSION */
+       __u32 sequence;         /* event number */
+       __u64 time;             /* in nanoseconds */
+       __u64 sector;           /* disk offset */
+       __u32 bytes;            /* transfer length */
+       __u32 pid;              /* who did it */
+       __u64 action;           /* what happened */
+       __u32 device;           /* device number */
+       __u32 cpu;              /* on what cpu did it happen */
+       __u16 error;            /* completion error */
+       __u16 pdu_len;          /* length of data after this trace */
+       __u8 pad[12];
+       /* cgroup id will be stored here if it exists */
+};
 /*
  * The remap event
  */
index d1532df84cc8190a5599a965da980d2160c5f505..185f19c9f772d36989a91064a49a250d4eef5c73 100644 (file)
@@ -1616,6 +1616,7 @@ static int __init init_blk_tracer(void)
 
        BUILD_BUG_ON(__alignof__(struct blk_user_trace_setup2) %
                     __alignof__(long));
+       BUILD_BUG_ON(__alignof__(struct blk_io_trace2) % __alignof__(long));
 
        return 0;
 }