Message ID | 20220222155156.597597-9-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:54PM +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> > --- > drivers/block/drbd/drbd_worker.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c > index a5e04b38006b6..1b48c8172a077 100644 > --- a/drivers/block/drbd/drbd_worker.c > +++ b/drivers/block/drbd/drbd_worker.c > @@ -326,9 +326,9 @@ void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest) > bio_for_each_segment(bvec, bio, iter) { > u8 *src; > > - src = kmap_atomic(bvec.bv_page); > - crypto_shash_update(desc, src + bvec.bv_offset, bvec.bv_len); > - kunmap_atomic(src); > + src = bvec_kmap_local(&bvec); > + crypto_shash_update(desc, src, bvec.bv_len); > + kunmap_local(src); > > /* REQ_OP_WRITE_SAME has only one segment, > * checksum the payload only once. */ > -- > 2.30.2 > >
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index a5e04b38006b6..1b48c8172a077 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c @@ -326,9 +326,9 @@ void drbd_csum_bio(struct crypto_shash *tfm, struct bio *bio, void *digest) bio_for_each_segment(bvec, bio, iter) { u8 *src; - src = kmap_atomic(bvec.bv_page); - crypto_shash_update(desc, src + bvec.bv_offset, bvec.bv_len); - kunmap_atomic(src); + src = bvec_kmap_local(&bvec); + crypto_shash_update(desc, src, bvec.bv_len); + kunmap_local(src); /* REQ_OP_WRITE_SAME has only one segment, * checksum the payload only once. */
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_worker.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)