Skip to content

Commit 496bde7

Browse files
bvanasschekawasaki
authored andcommitted
block: Support block devices 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 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 <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Bart Van Assche <[email protected]>
1 parent 44f2832 commit 496bde7

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

block/blk-settings.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
761761
t->features &= ~BLK_FEAT_NOWAIT;
762762
if (!(b->features & BLK_FEAT_POLL))
763763
t->features &= ~BLK_FEAT_POLL;
764+
if (!(b->features & BLK_FEAT_ORDERED_HWQ))
765+
t->features &= ~BLK_FEAT_ORDERED_HWQ;
764766

765767
t->flags |= (b->flags & BLK_FLAG_MISALIGNED);
766768

include/linux/blkdev.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,12 @@ typedef unsigned int __bitwise blk_features_t;
338338
/* skip this queue in blk_mq_(un)quiesce_tagset */
339339
#define BLK_FEAT_SKIP_TAGSET_QUIESCE ((__force blk_features_t)(1u << 13))
340340

341+
/*
342+
* The request order is preserved per hardware queue by the block driver and by
343+
* the block device.
344+
*/
345+
#define BLK_FEAT_ORDERED_HWQ ((__force blk_features_t)(1u << 14))
346+
341347
/* undocumented magic for bcache */
342348
#define BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE \
343349
((__force blk_features_t)(1u << 15))

0 commit comments

Comments
 (0)