diff options
author | Christoph Hellwig <hch@lst.de> | 2018-07-24 03:52:30 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-07-24 16:43:19 -0400 |
commit | c8b27acc775990bbd01f067ee7616f7abf2c98a1 (patch) | |
tree | ca0d3a624b67a3973f1fd724111a8208d76eb34b /drivers/md/bcache/debug.c | |
parent | 3bb5098310317ca62304bd21af6ccea57d799b06 (diff) |
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: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/bcache/debug.c')
-rw-r--r-- | drivers/md/bcache/debug.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index d030ce3025a6..04d146711950 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c | |||
@@ -110,11 +110,15 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) | |||
110 | struct bio_vec bv, cbv; | 110 | struct bio_vec bv, cbv; |
111 | struct bvec_iter iter, citer = { 0 }; | 111 | struct bvec_iter iter, citer = { 0 }; |
112 | 112 | ||
113 | check = bio_clone_kmalloc(bio, GFP_NOIO); | 113 | check = bio_kmalloc(GFP_NOIO, bio_segments(bio)); |
114 | if (!check) | 114 | if (!check) |
115 | return; | 115 | return; |
116 | check->bi_disk = bio->bi_disk; | ||
116 | check->bi_opf = REQ_OP_READ; | 117 | check->bi_opf = REQ_OP_READ; |
118 | check->bi_iter.bi_sector = bio->bi_iter.bi_sector; | ||
119 | check->bi_iter.bi_size = bio->bi_iter.bi_size; | ||
117 | 120 | ||
121 | bch_bio_map(check, NULL); | ||
118 | if (bch_bio_alloc_pages(check, GFP_NOIO)) | 122 | if (bch_bio_alloc_pages(check, GFP_NOIO)) |
119 | goto out_put; | 123 | goto out_put; |
120 | 124 | ||