[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250905070643.2533483-15-yukuai1@huaweicloud.com>
Date: Fri, 5 Sep 2025 15:06:41 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: hch@...radead.org,
colyli@...nel.org,
hare@...e.de,
dlemoal@...nel.org,
tieren@...as.com,
bvanassche@....org,
axboe@...nel.dk,
tj@...nel.org,
josef@...icpanda.com,
song@...nel.org,
yukuai3@...wei.com,
satyat@...gle.com,
ebiggers@...gle.com,
kmo@...erainc.com,
akpm@...ux-foundation.org,
neil@...wn.name
Cc: linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
cgroups@...r.kernel.org,
linux-raid@...r.kernel.org,
yi.zhang@...wei.com,
yangerkun@...wei.com,
johnny.chenyi@...wei.com
Subject: [PATCH for-6.18/block 14/16] block: skip unnecessary checks for split bio
From: Yu Kuai <yukuai3@...wei.com>
Lots of checks are already done while submitting this bio the first
time, and there is no need to check them again when this bio is
resubmitted after split.
Hence open code should_fail_bio() and blk_throtl_bio() that are still
necessary from submit_bio_split_bioset().
Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
block/blk-core.c | 2 +-
block/blk-merge.c | 6 +++++-
block/blk.h | 1 +
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 83c262a3dfd9..1021a09c5958 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -539,7 +539,7 @@ static inline void bio_check_ro(struct bio *bio)
}
}
-static noinline int should_fail_bio(struct bio *bio)
+int should_fail_bio(struct bio *bio)
{
if (should_fail_request(bdev_whole(bio->bi_bdev), bio->bi_iter.bi_size))
return -EIO;
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 51fe4ed5b7c0..c411045fcf03 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -130,7 +130,11 @@ struct bio *bio_submit_split_bioset(struct bio *bio, unsigned int split_sectors,
bio_chain(split, bio);
trace_block_split(split, bio->bi_iter.bi_sector);
WARN_ON_ONCE(bio_zone_write_plugging(bio));
- submit_bio_noacct(bio);
+
+ if (should_fail_bio(bio))
+ bio_io_error(bio);
+ else if (!blk_throtl_bio(bio))
+ submit_bio_noacct_nocheck(bio);
return split;
}
diff --git a/block/blk.h b/block/blk.h
index 0268deb22268..18cc3c2afdd4 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -615,6 +615,7 @@ extern const struct address_space_operations def_blk_aops;
int disk_register_independent_access_ranges(struct gendisk *disk);
void disk_unregister_independent_access_ranges(struct gendisk *disk);
+int should_fail_bio(struct bio *bio);
#ifdef CONFIG_FAIL_MAKE_REQUEST
bool should_fail_request(struct block_device *part, unsigned int bytes);
#else /* CONFIG_FAIL_MAKE_REQUEST */
--
2.39.2
Powered by blists - more mailing lists