Thread (21 messages) 21 messages, 2 authors, 2025-08-28
STALE322d
Revisions (14)
  1. v11 [diff vs current]
  2. v12 [diff vs current]
  3. v13 [diff vs current]
  4. v16 [diff vs current]
  5. v17 [diff vs current]
  6. v18 [diff vs current]
  7. v19 [diff vs current]
  8. v20 [diff vs current]
  9. v21 [diff vs current]
  10. v22 [diff vs current]
  11. v23 [diff vs current]
  12. v24 current
  13. v25 [diff vs current]
  14. v26 [diff vs current]

[PATCH v24 01/18] block: Support block devices that preserve the order of write requests

From: Bart Van Assche <bvanassche@acm.org>
Date: 2025-08-27 21:30:17
Also in: linux-scsi
Subsystem: block layer, the rest · Maintainers: Jens Axboe, Linus Torvalds

Some storage controllers preserve the request order per hardware queue.
Some but not all device mapper drivers preserve the bio order. Introduce
the feature flag BLK_FEAT_ORDERED_HWQ to allow block drivers and stacked
drivers to indicate that the order of write commands is preserved per
hardware queue and hence that serialization of writes per zone is not
required if all pending writes are submitted to the same hardware queue.

Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 block/blk-settings.c   | 2 ++
 include/linux/blkdev.h | 6 ++++++
 2 files changed, 8 insertions(+)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index d6438e6c276d..bcb9f115ba5a 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -777,6 +777,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
 		t->features &= ~BLK_FEAT_NOWAIT;
 	if (!(b->features & BLK_FEAT_POLL))
 		t->features &= ~BLK_FEAT_POLL;
+	if (!(b->features & BLK_FEAT_ORDERED_HWQ))
+		t->features &= ~BLK_FEAT_ORDERED_HWQ;
 
 	t->flags |= (b->flags & BLK_FLAG_MISALIGNED);
 
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index fe1797bbec42..23bb2a407368 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -338,6 +338,12 @@ typedef unsigned int __bitwise blk_features_t;
 /* skip this queue in blk_mq_(un)quiesce_tagset */
 #define BLK_FEAT_SKIP_TAGSET_QUIESCE	((__force blk_features_t)(1u << 13))
 
+/*
+ * The request order is preserved per hardware queue by the block driver and by
+ * the block device. Set by the block driver.
+ */
+#define BLK_FEAT_ORDERED_HWQ		((__force blk_features_t)(1u << 14))
+
 /* undocumented magic for bcache */
 #define BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE \
 	((__force blk_features_t)(1u << 15))
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help