Skip to content

Commit e28f82a

Browse files
bvanasschekawasaki
authored andcommitted
block: Support block drivers that preserve the order of write requests
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 <[email protected]> Cc: Hannes Reinecke <[email protected]> Cc: Nitesh Shetty <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Ming Lei <[email protected]> Signed-off-by: Bart Van Assche <[email protected]>
1 parent 4a2df30 commit e28f82a

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

block/blk-settings.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
814814
}
815815
t->max_secure_erase_sectors = min_not_zero(t->max_secure_erase_sectors,
816816
b->max_secure_erase_sectors);
817+
t->driver_preserves_write_order = t->driver_preserves_write_order &&
818+
b->driver_preserves_write_order;
817819
t->zone_write_granularity = max(t->zone_write_granularity,
818820
b->zone_write_granularity);
819821
if (!(t->features & BLK_FEAT_ZONED)) {

include/linux/blkdev.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,11 @@ struct queue_limits {
413413

414414
unsigned int max_open_zones;
415415
unsigned int max_active_zones;
416+
/*
417+
* Whether or not the block driver preserves the order of write
418+
* requests per hardware queue. Set by the block driver.
419+
*/
420+
bool driver_preserves_write_order;
416421

417422
/*
418423
* Drivers that set dma_alignment to less than 511 must be prepared to

0 commit comments

Comments
 (0)