diff options
author | Bart Van Assche <bvanassche@google.com> | 2023-12-21 12:44:13 -0800 |
---|---|---|
committer | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2024-05-16 21:29:14 +0000 |
commit | 94fb2a98835322f4a33c73c18fdd8a33966cac63 (patch) | |
tree | a4161b730cf4cf5442c7c2681784244fe8f78d2c | |
parent | fa400e4bb1890eb450c2258b59b3dbebff1eba52 (diff) | |
download | common-android15-6.6.tar.gz |
ANDROID: block: Do not set the I/O priority for zoned writesandroid15-6.6
The I/O priority set by the ionice command or by the blk-ioprio cgroup
policy may cause the mq-deadline I/O scheduler to submit zoned writes in
the wrong order and hence to trigger unaligned write errors. Fix this by
not applying these I/O priority policies on sequential zoned writes.
Bug: 314766504
Bug: 317396425
Change-Id: I88ae04b697239f1aa27404cbf35c5a96d3a73a1f
Signed-off-by: Bart Van Assche <bvanassche@google.com>
-rw-r--r-- | block/blk-core.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 025d25cfb2d3..345c82d584fe 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -828,8 +828,36 @@ end_io: } EXPORT_SYMBOL(submit_bio_noacct); +#ifdef CONFIG_BLK_DEV_ZONED +/** + * blk_bio_is_seq_zoned_write() - Check if @bio requires write serialization. + * @bio: Bio to examine. + * + * Note: REQ_OP_ZONE_APPEND bios do not require serialization. + */ +static bool blk_bio_is_seq_zoned_write(struct bio *bio) +{ + return disk_zone_is_seq(bio->bi_bdev->bd_disk, + bio->bi_iter.bi_sector) && + op_needs_zoned_write_locking(bio_op(bio)); +} +#else +static bool blk_bio_is_seq_zoned_write(struct bio *bio) +{ + return false; +} +#endif + static void bio_set_ioprio(struct bio *bio) { + /* + * Do not set the I/O priority of sequential zoned write bios because + * this could lead to reordering by the mq-deadline I/O scheduler and + * hence to unaligned write errors. + */ + if (blk_bio_is_seq_zoned_write(bio)) + return; + /* Nobody set ioprio so far? Initialize it based on task's nice value */ if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE) bio->bi_ioprio = get_current_ioprio(); |