ANDROID: dm: Split zoned writes at the top of the stack

Prevent that __submit_bio_noacct() reorders zoned writes by making the
topmost dm driver split bios.

Bug: 415836627
Change-Id: I4c9e3a9d9747ec85b27ddb20612fcc23cbca7091
Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
Bart Van Assche
2025-05-13 09:17:21 -07:00
parent 49dd742eed
commit 9464dc3f22

View File

@@ -1788,11 +1788,14 @@ static inline bool dm_zone_bio_needs_split(struct mapped_device *md,
struct bio *bio)
{
/*
* For mapped device that need zone append emulation, we must
* split any large BIO that straddles zone boundaries.
* For a mapped device that needs zone append emulation, we must
* split any large BIO that straddles zone boundaries. Additionally,
* split sequential zoned writes to prevent that splitting lower in the
* stack causes bio reordering.
*/
return dm_emulate_zone_append(md) && bio_straddles_zones(bio) &&
!bio_flagged(bio, BIO_ZONE_WRITE_PLUGGING);
return ((dm_emulate_zone_append(md) && bio_straddles_zones(bio)) ||
(bio_op(bio) == REQ_OP_WRITE && bdev_is_zoned(bio->bi_bdev))) &&
!bio_flagged(bio, BIO_ZONE_WRITE_PLUGGING);
}
static inline bool dm_zone_plug_bio(struct mapped_device *md, struct bio *bio)
{