Skip to content

Commit 07fee7a

Browse files
Christoph Hellwigaxboe
authored andcommitted
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 <hch@lst.de> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Link: https://lore.kernel.org/r/20220303111905.321089-8-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 3205190 commit 07fee7a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/md/bcache/request.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ static void bio_csum(struct bio *bio, struct bkey *k)
4444
uint64_t csum = 0;
4545

4646
bio_for_each_segment(bv, bio, iter) {
47-
void *d = kmap(bv.bv_page) + bv.bv_offset;
47+
void *d = bvec_kmap_local(&bv);
4848

4949
csum = crc64_be(csum, d, bv.bv_len);
50-
kunmap(bv.bv_page);
50+
kunmap_local(d);
5151
}
5252

5353
k->ptr[KEY_PTRS(k)] = csum & (~0ULL >> 1);

0 commit comments

Comments
 (0)