Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8b27acc authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

bcache: don't clone bio in bch_data_verify



We immediately overwrite the biovec array, so instead just allocate
a new bio and copy over the disk, setor and size.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
Acked-by: default avatarColy Li <colyli@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3bb50983
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -110,11 +110,15 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio)
	struct bio_vec bv, cbv;
	struct bvec_iter iter, citer = { 0 };

	check = bio_clone_kmalloc(bio, GFP_NOIO);
	check = bio_kmalloc(GFP_NOIO, bio_segments(bio));
	if (!check)
		return;
	check->bi_disk = bio->bi_disk;
	check->bi_opf = REQ_OP_READ;
	check->bi_iter.bi_sector = bio->bi_iter.bi_sector;
	check->bi_iter.bi_size = bio->bi_iter.bi_size;

	bch_bio_map(check, NULL);
	if (bch_bio_alloc_pages(check, GFP_NOIO))
		goto out_put;