Commit 0b64682e authored by Yu Kuai's avatar Yu Kuai Committed by Jens Axboe
Browse files

block: skip unnecessary checks for split bio



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: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e3290419
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+5 −1
Original line number Diff line number Diff line
@@ -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;
}
+1 −0
Original line number Diff line number Diff line
@@ -616,6 +616,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 */