Commit 95a375a3 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

brd: use bvec_kmap_local in brd_do_bvec



Use the proper helper to kmap a bvec in brd_do_bvec instead of directly
accessing the bvec fields and use the deprecated kmap_atomic API.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20250428141014.2360063-4-hch@lst.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 857aba38
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -207,15 +207,15 @@ static int brd_rw_bvec(struct brd_device *brd, struct bio_vec *bv,
			return err;
	}

	mem = kmap_atomic(bv->bv_page);
	mem = bvec_kmap_local(bv);
	if (!op_is_write(opf)) {
		copy_from_brd(mem + bv->bv_offset, brd, sector, bv->bv_len);
		copy_from_brd(mem, brd, sector, bv->bv_len);
		flush_dcache_page(bv->bv_page);
	} else {
		flush_dcache_page(bv->bv_page);
		copy_to_brd(brd, mem + bv->bv_offset, sector, bv->bv_len);
		copy_to_brd(brd, mem, sector, bv->bv_len);
	}
	kunmap_atomic(mem);
	kunmap_local(mem);
	return 0;
}