linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] block: add tracepoints for ZBD specific operations
@ 2025-07-14 14:38 Johannes Thumshirn
  2025-07-14 14:38 ` [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs Johannes Thumshirn
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2025-07-14 14:38 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig, Bart Van Assche,
	Johannes Thumshirn

These tracepoints are also the foundation for adding zoned block device
support to blktrace, which will be sent in a follow up.

But even without the immediate support for ZBD operations in blktrace, these
tracepoints have prooven to be effective in debugging issues with filesystems
on zoned block devices.

Changes to v1:
- WARN_ON() overflow of rwbs[] array (Bart)
- Use 'ZRA' for REQ_OP_ZONE_RESET_ALL (Damien)
- Use bio_sector() (Damien)

Link to v1:
https://lore.kernel.org/linux-block/20250709114704.70831-1-johannes.thumshirn@wdc.com

Johannes Thumshirn (5):
  blktrace: add zoned block commands to blk_fill_rwbs
  block: split blk_zone_update_request_bio into two functions
  block: add tracepoint for blk_zone_update_request_bio
  block: add tracepoint for blkdev_zone_mgmt
  block: add trace messages to zone write plugging

 block/blk-mq.c               |  6 ++-
 block/blk-zoned.c            | 23 +++++++++
 block/blk.h                  | 31 ++++++------
 include/trace/events/block.h | 91 +++++++++++++++++++++++++++++++++++-
 kernel/trace/blktrace.c      | 25 ++++++++++
 5 files changed, 156 insertions(+), 20 deletions(-)

-- 
2.50.0


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs
  2025-07-14 14:38 [PATCH v2 0/5] block: add tracepoints for ZBD specific operations Johannes Thumshirn
@ 2025-07-14 14:38 ` Johannes Thumshirn
  2025-07-14 16:32   ` Bart Van Assche
                     ` (2 more replies)
  2025-07-14 14:38 ` [PATCH v2 2/5] block: split blk_zone_update_request_bio into two functions Johannes Thumshirn
                   ` (3 subsequent siblings)
  4 siblings, 3 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2025-07-14 14:38 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig, Bart Van Assche,
	Johannes Thumshirn

Add zoned block commands to blk_fill_rwbs:

- ZONE APPEND will be decoded as 'ZA'
- ZONE RESET and ZONE RESET ALL will be decoded as 'ZR'
- ZONE FINISH will be decoded as 'ZF'
- ZONE OPEN will be decoded as 'ZO'
- ZONE CLOSE will be decoded as 'ZC'

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 include/trace/events/block.h |  2 +-
 kernel/trace/blktrace.c      | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 14a924c0e303..d88669b3ce02 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -11,7 +11,7 @@
 #include <linux/tracepoint.h>
 #include <uapi/linux/ioprio.h>
 
-#define RWBS_LEN	9
+#define RWBS_LEN	10
 
 #define IOPRIO_CLASS_STRINGS \
 	{ IOPRIO_CLASS_NONE,	"none" }, \
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 3f6a7bdc6edf..e0fdefe374b4 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1875,6 +1875,29 @@ void blk_fill_rwbs(char *rwbs, blk_opf_t opf)
 	case REQ_OP_READ:
 		rwbs[i++] = 'R';
 		break;
+	case REQ_OP_ZONE_APPEND:
+		rwbs[i++] = 'Z';
+		rwbs[i++] = 'A';
+		break;
+	case REQ_OP_ZONE_RESET:
+	case REQ_OP_ZONE_RESET_ALL:
+		rwbs[i++] = 'Z';
+		rwbs[i++] = 'R';
+		if ((opf & REQ_OP_MASK) == REQ_OP_ZONE_RESET_ALL)
+			 rwbs[i++] = 'A';
+		break;
+	case REQ_OP_ZONE_FINISH:
+		rwbs[i++] = 'Z';
+		rwbs[i++] = 'F';
+		break;
+	case REQ_OP_ZONE_OPEN:
+		rwbs[i++] = 'Z';
+		rwbs[i++] = 'O';
+		break;
+	case REQ_OP_ZONE_CLOSE:
+		rwbs[i++] = 'Z';
+		rwbs[i++] = 'C';
+		break;
 	default:
 		rwbs[i++] = 'N';
 	}
@@ -1890,6 +1913,8 @@ void blk_fill_rwbs(char *rwbs, blk_opf_t opf)
 	if (opf & REQ_ATOMIC)
 		rwbs[i++] = 'U';
 
+	WARN_ON_ONCE(i >= RWBS_LEN);
+
 	rwbs[i] = '\0';
 }
 EXPORT_SYMBOL_GPL(blk_fill_rwbs);
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 2/5] block: split blk_zone_update_request_bio into two functions
  2025-07-14 14:38 [PATCH v2 0/5] block: add tracepoints for ZBD specific operations Johannes Thumshirn
  2025-07-14 14:38 ` [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs Johannes Thumshirn
@ 2025-07-14 14:38 ` Johannes Thumshirn
  2025-07-14 16:34   ` Bart Van Assche
                     ` (2 more replies)
  2025-07-14 14:38 ` [PATCH v2 3/5] block: add tracepoint for blk_zone_update_request_bio Johannes Thumshirn
                   ` (2 subsequent siblings)
  4 siblings, 3 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2025-07-14 14:38 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig, Bart Van Assche,
	Johannes Thumshirn

blk_zone_update_request_bio() does two things. First it checks if the
request to be completed was written via ZONE APPEND and if yes it then
updates the sector to the one that the data was written to.

This is small enough to be an inline function. But upcoming changes adding
a tracepoint don't work if the function is inlined.

Split the function into two, the first is blk_req_bio_is_zone_append()
checking if the sector needs to be updated. This can still be an inline
function. The second is blk_zone_append_update_request_bio() doing the
sector update.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 block/blk-mq.c    |  6 ++++--
 block/blk-zoned.c | 13 +++++++++++++
 block/blk.h       | 31 ++++++++++++++-----------------
 3 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4806b867e37d..755ea0335831 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -883,7 +883,8 @@ static void blk_complete_request(struct request *req)
 		/* Completion has already been traced */
 		bio_clear_flag(bio, BIO_TRACE_COMPLETION);
 
-		blk_zone_update_request_bio(req, bio);
+		if (blk_req_bio_is_zone_append(req, bio))
+			blk_zone_append_update_request_bio(req, bio);
 
 		if (!is_flush)
 			bio_endio(bio);
@@ -982,7 +983,8 @@ bool blk_update_request(struct request *req, blk_status_t error,
 
 		/* Don't actually finish bio if it's part of flush sequence */
 		if (!bio->bi_iter.bi_size) {
-			blk_zone_update_request_bio(req, bio);
+			if (blk_req_bio_is_zone_append(req, bio))
+				blk_zone_append_update_request_bio(req, bio);
 			if (!is_flush)
 				bio_endio(bio);
 		}
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 351d659280e1..e79e0357d1f1 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -1205,6 +1205,19 @@ static void disk_zone_wplug_unplug_bio(struct gendisk *disk,
 	spin_unlock_irqrestore(&zwplug->lock, flags);
 }
 
+void blk_zone_append_update_request_bio(struct request *rq, struct bio *bio)
+{
+	/*
+	 * For zone append requests, the request sector indicates the location
+	 * at which the BIO data was written. Return this value to the BIO
+	 * issuer through the BIO iter sector.
+	 * For plugged zone writes, which include emulated zone append, we need
+	 * the original BIO sector so that blk_zone_write_plug_bio_endio() can
+	 * lookup the zone write plug.
+	 */
+	bio->bi_iter.bi_sector = rq->__sector;
+}
+
 void blk_zone_write_plug_bio_endio(struct bio *bio)
 {
 	struct gendisk *disk = bio->bi_bdev->bd_disk;
diff --git a/block/blk.h b/block/blk.h
index 37ec459fe656..b4c01774df98 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -467,23 +467,15 @@ static inline bool bio_zone_write_plugging(struct bio *bio)
 {
 	return bio_flagged(bio, BIO_ZONE_WRITE_PLUGGING);
 }
-void blk_zone_write_plug_bio_merged(struct bio *bio);
-void blk_zone_write_plug_init_request(struct request *rq);
-static inline void blk_zone_update_request_bio(struct request *rq,
-					       struct bio *bio)
+static inline bool blk_req_bio_is_zone_append(struct request *rq,
+					      struct bio *bio)
 {
-	/*
-	 * For zone append requests, the request sector indicates the location
-	 * at which the BIO data was written. Return this value to the BIO
-	 * issuer through the BIO iter sector.
-	 * For plugged zone writes, which include emulated zone append, we need
-	 * the original BIO sector so that blk_zone_write_plug_bio_endio() can
-	 * lookup the zone write plug.
-	 */
-	if (req_op(rq) == REQ_OP_ZONE_APPEND ||
-	    bio_flagged(bio, BIO_EMULATES_ZONE_APPEND))
-		bio->bi_iter.bi_sector = rq->__sector;
+	return req_op(rq) == REQ_OP_ZONE_APPEND ||
+	       bio_flagged(bio, BIO_EMULATES_ZONE_APPEND);
 }
+void blk_zone_write_plug_bio_merged(struct bio *bio);
+void blk_zone_write_plug_init_request(struct request *rq);
+void blk_zone_append_update_request_bio(struct request *rq, struct bio *bio);
 void blk_zone_write_plug_bio_endio(struct bio *bio);
 static inline void blk_zone_bio_endio(struct bio *bio)
 {
@@ -516,14 +508,19 @@ static inline bool bio_zone_write_plugging(struct bio *bio)
 {
 	return false;
 }
+static inline bool blk_req_bio_is_zone_append(struct request *req,
+					      struct bio *bio)
+{
+	return false;
+}
 static inline void blk_zone_write_plug_bio_merged(struct bio *bio)
 {
 }
 static inline void blk_zone_write_plug_init_request(struct request *rq)
 {
 }
-static inline void blk_zone_update_request_bio(struct request *rq,
-					       struct bio *bio)
+static inline void blk_zone_append_update_request_bio(struct request *rq,
+						      struct bio *bio)
 {
 }
 static inline void blk_zone_bio_endio(struct bio *bio)
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 3/5] block: add tracepoint for blk_zone_update_request_bio
  2025-07-14 14:38 [PATCH v2 0/5] block: add tracepoints for ZBD specific operations Johannes Thumshirn
  2025-07-14 14:38 ` [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs Johannes Thumshirn
  2025-07-14 14:38 ` [PATCH v2 2/5] block: split blk_zone_update_request_bio into two functions Johannes Thumshirn
@ 2025-07-14 14:38 ` Johannes Thumshirn
  2025-07-14 16:35   ` Bart Van Assche
                     ` (2 more replies)
  2025-07-14 14:38 ` [PATCH v2 4/5] block: add tracepoint for blkdev_zone_mgmt Johannes Thumshirn
  2025-07-14 14:38 ` [PATCH v2 5/5] block: add trace messages to zone write plugging Johannes Thumshirn
  4 siblings, 3 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2025-07-14 14:38 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig, Bart Van Assche,
	Johannes Thumshirn

Add a tracepoint in blk_zone_update_request_bio() to trace the bio sector
update on ZONE APPEND completions.

An example for this tracepoint is as follows:

<idle>-0 [001] d.h1.  381.746444: blk_zone_update_request_bio: 259,5 ZAS 131072 () 1048832 + 256 none,0,0 [swapper/1]

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 block/blk-zoned.c            |  3 +++
 include/trace/events/block.h | 11 +++++++++++
 2 files changed, 14 insertions(+)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index e79e0357d1f1..2584ffb6b022 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -17,6 +17,8 @@
 #include <linux/refcount.h>
 #include <linux/mempool.h>
 
+#include <trace/events/block.h>
+
 #include "blk.h"
 #include "blk-mq-sched.h"
 #include "blk-mq-debugfs.h"
@@ -1216,6 +1218,7 @@ void blk_zone_append_update_request_bio(struct request *rq, struct bio *bio)
 	 * lookup the zone write plug.
 	 */
 	bio->bi_iter.bi_sector = rq->__sector;
+	trace_blk_zone_append_update_request_bio(rq);
 }
 
 void blk_zone_write_plug_bio_endio(struct bio *bio)
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index d88669b3ce02..4855abdf9880 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -404,6 +404,17 @@ DEFINE_EVENT(block_bio, block_getrq,
 	TP_ARGS(bio)
 );
 
+/**
+ * block_zone_update_request_bio - update the bio sector after a zone append
+ * @bio: the completed block IO operation
+ *
+ * Update the bio's bi_sector after a zone append command has been completed.
+ */
+DEFINE_EVENT(block_rq, blk_zone_append_update_request_bio,
+	     TP_PROTO(struct request *rq),
+	     TP_ARGS(rq)
+);
+
 /**
  * block_plug - keep operations requests in request queue
  * @q: request queue to plug
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 4/5] block: add tracepoint for blkdev_zone_mgmt
  2025-07-14 14:38 [PATCH v2 0/5] block: add tracepoints for ZBD specific operations Johannes Thumshirn
                   ` (2 preceding siblings ...)
  2025-07-14 14:38 ` [PATCH v2 3/5] block: add tracepoint for blk_zone_update_request_bio Johannes Thumshirn
@ 2025-07-14 14:38 ` Johannes Thumshirn
  2025-07-14 16:35   ` Bart Van Assche
                     ` (2 more replies)
  2025-07-14 14:38 ` [PATCH v2 5/5] block: add trace messages to zone write plugging Johannes Thumshirn
  4 siblings, 3 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2025-07-14 14:38 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig, Bart Van Assche,
	Johannes Thumshirn

Add a tracepoint for blkdev_zone_mgmt to trace zone management commands
submitted by higher layers like file systems or user space.

An example output for this tracepoint is as follows:

  mkfs.btrfs-203  [001] .....  42.877493: blkdev_zone_mgmt: 8,0 ZRS 5242880 + 0

This example output shows a REQ_OP_ZONE_RESET operation submitted by
mkfs.btrfs.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 block/blk-zoned.c            |  2 ++
 include/trace/events/block.h | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 2584ffb6b022..48f75f58d05e 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -179,6 +179,7 @@ static int blkdev_zone_reset_all(struct block_device *bdev)
 	struct bio bio;
 
 	bio_init(&bio, bdev, NULL, 0, REQ_OP_ZONE_RESET_ALL | REQ_SYNC);
+	trace_blkdev_zone_mgmt(&bio, 0);
 	return submit_bio_wait(&bio);
 }
 
@@ -242,6 +243,7 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_op op,
 		cond_resched();
 	}
 
+	trace_blkdev_zone_mgmt(bio, nr_sectors);
 	ret = submit_bio_wait(bio);
 	bio_put(bio);
 
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 4855abdf9880..ff7698efdfde 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -599,6 +599,40 @@ TRACE_EVENT(block_rq_remap,
 		  (unsigned long long)__entry->old_sector, __entry->nr_bios)
 );
 
+/**
+ * blkdev_zone_mgmt - Execute a zone management operation on a range of zones
+ * @bio: The block IO operation sent down to the device
+ * @nr_sectors: The number of sectors affected by this operation
+ *
+ * Execute a zone management operation on a specified range of zones. This
+ * range is encoded in %nr_sectors, which has to be a multiple of the zone
+ * size.
+ */
+TRACE_EVENT(blkdev_zone_mgmt,
+
+	TP_PROTO(struct bio *bio, sector_t nr_sectors),
+
+	TP_ARGS(bio, nr_sectors),
+
+	TP_STRUCT__entry(
+	    __field(  dev_t,	dev		)
+	    __field(  sector_t,	sector		)
+	    __field(  sector_t, nr_sectors	)
+	    __array(  char,	rwbs,	RWBS_LEN)
+	),
+
+	TP_fast_assign(
+	    __entry->dev	= bio_dev(bio);
+	    __entry->sector	= bio->bi_iter.bi_sector;
+	    __entry->nr_sectors	= bio_sectors(bio);
+	    blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
+        ),
+
+	TP_printk("%d,%d %s %llu + %llu",
+		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
+		  (unsigned long long)__entry->sector,
+		  __entry->nr_sectors)
+);
 #endif /* _TRACE_BLOCK_H */
 
 /* This part must be outside protection */
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH v2 5/5] block: add trace messages to zone write plugging
  2025-07-14 14:38 [PATCH v2 0/5] block: add tracepoints for ZBD specific operations Johannes Thumshirn
                   ` (3 preceding siblings ...)
  2025-07-14 14:38 ` [PATCH v2 4/5] block: add tracepoint for blkdev_zone_mgmt Johannes Thumshirn
@ 2025-07-14 14:38 ` Johannes Thumshirn
  2025-07-14 16:43   ` Bart Van Assche
                     ` (2 more replies)
  4 siblings, 3 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2025-07-14 14:38 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig, Bart Van Assche,
	Johannes Thumshirn

Add tracepoints to zone write plugging plug and unplug events.

  kworker/u9:3-162  [000] d..1. 2231.939277: disk_zone_wplug_add_bio: 8,0 zone 12, BIO 6291456 + 14
  kworker/0:1H-59   [000] d..1. 2231.939884: blk_zone_wplug_bio: 8,0 zone 24, BIO 12775168 + 4

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 block/blk-zoned.c            |  5 ++++
 include/trace/events/block.h | 44 ++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 48f75f58d05e..1e2e957c4fb2 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -822,6 +822,8 @@ static inline void disk_zone_wplug_add_bio(struct gendisk *disk,
 	 * at the tail of the list to preserve the sequential write order.
 	 */
 	bio_list_add(&zwplug->bio_list, bio);
+	trace_disk_zone_wplug_add_bio(zwplug->disk->queue, zwplug->zone_no,
+				      bio->bi_iter.bi_sector, nr_segs);
 
 	zwplug->flags |= BLK_ZONE_WPLUG_PLUGGED;
 
@@ -1317,6 +1319,9 @@ static void blk_zone_wplug_bio_work(struct work_struct *work)
 		goto put_zwplug;
 	}
 
+	trace_blk_zone_wplug_bio(zwplug->disk->queue, zwplug->zone_no,
+				 bio->bi_iter.bi_sector, bio_sectors(bio));
+
 	if (!blk_zone_wplug_prepare_bio(zwplug, bio)) {
 		blk_zone_wplug_bio_io_error(zwplug, bio);
 		goto again;
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index ff7698efdfde..eeaea02f5535 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -633,6 +633,50 @@ TRACE_EVENT(blkdev_zone_mgmt,
 		  (unsigned long long)__entry->sector,
 		  __entry->nr_sectors)
 );
+
+DECLARE_EVENT_CLASS(block_zwplug,
+
+	TP_PROTO(struct request_queue *q, unsigned int zno, sector_t sector,
+		 unsigned int nr_segs),
+
+	TP_ARGS(q, zno, sector, nr_segs),
+
+	TP_STRUCT__entry(
+		__field( dev_t,		dev		)
+		__field( unsigned int,	zno		)
+		__field( sector_t,	sector		)
+		__field( unsigned int,	nr_segs		)
+	),
+
+	TP_fast_assign(
+		__entry->dev		= disk_devt(q->disk);
+		__entry->zno		= zno;
+		__entry->sector		= sector;
+		__entry->nr_segs	= nr_segs;
+	),
+
+	TP_printk("%d,%d zone %u, BIO %llu + %u",
+		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->zno,
+		  (unsigned long long)__entry->sector,
+		  __entry->nr_segs)
+);
+
+DEFINE_EVENT(block_zwplug, disk_zone_wplug_add_bio,
+
+	TP_PROTO(struct request_queue *q, unsigned int zno, sector_t sector,
+		 unsigned int nr_segs),
+
+	TP_ARGS(q, zno, sector, nr_segs)
+);
+
+DEFINE_EVENT(block_zwplug, blk_zone_wplug_bio,
+
+	TP_PROTO(struct request_queue *q, unsigned int zno, sector_t sector,
+		 unsigned int nr_segs),
+
+	TP_ARGS(q, zno, sector, nr_segs)
+);
+
 #endif /* _TRACE_BLOCK_H */
 
 /* This part must be outside protection */
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs
  2025-07-14 14:38 ` [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs Johannes Thumshirn
@ 2025-07-14 16:32   ` Bart Van Assche
  2025-07-14 21:32   ` Bart Van Assche
  2025-07-14 22:34   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 22+ messages in thread
From: Bart Van Assche @ 2025-07-14 16:32 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig

On 7/14/25 7:38 AM, Johannes Thumshirn wrote:
> - ZONE RESET and ZONE RESET ALL will be decoded as 'ZR'

This line from the description is no longer in sync with the code below:

> +	case REQ_OP_ZONE_RESET:
> +	case REQ_OP_ZONE_RESET_ALL:
> +		rwbs[i++] = 'Z';
> +		rwbs[i++] = 'R';
> +		if ((opf & REQ_OP_MASK) == REQ_OP_ZONE_RESET_ALL)
> +			 rwbs[i++] = 'A';
> +		break;

Otherwise this patch looks good to me.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 2/5] block: split blk_zone_update_request_bio into two functions
  2025-07-14 14:38 ` [PATCH v2 2/5] block: split blk_zone_update_request_bio into two functions Johannes Thumshirn
@ 2025-07-14 16:34   ` Bart Van Assche
  2025-07-14 22:36   ` Chaitanya Kulkarni
  2025-07-15  5:33   ` Christoph Hellwig
  2 siblings, 0 replies; 22+ messages in thread
From: Bart Van Assche @ 2025-07-14 16:34 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig

On 7/14/25 7:38 AM, Johannes Thumshirn wrote:
> blk_zone_update_request_bio() does two things. First it checks if the
> request to be completed was written via ZONE APPEND and if yes it then
> updates the sector to the one that the data was written to.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 3/5] block: add tracepoint for blk_zone_update_request_bio
  2025-07-14 14:38 ` [PATCH v2 3/5] block: add tracepoint for blk_zone_update_request_bio Johannes Thumshirn
@ 2025-07-14 16:35   ` Bart Van Assche
  2025-07-14 22:36   ` Chaitanya Kulkarni
  2025-07-15  5:33   ` Christoph Hellwig
  2 siblings, 0 replies; 22+ messages in thread
From: Bart Van Assche @ 2025-07-14 16:35 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig

On 7/14/25 7:38 AM, Johannes Thumshirn wrote:
> Add a tracepoint in blk_zone_update_request_bio() to trace the bio sector
> update on ZONE APPEND completions.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 4/5] block: add tracepoint for blkdev_zone_mgmt
  2025-07-14 14:38 ` [PATCH v2 4/5] block: add tracepoint for blkdev_zone_mgmt Johannes Thumshirn
@ 2025-07-14 16:35   ` Bart Van Assche
  2025-07-14 22:37   ` Chaitanya Kulkarni
  2025-07-15  5:33   ` Christoph Hellwig
  2 siblings, 0 replies; 22+ messages in thread
From: Bart Van Assche @ 2025-07-14 16:35 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig

On 7/14/25 7:38 AM, Johannes Thumshirn wrote:
> Add a tracepoint for blkdev_zone_mgmt to trace zone management commands
> submitted by higher layers like file systems or user space.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 5/5] block: add trace messages to zone write plugging
  2025-07-14 14:38 ` [PATCH v2 5/5] block: add trace messages to zone write plugging Johannes Thumshirn
@ 2025-07-14 16:43   ` Bart Van Assche
  2025-07-15  5:39     ` Johannes Thumshirn
  2025-07-14 17:48   ` Bart Van Assche
  2025-07-14 22:38   ` Chaitanya Kulkarni
  2 siblings, 1 reply; 22+ messages in thread
From: Bart Van Assche @ 2025-07-14 16:43 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig

On 7/14/25 7:38 AM, Johannes Thumshirn wrote:
> +	TP_printk("%d,%d zone %u, BIO %llu + %u",
> +		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->zno,
> +		  (unsigned long long)__entry->sector,
> +		  __entry->nr_segs)

Fifteen years ago it was essential in kernel code to cast u64 values
when formatting these with %llu but that's no longer necessary today. I
think that the "unsigned long long" cast can be left out since nowadays
u64 is a synonym for unsigned long long in the Linux kernel. Otherwise
this patch looks good to me.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 5/5] block: add trace messages to zone write plugging
  2025-07-14 14:38 ` [PATCH v2 5/5] block: add trace messages to zone write plugging Johannes Thumshirn
  2025-07-14 16:43   ` Bart Van Assche
@ 2025-07-14 17:48   ` Bart Van Assche
  2025-07-14 22:38   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 22+ messages in thread
From: Bart Van Assche @ 2025-07-14 17:48 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig

On 7/14/25 7:38 AM, Johannes Thumshirn wrote:
> +	TP_printk("%d,%d zone %u, BIO %llu + %u",
> +		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->zno,
> +		  (unsigned long long)__entry->sector,
> +		  __entry->nr_segs)

This output format is confusing. All other block layer tracing code
uses the notation <sector> + ... to indicate a starting sector and a
length in sectors. Is the segment information relevant enough to
include it in the tracing output? If so, please use another way to
report the number of segments, e.g. "BIO %llu, nr_segs %u".

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs
  2025-07-14 14:38 ` [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs Johannes Thumshirn
  2025-07-14 16:32   ` Bart Van Assche
@ 2025-07-14 21:32   ` Bart Van Assche
  2025-07-14 22:34   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 22+ messages in thread
From: Bart Van Assche @ 2025-07-14 21:32 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block, Damien Le Moal, Christoph Hellwig

On 7/14/25 7:38 AM, Johannes Thumshirn wrote:
> +		if ((opf & REQ_OP_MASK) == REQ_OP_ZONE_RESET_ALL)
> +			 rwbs[i++] = 'A';

                         ^

There is an issue with the indentation of the assignment: the space
in front of the assignment statement should be removed.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs
  2025-07-14 14:38 ` [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs Johannes Thumshirn
  2025-07-14 16:32   ` Bart Van Assche
  2025-07-14 21:32   ` Bart Van Assche
@ 2025-07-14 22:34   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 22+ messages in thread
From: Chaitanya Kulkarni @ 2025-07-14 22:34 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block@vger.kernel.org, Damien Le Moal, Christoph Hellwig,
	Bart Van Assche

On 7/14/25 07:38, Johannes Thumshirn wrote:
> Add zoned block commands to blk_fill_rwbs:
>
> - ZONE APPEND will be decoded as 'ZA'
> - ZONE RESET and ZONE RESET ALL will be decoded as 'ZR'
> - ZONE FINISH will be decoded as 'ZF'
> - ZONE OPEN will be decoded as 'ZO'
> - ZONE CLOSE will be decoded as 'ZC'
>
> Signed-off-by: Johannes Thumshirn<johannes.thumshirn@wdc.com>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 2/5] block: split blk_zone_update_request_bio into two functions
  2025-07-14 14:38 ` [PATCH v2 2/5] block: split blk_zone_update_request_bio into two functions Johannes Thumshirn
  2025-07-14 16:34   ` Bart Van Assche
@ 2025-07-14 22:36   ` Chaitanya Kulkarni
  2025-07-15  5:33   ` Christoph Hellwig
  2 siblings, 0 replies; 22+ messages in thread
From: Chaitanya Kulkarni @ 2025-07-14 22:36 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block@vger.kernel.org, Damien Le Moal, Christoph Hellwig,
	Bart Van Assche

On 7/14/25 07:38, Johannes Thumshirn wrote:
> blk_zone_update_request_bio() does two things. First it checks if the
> request to be completed was written via ZONE APPEND and if yes it then
> updates the sector to the one that the data was written to.
>
> This is small enough to be an inline function. But upcoming changes adding
> a tracepoint don't work if the function is inlined.
>
> Split the function into two, the first is blk_req_bio_is_zone_append()
> checking if the sector needs to be updated. This can still be an inline
> function. The second is blk_zone_append_update_request_bio() doing the
> sector update.
>
> Reviewed-by: Damien Le Moal<dlemoal@kernel.org>
> Signed-off-by: Johannes Thumshirn<johannes.thumshirn@wdc.com>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 3/5] block: add tracepoint for blk_zone_update_request_bio
  2025-07-14 14:38 ` [PATCH v2 3/5] block: add tracepoint for blk_zone_update_request_bio Johannes Thumshirn
  2025-07-14 16:35   ` Bart Van Assche
@ 2025-07-14 22:36   ` Chaitanya Kulkarni
  2025-07-15  5:33   ` Christoph Hellwig
  2 siblings, 0 replies; 22+ messages in thread
From: Chaitanya Kulkarni @ 2025-07-14 22:36 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block@vger.kernel.org, Damien Le Moal, Christoph Hellwig,
	Bart Van Assche

On 7/14/25 07:38, Johannes Thumshirn wrote:
> Add a tracepoint in blk_zone_update_request_bio() to trace the bio sector
> update on ZONE APPEND completions.
>
> An example for this tracepoint is as follows:
>
> <idle>-0 [001] d.h1.  381.746444: blk_zone_update_request_bio: 259,5 ZAS 131072 () 1048832 + 256 none,0,0 [swapper/1]
>
> Reviewed-by: Damien Le Moal<dlemoal@kernel.org>
> Signed-off-by: Johannes Thumshirn<johannes.thumshirn@wdc.com>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 4/5] block: add tracepoint for blkdev_zone_mgmt
  2025-07-14 14:38 ` [PATCH v2 4/5] block: add tracepoint for blkdev_zone_mgmt Johannes Thumshirn
  2025-07-14 16:35   ` Bart Van Assche
@ 2025-07-14 22:37   ` Chaitanya Kulkarni
  2025-07-15  5:33   ` Christoph Hellwig
  2 siblings, 0 replies; 22+ messages in thread
From: Chaitanya Kulkarni @ 2025-07-14 22:37 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block@vger.kernel.org, Damien Le Moal, Christoph Hellwig,
	Bart Van Assche

On 7/14/25 07:38, Johannes Thumshirn wrote:
> Add a tracepoint for blkdev_zone_mgmt to trace zone management commands
> submitted by higher layers like file systems or user space.
>
> An example output for this tracepoint is as follows:
>
>    mkfs.btrfs-203  [001] .....  42.877493: blkdev_zone_mgmt: 8,0 ZRS 5242880 + 0
>
> This example output shows a REQ_OP_ZONE_RESET operation submitted by
> mkfs.btrfs.
>
> Reviewed-by: Damien Le Moal<dlemoal@kernel.org>
> Signed-off-by: Johannes Thumshirn<johannes.thumshirn@wdc.com>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 5/5] block: add trace messages to zone write plugging
  2025-07-14 14:38 ` [PATCH v2 5/5] block: add trace messages to zone write plugging Johannes Thumshirn
  2025-07-14 16:43   ` Bart Van Assche
  2025-07-14 17:48   ` Bart Van Assche
@ 2025-07-14 22:38   ` Chaitanya Kulkarni
  2 siblings, 0 replies; 22+ messages in thread
From: Chaitanya Kulkarni @ 2025-07-14 22:38 UTC (permalink / raw)
  To: Johannes Thumshirn, Jens Axboe
  Cc: linux-block@vger.kernel.org, Damien Le Moal, Christoph Hellwig,
	Bart Van Assche

On 7/14/25 07:38, Johannes Thumshirn wrote:
> Add tracepoints to zone write plugging plug and unplug events.
>
>    kworker/u9:3-162  [000] d..1. 2231.939277: disk_zone_wplug_add_bio: 8,0 zone 12, BIO 6291456 + 14
>    kworker/0:1H-59   [000] d..1. 2231.939884: blk_zone_wplug_bio: 8,0 zone 24, BIO 12775168 + 4
>
> Signed-off-by: Johannes Thumshirn<johannes.thumshirn@wdc.com>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 2/5] block: split blk_zone_update_request_bio into two functions
  2025-07-14 14:38 ` [PATCH v2 2/5] block: split blk_zone_update_request_bio into two functions Johannes Thumshirn
  2025-07-14 16:34   ` Bart Van Assche
  2025-07-14 22:36   ` Chaitanya Kulkarni
@ 2025-07-15  5:33   ` Christoph Hellwig
  2 siblings, 0 replies; 22+ messages in thread
From: Christoph Hellwig @ 2025-07-15  5:33 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Jens Axboe, linux-block, Damien Le Moal, Christoph Hellwig,
	Bart Van Assche

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 3/5] block: add tracepoint for blk_zone_update_request_bio
  2025-07-14 14:38 ` [PATCH v2 3/5] block: add tracepoint for blk_zone_update_request_bio Johannes Thumshirn
  2025-07-14 16:35   ` Bart Van Assche
  2025-07-14 22:36   ` Chaitanya Kulkarni
@ 2025-07-15  5:33   ` Christoph Hellwig
  2 siblings, 0 replies; 22+ messages in thread
From: Christoph Hellwig @ 2025-07-15  5:33 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Jens Axboe, linux-block, Damien Le Moal, Christoph Hellwig,
	Bart Van Assche

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 4/5] block: add tracepoint for blkdev_zone_mgmt
  2025-07-14 14:38 ` [PATCH v2 4/5] block: add tracepoint for blkdev_zone_mgmt Johannes Thumshirn
  2025-07-14 16:35   ` Bart Van Assche
  2025-07-14 22:37   ` Chaitanya Kulkarni
@ 2025-07-15  5:33   ` Christoph Hellwig
  2 siblings, 0 replies; 22+ messages in thread
From: Christoph Hellwig @ 2025-07-15  5:33 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Jens Axboe, linux-block, Damien Le Moal, Christoph Hellwig,
	Bart Van Assche

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH v2 5/5] block: add trace messages to zone write plugging
  2025-07-14 16:43   ` Bart Van Assche
@ 2025-07-15  5:39     ` Johannes Thumshirn
  0 siblings, 0 replies; 22+ messages in thread
From: Johannes Thumshirn @ 2025-07-15  5:39 UTC (permalink / raw)
  To: Bart Van Assche, Jens Axboe
  Cc: linux-block@vger.kernel.org, Damien Le Moal, hch

On 14.07.25 18:43, Bart Van Assche wrote:
> On 7/14/25 7:38 AM, Johannes Thumshirn wrote:
>> +	TP_printk("%d,%d zone %u, BIO %llu + %u",
>> +		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->zno,
>> +		  (unsigned long long)__entry->sector,
>> +		  __entry->nr_segs)
> 
> Fifteen years ago it was essential in kernel code to cast u64 values
> when formatting these with %llu but that's no longer necessary today. I
> think that the "unsigned long long" cast can be left out since nowadays
> u64 is a synonym for unsigned long long in the Linux kernel. Otherwise
> this patch looks good to me.

If you look at the rest of include/trace/events/block.h every other 
TP_printk() invocation that has sector is doing this cast.

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2025-07-15  5:39 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 14:38 [PATCH v2 0/5] block: add tracepoints for ZBD specific operations Johannes Thumshirn
2025-07-14 14:38 ` [PATCH v2 1/5] blktrace: add zoned block commands to blk_fill_rwbs Johannes Thumshirn
2025-07-14 16:32   ` Bart Van Assche
2025-07-14 21:32   ` Bart Van Assche
2025-07-14 22:34   ` Chaitanya Kulkarni
2025-07-14 14:38 ` [PATCH v2 2/5] block: split blk_zone_update_request_bio into two functions Johannes Thumshirn
2025-07-14 16:34   ` Bart Van Assche
2025-07-14 22:36   ` Chaitanya Kulkarni
2025-07-15  5:33   ` Christoph Hellwig
2025-07-14 14:38 ` [PATCH v2 3/5] block: add tracepoint for blk_zone_update_request_bio Johannes Thumshirn
2025-07-14 16:35   ` Bart Van Assche
2025-07-14 22:36   ` Chaitanya Kulkarni
2025-07-15  5:33   ` Christoph Hellwig
2025-07-14 14:38 ` [PATCH v2 4/5] block: add tracepoint for blkdev_zone_mgmt Johannes Thumshirn
2025-07-14 16:35   ` Bart Van Assche
2025-07-14 22:37   ` Chaitanya Kulkarni
2025-07-15  5:33   ` Christoph Hellwig
2025-07-14 14:38 ` [PATCH v2 5/5] block: add trace messages to zone write plugging Johannes Thumshirn
2025-07-14 16:43   ` Bart Van Assche
2025-07-15  5:39     ` Johannes Thumshirn
2025-07-14 17:48   ` Bart Van Assche
2025-07-14 22:38   ` Chaitanya Kulkarni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).