Skip to content

Commit 3eddaa6

Browse files
Christoph Hellwigaxboe
authored andcommitted
drbd: use bvec_kmap_local in recv_dless_read
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-10-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 4722785 commit 3eddaa6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/block/drbd/drbd_receiver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,10 +2017,10 @@ static int recv_dless_read(struct drbd_peer_device *peer_device, struct drbd_req
20172017
D_ASSERT(peer_device->device, sector == bio->bi_iter.bi_sector);
20182018

20192019
bio_for_each_segment(bvec, bio, iter) {
2020-
void *mapped = kmap(bvec.bv_page) + bvec.bv_offset;
2020+
void *mapped = bvec_kmap_local(&bvec);
20212021
expect = min_t(int, data_size, bvec.bv_len);
20222022
err = drbd_recv_all_warn(peer_device->connection, mapped, expect);
2023-
kunmap(bvec.bv_page);
2023+
kunmap_local(mapped);
20242024
if (err)
20252025
return err;
20262026
data_size -= expect;

0 commit comments

Comments
 (0)