On 5/20/25 6:56 AM, Christoph Hellwig wrote:
On Mon, May 19, 2025 at 03:12:11PM -0700, Bart Van Assche wrote:
This new patch should address the concerns brought up in your latest email:
No, we should never need to do a sort, as mentioned we need to fix how stackable drivers split the I/O. Or maybe even get them out of all the splits that aren't required.
If the sequential write bios are split by the device mapper, sorting bios in the block layer is not necessary. Christoph and Damien, do you agree to replace the bio sorting code in my previous email with the patch below?
Thanks,
Bart.
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 3d419fd2be57..c41ab294987e 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1792,9 +1792,12 @@ static inline bool dm_zone_bio_needs_split(struct mapped_device *md, { /* * For mapped device that need zone append emulation, we must - * split any large BIO that straddles zone boundaries. + * split any large BIO that straddles zone boundaries. Additionally, + * split sequential writes to prevent that splitting lower in the stack + * causes reordering. */ - return dm_emulate_zone_append(md) && bio_straddles_zones(bio) && + return ((dm_emulate_zone_append(md) && bio_straddles_zones(bio)) || + bio_op(bio) == REQ_OP_WRITE) && !bio_flagged(bio, BIO_ZONE_WRITE_PLUGGING); } static inline bool dm_zone_plug_bio(struct mapped_device *md, struct bio *bio)