Commit 143a70b8 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

iss-simdisk: use bvec_kmap_local in simdisk_submit_bio



Using local kmaps slightly reduces the chances to stray writes, and
the bvec interface cleans up the code a little bit.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Acked-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
Link: https://lore.kernel.org/r/20220303111905.321089-2-hch@lst.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent c48d8c5c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);