All of lore.kernel.org
 help / color / mirror / Atom feed
* use bvec_kmap_local
@ 2021-10-18  6:12 Christoph Hellwig
  2021-10-18  6:12 ` [PATCH 1/2] nvdimm-blk: use bvec_kmap_local in nd_blk_rw_integrity Christoph Hellwig
  2021-10-18  6:12 ` [PATCH 2/2] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-10-18  6:12 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny; +Cc: nvdimm

Hi all,

this series uses the bvec_kmap_local helper in the nvdimm subsystem.

Diffstat:
 blk.c |    7 +++----
 btt.c |   10 ++++------
 2 files changed, 7 insertions(+), 10 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] nvdimm-blk: use bvec_kmap_local in nd_blk_rw_integrity
  2021-10-18  6:12 use bvec_kmap_local Christoph Hellwig
@ 2021-10-18  6:12 ` Christoph Hellwig
  2021-10-18  6:12 ` [PATCH 2/2] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-10-18  6:12 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny; +Cc: nvdimm

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/nvdimm/blk.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c
index 088d3dd6f6fac..1e96b377a7979 100644
--- a/drivers/nvdimm/blk.c
+++ b/drivers/nvdimm/blk.c
@@ -89,10 +89,9 @@ static int nd_blk_rw_integrity(struct nd_namespace_blk *nsblk,
 		 */
 
 		cur_len = min(len, bv.bv_len);
-		iobuf = kmap_atomic(bv.bv_page);
-		err = ndbr->do_io(ndbr, dev_offset, iobuf + bv.bv_offset,
-				cur_len, rw);
-		kunmap_atomic(iobuf);
+		iobuf = bvec_kmap_local(&bv);
+		err = ndbr->do_io(ndbr, dev_offset, iobuf, cur_len, rw);
+		kunmap_local(iobuf);
 		if (err)
 			return err;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity
  2021-10-18  6:12 use bvec_kmap_local Christoph Hellwig
  2021-10-18  6:12 ` [PATCH 1/2] nvdimm-blk: use bvec_kmap_local in nd_blk_rw_integrity Christoph Hellwig
@ 2021-10-18  6:12 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-10-18  6:12 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny; +Cc: nvdimm

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/nvdimm/btt.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 92dec49522972..9c3871b713655 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1164,17 +1164,15 @@ static int btt_rw_integrity(struct btt *btt, struct bio_integrity_payload *bip,
 		 */
 
 		cur_len = min(len, bv.bv_len);
-		mem = kmap_atomic(bv.bv_page);
+		mem = bvec_kmap_local(&bv);
 		if (rw)
-			ret = arena_write_bytes(arena, meta_nsoff,
-					mem + bv.bv_offset, cur_len,
+			ret = arena_write_bytes(arena, meta_nsoff, mem, cur_len,
 					NVDIMM_IO_ATOMIC);
 		else
-			ret = arena_read_bytes(arena, meta_nsoff,
-					mem + bv.bv_offset, cur_len,
+			ret = arena_read_bytes(arena, meta_nsoff, mem, cur_len,
 					NVDIMM_IO_ATOMIC);
 
-		kunmap_atomic(mem);
+		kunmap_local(mem);
 		if (ret)
 			return ret;
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-18  6:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18  6:12 use bvec_kmap_local Christoph Hellwig
2021-10-18  6:12 ` [PATCH 1/2] nvdimm-blk: use bvec_kmap_local in nd_blk_rw_integrity Christoph Hellwig
2021-10-18  6:12 ` [PATCH 2/2] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.