On 7/9/25 7:06 AM, Bart Van Assche wrote: > Some storage controllers preserve the request order per hardware queue. > Some but not all device mapper drivers preserve the bio order. Introduce > the request queue limit member variable 'driver_preserves_write_order' to > allow block drivers and device mapper 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@xxxxxxxxxx> > Cc: Hannes Reinecke <hare@xxxxxxx> > Cc: Nitesh Shetty <nj.shetty@xxxxxxxxxxx> > Cc: Christoph Hellwig <hch@xxxxxx> > Cc: Ming Lei <ming.lei@xxxxxxxxxx> > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > --- > block/blk-settings.c | 2 ++ > include/linux/blkdev.h | 5 +++++ > 2 files changed, 7 insertions(+) > > diff --git a/block/blk-settings.c b/block/blk-settings.c > index a000daafbfb4..bceb9a9cb5ba 100644 > --- a/block/blk-settings.c > +++ b/block/blk-settings.c > @@ -814,6 +814,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, > } > t->max_secure_erase_sectors = min_not_zero(t->max_secure_erase_sectors, > b->max_secure_erase_sectors); > + t->driver_preserves_write_order = t->driver_preserves_write_order && > + b->driver_preserves_write_order; See blk_stack_limits() and the section: /* * Some feaures need to be supported both by the stacking driver and all * underlying devices. The stacking driver sets these flags before * stacking the limits, and this will clear the flags if any of the * underlying devices does not support it. */ if (!(b->features & BLK_FEAT_NOWAIT)) t->features &= ~BLK_FEAT_NOWAIT; if (!(b->features & BLK_FEAT_POLL)) t->features &= ~BLK_FEAT_POLL; And make driver_preserves_write_order a feature instead of treating it specially. Also, the name "driver_preserves_write_order" is not great. The driver may be preserving write order, but the hardware not (e.g. libata and AHCI). > t->zone_write_granularity = max(t->zone_write_granularity, > b->zone_write_granularity); > if (!(t->features & BLK_FEAT_ZONED)) { > diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h > index 5f14c20c8bc0..4dec1d91b7f2 100644 > --- a/include/linux/blkdev.h > +++ b/include/linux/blkdev.h > @@ -413,6 +413,11 @@ struct queue_limits { > > unsigned int max_open_zones; > unsigned int max_active_zones; > + /* > + * Whether or not the block driver preserves the order of write > + * requests per hardware queue. Set by the block driver. > + */ > + bool driver_preserves_write_order; > > /* > * Drivers that set dma_alignment to less than 511 must be prepared to -- Damien Le Moal Western Digital Research