Message ID | 20220222155156.597597-2-hch@lst.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio | expand |
On Tue, Feb 22, 2022 at 04:51:47PM +0100, Christoph Hellwig wrote: > 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> > --- > arch/xtensa/platforms/iss/simdisk.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/xtensa/platforms/iss/simdisk.c b/arch/xtensa/platforms/iss/simdisk.c > index 8eb6ad1a3a1de..0f0e0724397f4 100644 > --- a/arch/xtensa/platforms/iss/simdisk.c > +++ b/arch/xtensa/platforms/iss/simdisk.c > @@ -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); > -- > 2.30.2 > >
diff --git a/arch/xtensa/platforms/iss/simdisk.c b/arch/xtensa/platforms/iss/simdisk.c index 8eb6ad1a3a1de..0f0e0724397f4 100644 --- a/arch/xtensa/platforms/iss/simdisk.c +++ b/arch/xtensa/platforms/iss/simdisk.c @@ -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);
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> --- arch/xtensa/platforms/iss/simdisk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)