Add informational messages during blktrace setup when version 1 tools
are used on kernels with CONFIG_BLK_DEV_ZONED enabled. This alerts users
that REQ_OP_ZONE_* events will be dropped and suggests upgrading to
blktrace tools version 2 or later.
The warning is printed once during trace setup to inform users about
the limitation without spamming the logs during tracing operations.
Version 2 blktrace tools properly handle zone management operations
(zone reset, zone open, zone close, zone finish, zone append) that
were added for zoned block devices.
* With old blktrace tool and this patch :-
blktests (master) # ./check blktrace/
blktrace/001 (blktrace zone management command tracing) [passed]
runtime 3.706s ... 3.735s
blktrace/002 (blktrace ftrace corruption with sysfs trace) [passed]
runtime 0.479s ... 0.456s
blktests (master) # dmesg -c
[ 9455.610899] null_blk: disk nullb0 created
[ 9455.610916] null_blk: module loaded
[ 9455.634103] run blktests blktrace/001 at 2026-02-02 15:02:23
[ 9455.651710] null_blk: nullb1: using native zone append
[ 9455.662852] null_blk: disk nullb1 created
*[ 9455.714998] blktrace: nullb1: blktrace events for zone operations will be
dropped*
*[ 9455.715065] blktrace: use blktrace tools version >= 2 to track zone
operations*
[ 9459.480181] null_blk: disk nullb0 created
[ 9459.480199] null_blk: module loaded
[ 9459.514464] run blktests blktrace/002 at 2026-02-02 15:02:27
[ 9459.541772] null_blk: disk nullb1 created
blktests (master) #
* With new blktrace tools and this patch :-
blktests (master) # ./check blktrace/
blktrace/001 (blktrace zone management command tracing) [passed]
runtime 3.735s ... 3.734s
blktrace/002 (blktrace ftrace corruption with sysfs trace) [passed]
runtime 0.456s ... 0.496s
blktests (master) # dmesg -c
[ 9490.395572] null_blk: disk nullb0 created
[ 9490.395591] null_blk: module loaded
[ 9490.419467] run blktests blktrace/001 at 2026-02-02 15:02:58
[ 9490.436416] null_blk: nullb1: using native zone append
[ 9490.447806] null_blk: disk nullb1 created
[ 9494.262176] null_blk: disk nullb0 created
[ 9494.262195] null_blk: module loaded
[ 9494.296653] run blktests blktrace/002 at 2026-02-02 15:03:02
[ 9494.322261] null_blk: disk nullb1 created
blktests (master) #
This helps users understand why zone operation traces may be missing
when using older blktrace tool versions with modern kernels that
support REQ_OP_ZONE_XXX in blktrace.
Reviewed-by: Damien Le Moal <[email protected]>
Signed-off-by: Chaitanya Kulkarni <[email protected]>
---
V3->V4:-
Replace REQ_OP_ZONE_XXX with "zone operations". (Damien, Jens)
---
kernel/trace/blktrace.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index d031c8d80be4..04b41c698127 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -741,6 +741,12 @@ static void blk_trace_setup_finalize(struct request_queue
*q,
* to underscores for this to work as expected
*/
strreplace(buts->name, '/', '_');
+ if (version == 1 && IS_ENABLED(CONFIG_BLK_DEV_ZONED)) {
+ pr_info("%s: blktrace events for zone operations will be
dropped\n",
+ name);
+ pr_info("use blktrace tools version >= 2 to track zone
operations\n");
+
+ }
bt->version = version;
bt->act_mask = buts->act_mask;
--
2.39.5