iss-simdisk: use bvec_kmap_local in simdisk_submit_bio
authorChristoph Hellwig <hch@lst.de>
Thu, 3 Mar 2022 11:18:56 +0000 (14:18 +0300)
committerJens Axboe <axboe@kernel.dk>
Fri, 4 Mar 2022 19:29:20 +0000 (12:29 -0700)
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>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Link: https://lore.kernel.org/r/20220303111905.321089-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
arch/xtensa/platforms/iss/simdisk.c

index 8eb6ad1a3a1dec402dd852aa60224f250d4da440..0f0e0724397f4224ac8cce3ceceae7a52b217c28 100644 (file)
@@ -108,13 +108,13 @@ static void simdisk_submit_bio(struct bio *bio)
        sector_t sector = bio->bi_iter.bi_sector;
 
        bio_for_each_segment(bvec, bio, iter) {
-               char *buffer = kmap_atomic(bvec.bv_page) + bvec.bv_offset;
+               char *buffer = bvec_kmap_local(&bvec);
                unsigned len = bvec.bv_len >> SECTOR_SHIFT;
 
                simdisk_transfer(dev, sector, len, buffer,
                                bio_data_dir(bio) == WRITE);
                sector += len;
-               kunmap_atomic(buffer);
+               kunmap_local(buffer);
        }
 
        bio_endio(bio);