]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
blktrace: add definitions for blk_user_trace_setup2
authorJohannes Thumshirn <johannes.thumshirn@wdc.com>
Wed, 22 Oct 2025 11:41:06 +0000 (13:41 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 22 Oct 2025 17:14:05 +0000 (11:14 -0600)
Add definitions for a version 2 of the blk_user_trace_setup ioctl. This
new ioctl will enable a different struct layout of the binary data passed
to user-space when using a new version of the blktrace utility requesting
the new struct layout.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
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
include/uapi/linux/fs.h
kernel/trace/blktrace.c

index 1bfb635e309b6c969c87c8090ccb17c7c73372d4..a6958708d4778163061216c6b4744bf5a6d6a26e 100644 (file)
@@ -129,6 +129,7 @@ enum {
 };
 
 #define BLKTRACE_BDEV_SIZE     32
+#define BLKTRACE_BDEV_SIZE2    64
 
 /*
  * User setup structure passed with BLKTRACESETUP
@@ -143,4 +144,19 @@ struct blk_user_trace_setup {
        __u32 pid;
 };
 
+/*
+ * User setup structure passed with BLKTRACESETUP2
+ */
+struct blk_user_trace_setup2 {
+       char name[BLKTRACE_BDEV_SIZE2];         /* output */
+       __u64 act_mask;                         /* input */
+       __u32 buf_size;                         /* input */
+       __u32 buf_nr;                           /* input */
+       __u64 start_lba;
+       __u64 end_lba;
+       __u32 pid;
+       __u32 flags;            /* currently unused */
+       __u64 reserved[11];
+};
+
 #endif /* _UAPIBLKTRACE_H */
index beb4c2d1e41cb1bb3f97ea626eeefb7bfb1b777c..957ce3343a4f68c2b9319c1c12795e72f2bd4753 100644 (file)
@@ -300,6 +300,7 @@ struct file_attr {
 #define BLKGETDISKSEQ _IOR(0x12,128,__u64)
 /* 130-136 are used by zoned block device ioctls (uapi/linux/blkzoned.h) */
 /* 137-141 are used by blk-crypto ioctls (uapi/linux/blk-crypto.h) */
+#define BLKTRACESETUP2 _IOWR(0x12, 142, struct blk_user_trace_setup2)
 
 #define BMAP_IOCTL 1           /* obsolete - kept for compatibility */
 #define FIBMAP    _IO(0x00,1)  /* bmap access */
index df90422ae6139ff7571d54e17c95cecdb00439d0..c31b8f433116f149641e12b312042fb8bc5ed8f4 100644 (file)
@@ -1601,6 +1601,9 @@ static int __init init_blk_tracer(void)
                return 1;
        }
 
+       BUILD_BUG_ON(__alignof__(struct blk_user_trace_setup2) %
+                    __alignof__(long));
+
        return 0;
 }