]> www.infradead.org Git - users/hch/block.git/commitdiff
drbd: use bvec_kmap_local in recv_dless_read bvec-phys
authorChristoph Hellwig <hch@lst.de>
Thu, 20 May 2021 13:14:18 +0000 (15:14 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 21 May 2021 05:57:24 +0000 (07:57 +0200)
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>
drivers/block/drbd/drbd_receiver.c

index 69284ebba7861a9cad0387c8e2d07f621ce3c0b2..44152698863965892436a7a2b800d58017f75829 100644 (file)
@@ -2033,10 +2033,10 @@ static int recv_dless_read(struct drbd_peer_device *peer_device, struct drbd_req
        D_ASSERT(peer_device->device, sector == bio->bi_iter.bi_sector);
 
        bio_for_each_segment(bvec, bio, iter) {
-               void *mapped = kmap(bvec.bv_page) + bvec.bv_offset;
+               void *mapped = bvec_kmap_local(&bvec);
                expect = min_t(int, data_size, bvec.bv_len);
                err = drbd_recv_all_warn(peer_device->connection, mapped, expect);
-               kunmap(bvec.bv_page);
+               kunmap_local(mapped);
                if (err)
                        return err;
                data_size -= expect;