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 Cc: Christoph Hellwig Signed-off-by: Bart Van Assche --- 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))