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

blk-crypto: convert to use bio_submit_split_bioset()

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

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

authored by

Yu Kuai and committed by
Jens Axboe
e3290419 6529d41d

+5 -12
+5 -12
block/blk-crypto-fallback.c
··· 18 18 #include <linux/module.h> 19 19 #include <linux/random.h> 20 20 #include <linux/scatterlist.h> 21 - #include <trace/events/block.h> 22 21 23 22 #include "blk-cgroup.h" 24 23 #include "blk-crypto-internal.h" ··· 221 222 if (++i == BIO_MAX_VECS) 222 223 break; 223 224 } 225 + 224 226 if (num_sectors < bio_sectors(bio)) { 225 - struct bio *split_bio; 226 - 227 - split_bio = bio_split(bio, num_sectors, GFP_NOIO, 228 - &crypto_bio_split); 229 - if (IS_ERR(split_bio)) { 230 - bio->bi_status = BLK_STS_RESOURCE; 227 + bio = bio_submit_split_bioset(bio, num_sectors, 228 + &crypto_bio_split); 229 + if (!bio) 231 230 return false; 232 - } 233 231 234 - bio_chain(split_bio, bio); 235 - trace_block_split(split_bio, bio->bi_iter.bi_sector); 236 - submit_bio_noacct(bio); 237 - *bio_ptr = split_bio; 232 + *bio_ptr = bio; 238 233 } 239 234 240 235 return true;