From: Christoph Hellwig Date: Thu, 3 Mar 2022 11:19:02 +0000 (+0300) Subject: bcache: use bvec_kmap_local in bio_csum X-Git-Tag: v6.6.17~7806^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07fee7aba5472d0e65345146a68b4bd1a8b656c3;p=platform%2Fkernel%2Flinux-rpi.git bcache: use bvec_kmap_local in bio_csum Using local kmaps slightly reduces the chances to stray writes, and the bvec interface cleans up the code a little bit. Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny Link: https://lore.kernel.org/r/20220303111905.321089-8-hch@lst.de Signed-off-by: Jens Axboe --- diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 6869e01..fdd0194 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -44,10 +44,10 @@ static void bio_csum(struct bio *bio, struct bkey *k) uint64_t csum = 0; bio_for_each_segment(bv, bio, iter) { - void *d = kmap(bv.bv_page) + bv.bv_offset; + void *d = bvec_kmap_local(&bv); csum = crc64_be(csum, d, bv.bv_len); - kunmap(bv.bv_page); + kunmap_local(d); } k->ptr[KEY_PTRS(k)] = csum & (~0ULL >> 1);