diff options
author | Christoph Hellwig <hch@lst.de> | 2021-10-20 22:38:11 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-10-20 08:40:54 -0600 |
commit | 00387bd21dac98f9e793294c895768d9e5441f82 (patch) | |
tree | 302be87bd06e928194b3c98607fe15ccfdac7f2f /drivers/md | |
parent | 0f5cd7815f7f4bb1dd340a9aeb9b9d6a7c7eec22 (diff) | |
download | linux-00387bd21dac98f9e793294c895768d9e5441f82.tar.bz2 |
bcache: use bvec_kmap_local in bch_data_verify
Using local kmaps slightly reduces the chances to stray writes, and
the bvec interface cleans up the code a little bit.
Also switch from page_address to bvec_kmap_local for cbv to be on the
safe side and to avoid pointlessly poking into bvec internals.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20211020143812.6403-8-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/bcache/debug.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c index e803cad864be..6230dfdd9286 100644 --- a/drivers/md/bcache/debug.c +++ b/drivers/md/bcache/debug.c @@ -127,21 +127,20 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio) citer.bi_size = UINT_MAX; bio_for_each_segment(bv, bio, iter) { - void *p1 = kmap_atomic(bv.bv_page); + void *p1 = bvec_kmap_local(&bv); void *p2; cbv = bio_iter_iovec(check, citer); - p2 = page_address(cbv.bv_page); + p2 = bvec_kmap_local(&cbv); - cache_set_err_on(memcmp(p1 + bv.bv_offset, - p2 + bv.bv_offset, - bv.bv_len), + cache_set_err_on(memcmp(p1, p2, bv.bv_len), dc->disk.c, "verify failed at dev %pg sector %llu", dc->bdev, (uint64_t) bio->bi_iter.bi_sector); - kunmap_atomic(p1); + kunmap_local(p2); + kunmap_local(p1); bio_advance_iter(check, &citer, bv.bv_len); } |