mirror of https://github.com/torvalds/linux.git
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>
This commit is contained in:
parent
6529d41d87
commit
e3290419d9
|
|
@ -18,7 +18,6 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
#include <linux/scatterlist.h>
|
#include <linux/scatterlist.h>
|
||||||
#include <trace/events/block.h>
|
|
||||||
|
|
||||||
#include "blk-cgroup.h"
|
#include "blk-cgroup.h"
|
||||||
#include "blk-crypto-internal.h"
|
#include "blk-crypto-internal.h"
|
||||||
|
|
@ -222,20 +221,14 @@ static bool blk_crypto_fallback_split_bio_if_needed(struct bio **bio_ptr)
|
||||||
if (++i == BIO_MAX_VECS)
|
if (++i == BIO_MAX_VECS)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_sectors < bio_sectors(bio)) {
|
if (num_sectors < bio_sectors(bio)) {
|
||||||
struct bio *split_bio;
|
bio = bio_submit_split_bioset(bio, num_sectors,
|
||||||
|
|
||||||
split_bio = bio_split(bio, num_sectors, GFP_NOIO,
|
|
||||||
&crypto_bio_split);
|
&crypto_bio_split);
|
||||||
if (IS_ERR(split_bio)) {
|
if (!bio)
|
||||||
bio->bi_status = BLK_STS_RESOURCE;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
bio_chain(split_bio, bio);
|
*bio_ptr = bio;
|
||||||
trace_block_split(split_bio, bio->bi_iter.bi_sector);
|
|
||||||
submit_bio_noacct(bio);
|
|
||||||
*bio_ptr = split_bio;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue