Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

md/raid0: convert raid0_handle_discard() to use bio_submit_split_bioset()

Unify bio split code, and prepare to fix ordering of split IO

Noted commit 319ff40a5427 ("md/raid0: Fix performance regression for large
sequential writes") already fix ordering of split IO by remapping bio to
underlying disks before resubmitting it, with the respect
md_submit_bio() already split it by sectors, and raid0_make_request()
will split at most once for unaligned IO. This is a bit hacky and we'll
convert this to solution in general later.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Yu Kuai and committed by
Jens Axboe
5b38ee5a e37b5596

+6 -13
+6 -13
drivers/md/raid0.c
··· 463 463 zone = find_zone(conf, &start); 464 464 465 465 if (bio_end_sector(bio) > zone->zone_end) { 466 - struct bio *split = bio_split(bio, 467 - zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO, 468 - &mddev->bio_set); 469 - 470 - if (IS_ERR(split)) { 471 - bio->bi_status = errno_to_blk_status(PTR_ERR(split)); 472 - bio_endio(bio); 466 + bio = bio_submit_split_bioset(bio, 467 + zone->zone_end - bio->bi_iter.bi_sector, 468 + &mddev->bio_set); 469 + if (!bio) 473 470 return; 474 - } 475 471 476 - bio_chain(split, bio); 477 - trace_block_split(split, bio->bi_iter.bi_sector); 478 - submit_bio_noacct(bio); 479 - bio = split; 480 472 end = zone->zone_end; 481 - } else 473 + } else { 482 474 end = bio_end_sector(bio); 475 + } 483 476 484 477 orig_end = end; 485 478 if (zone != conf->strip_zone)