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

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Christoph Hellwig and committed by
Jens Axboe
00387bd2 0f5cd781

+5 -6
+5 -6
drivers/md/bcache/debug.c
··· 127 127 128 128 citer.bi_size = UINT_MAX; 129 129 bio_for_each_segment(bv, bio, iter) { 130 - void *p1 = kmap_atomic(bv.bv_page); 130 + void *p1 = bvec_kmap_local(&bv); 131 131 void *p2; 132 132 133 133 cbv = bio_iter_iovec(check, citer); 134 - p2 = page_address(cbv.bv_page); 134 + p2 = bvec_kmap_local(&cbv); 135 135 136 - cache_set_err_on(memcmp(p1 + bv.bv_offset, 137 - p2 + bv.bv_offset, 138 - bv.bv_len), 136 + cache_set_err_on(memcmp(p1, p2, bv.bv_len), 139 137 dc->disk.c, 140 138 "verify failed at dev %pg sector %llu", 141 139 dc->bdev, 142 140 (uint64_t) bio->bi_iter.bi_sector); 143 141 144 - kunmap_atomic(p1); 142 + kunmap_local(p2); 143 + kunmap_local(p1); 145 144 bio_advance_iter(check, &citer, bv.bv_len); 146 145 } 147 146