* remove opencoded kmap of bio_vecs v2
@ 2022-03-03 11:18 Christoph Hellwig
2022-03-03 11:18 ` [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio Christoph Hellwig
` (9 more replies)
0 siblings, 10 replies; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:18 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, nvdimm
Hi all,
this series replaces various open coded kmaps of bio_vecs with higher
level helpers that use kmap_local_page underneath. It does not touch
other kmap calls in these drivers even if those should probably also
be switched to use kmap_local eventually.
Changes since v1:
- fix missing switches to kunmap_local
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
@ 2022-03-03 11:18 ` Christoph Hellwig
2022-03-03 14:48 ` Max Filippov
2022-03-04 19:29 ` Jens Axboe
2022-03-03 11:18 ` [PATCH 02/10] aoe: use bvec_kmap_local in bvcpy Christoph Hellwig
` (8 subsequent siblings)
9 siblings, 2 replies; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:18 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, 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>
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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 02/10] aoe: use bvec_kmap_local in bvcpy
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
2022-03-03 11:18 ` [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio Christoph Hellwig
@ 2022-03-03 11:18 ` Christoph Hellwig
2022-03-03 11:18 ` [PATCH 03/10] zram: use memcpy_to_bvec in zram_bvec_read Christoph Hellwig
` (7 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:18 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, 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/block/aoe/aoecmd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index cc11f89a0928f..384073ef2323c 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -1018,9 +1018,9 @@ bvcpy(struct sk_buff *skb, struct bio *bio, struct bvec_iter iter, long cnt)
iter.bi_size = cnt;
__bio_for_each_segment(bv, bio, iter, iter) {
- char *p = kmap_atomic(bv.bv_page) + bv.bv_offset;
+ char *p = bvec_kmap_local(&bv);
skb_copy_bits(skb, soff, p, bv.bv_len);
- kunmap_atomic(p);
+ kunmap_local(p);
soff += bv.bv_len;
}
}
--
2.30.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 03/10] zram: use memcpy_to_bvec in zram_bvec_read
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
2022-03-03 11:18 ` [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio Christoph Hellwig
2022-03-03 11:18 ` [PATCH 02/10] aoe: use bvec_kmap_local in bvcpy Christoph Hellwig
@ 2022-03-03 11:18 ` Christoph Hellwig
2022-03-03 11:18 ` [PATCH 04/10] zram: use memcpy_from_bvec in zram_bvec_write Christoph Hellwig
` (6 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:18 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, nvdimm
Use the proper helper instead of open coding the copy.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
---
drivers/block/zram/zram_drv.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index a3a5e1e713268..14becdf2815df 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1331,12 +1331,10 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
goto out;
if (is_partial_io(bvec)) {
- void *dst = kmap_atomic(bvec->bv_page);
void *src = kmap_atomic(page);
- memcpy(dst + bvec->bv_offset, src + offset, bvec->bv_len);
+ memcpy_to_bvec(bvec, src + offset);
kunmap_atomic(src);
- kunmap_atomic(dst);
}
out:
if (is_partial_io(bvec))
--
2.30.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 04/10] zram: use memcpy_from_bvec in zram_bvec_write
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
` (2 preceding siblings ...)
2022-03-03 11:18 ` [PATCH 03/10] zram: use memcpy_to_bvec in zram_bvec_read Christoph Hellwig
@ 2022-03-03 11:18 ` Christoph Hellwig
2022-03-03 11:19 ` [PATCH 05/10] nvdimm-blk: use bvec_kmap_local in nd_blk_rw_integrity Christoph Hellwig
` (5 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:18 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, nvdimm
Use memcpy_from_bvec instead of open coding the logic.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
---
drivers/block/zram/zram_drv.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 14becdf2815df..e9474b02012de 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1465,7 +1465,6 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec,
{
int ret;
struct page *page = NULL;
- void *src;
struct bio_vec vec;
vec = *bvec;
@@ -1483,11 +1482,9 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec,
if (ret)
goto out;
- src = kmap_atomic(bvec->bv_page);
dst = kmap_atomic(page);
- memcpy(dst + offset, src + bvec->bv_offset, bvec->bv_len);
+ memcpy_from_bvec(dst + offset, bvec);
kunmap_atomic(dst);
- kunmap_atomic(src);
vec.bv_page = page;
vec.bv_len = PAGE_SIZE;
--
2.30.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 05/10] nvdimm-blk: use bvec_kmap_local in nd_blk_rw_integrity
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
` (3 preceding siblings ...)
2022-03-03 11:18 ` [PATCH 04/10] zram: use memcpy_from_bvec in zram_bvec_write Christoph Hellwig
@ 2022-03-03 11:19 ` Christoph Hellwig
2022-03-03 11:19 ` [PATCH 06/10] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity Christoph Hellwig
` (4 subsequent siblings)
9 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:19 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, 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>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
---
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 c1db43524d755..0a38738335941 100644
--- a/drivers/nvdimm/blk.c
+++ b/drivers/nvdimm/blk.c
@@ -88,10 +88,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] 18+ messages in thread
* [PATCH 06/10] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
` (4 preceding siblings ...)
2022-03-03 11:19 ` [PATCH 05/10] nvdimm-blk: use bvec_kmap_local in nd_blk_rw_integrity Christoph Hellwig
@ 2022-03-03 11:19 ` Christoph Hellwig
2022-03-04 3:05 ` Ira Weiny
2022-03-03 11:19 ` [PATCH 07/10] bcache: use bvec_kmap_local in bio_csum Christoph Hellwig
` (3 subsequent siblings)
9 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:19 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, 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 cbd994f7f1fe6..9613e54c7a675 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1163,17 +1163,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] 18+ messages in thread
* [PATCH 07/10] bcache: use bvec_kmap_local in bio_csum
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
` (5 preceding siblings ...)
2022-03-03 11:19 ` [PATCH 06/10] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity Christoph Hellwig
@ 2022-03-03 11:19 ` Christoph Hellwig
2022-03-04 3:06 ` Ira Weiny
2022-03-05 14:02 ` Coly Li
2022-03-03 11:19 ` [PATCH 08/10] drbd: use bvec_kmap_local in drbd_csum_bio Christoph Hellwig
` (2 subsequent siblings)
9 siblings, 2 replies; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:19 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, 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/md/bcache/request.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 6869e010475a3..fdd0194f84dd0 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -44,10 +44,10 @@ static void bio_csum(struct bio *bio, struct bkey *k)
uint64_t csum = 0;
bio_for_each_segment(bv, bio, iter) {
- void *d = kmap(bv.bv_page) + bv.bv_offset;
+ void *d = bvec_kmap_local(&bv);
csum = crc64_be(csum, d, bv.bv_len);
- kunmap(bv.bv_page);
+ kunmap_local(d);
}
k->ptr[KEY_PTRS(k)] = csum & (~0ULL >> 1);
--
2.30.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 08/10] drbd: use bvec_kmap_local in drbd_csum_bio
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
` (6 preceding siblings ...)
2022-03-03 11:19 ` [PATCH 07/10] bcache: use bvec_kmap_local in bio_csum Christoph Hellwig
@ 2022-03-03 11:19 ` Christoph Hellwig
2022-03-03 11:19 ` [PATCH 09/10] drbd: use bvec_kmap_local in recv_dless_read Christoph Hellwig
2022-03-03 11:19 ` [PATCH 10/10] floppy: use memcpy_{to,from}_bvec Christoph Hellwig
9 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:19 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, 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>
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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 09/10] drbd: use bvec_kmap_local in recv_dless_read
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
` (7 preceding siblings ...)
2022-03-03 11:19 ` [PATCH 08/10] drbd: use bvec_kmap_local in drbd_csum_bio Christoph Hellwig
@ 2022-03-03 11:19 ` Christoph Hellwig
2022-03-03 11:19 ` [PATCH 10/10] floppy: use memcpy_{to,from}_bvec Christoph Hellwig
9 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:19 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, 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>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
---
drivers/block/drbd/drbd_receiver.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 04e3ec12d8b49..fa00cf2ea9529 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -2017,10 +2017,10 @@ static int recv_dless_read(struct drbd_peer_device *peer_device, struct drbd_req
D_ASSERT(peer_device->device, sector == bio->bi_iter.bi_sector);
bio_for_each_segment(bvec, bio, iter) {
- void *mapped = kmap(bvec.bv_page) + bvec.bv_offset;
+ void *mapped = bvec_kmap_local(&bvec);
expect = min_t(int, data_size, bvec.bv_len);
err = drbd_recv_all_warn(peer_device->connection, mapped, expect);
- kunmap(bvec.bv_page);
+ kunmap_local(mapped);
if (err)
return err;
data_size -= expect;
--
2.30.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 10/10] floppy: use memcpy_{to,from}_bvec
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
` (8 preceding siblings ...)
2022-03-03 11:19 ` [PATCH 09/10] drbd: use bvec_kmap_local in recv_dless_read Christoph Hellwig
@ 2022-03-03 11:19 ` Christoph Hellwig
9 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2022-03-03 11:19 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa, linux-block,
drbd-dev, linux-bcache, nvdimm
Use the helpers instead of open coding them.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
---
drivers/block/floppy.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 19c2d0327e157..8c647532e3ce9 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2485,11 +2485,9 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
}
if (CT(raw_cmd->cmd[COMMAND]) == FD_READ)
- memcpy_to_page(bv.bv_page, bv.bv_offset, dma_buffer,
- size);
+ memcpy_to_bvec(&bv, dma_buffer);
else
- memcpy_from_page(dma_buffer, bv.bv_page, bv.bv_offset,
- size);
+ memcpy_from_bvec(dma_buffer, &bv);
remaining -= size;
dma_buffer += size;
--
2.30.2
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio
2022-03-03 11:18 ` [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio Christoph Hellwig
@ 2022-03-03 14:48 ` Max Filippov
2022-03-04 19:29 ` Jens Axboe
1 sibling, 0 replies; 18+ messages in thread
From: Max Filippov @ 2022-03-03 14:48 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Chris Zankel, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, Ira Weiny,
open list:TENSILICA XTENSA PORT (xtensa),
linux-block, drbd-dev, linux-bcache, nvdimm
On Thu, Mar 3, 2022 at 3:19 AM Christoph Hellwig <hch@lst.de> 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(-)
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 06/10] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity
2022-03-03 11:19 ` [PATCH 06/10] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity Christoph Hellwig
@ 2022-03-04 3:05 ` Ira Weiny
0 siblings, 0 replies; 18+ messages in thread
From: Ira Weiny @ 2022-03-04 3:05 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Chris Zankel, Max Filippov, Justin Sanders,
Philipp Reisner, Lars Ellenberg, Denis Efremov, Minchan Kim,
Nitin Gupta, Coly Li, Dan Williams, Vishal Verma, linux-xtensa,
linux-block, drbd-dev, linux-bcache, nvdimm
On Thu, Mar 03, 2022 at 02:19:01PM +0300, 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/nvdimm/btt.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
> index cbd994f7f1fe6..9613e54c7a675 100644
> --- a/drivers/nvdimm/btt.c
> +++ b/drivers/nvdimm/btt.c
> @@ -1163,17 +1163,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 [flat|nested] 18+ messages in thread
* Re: [PATCH 07/10] bcache: use bvec_kmap_local in bio_csum
2022-03-03 11:19 ` [PATCH 07/10] bcache: use bvec_kmap_local in bio_csum Christoph Hellwig
@ 2022-03-04 3:06 ` Ira Weiny
2022-03-05 14:02 ` Coly Li
1 sibling, 0 replies; 18+ messages in thread
From: Ira Weiny @ 2022-03-04 3:06 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Chris Zankel, Max Filippov, Justin Sanders,
Philipp Reisner, Lars Ellenberg, Denis Efremov, Minchan Kim,
Nitin Gupta, Coly Li, Dan Williams, Vishal Verma, linux-xtensa,
linux-block, drbd-dev, linux-bcache, nvdimm
On Thu, Mar 03, 2022 at 02:19:02PM +0300, 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/md/bcache/request.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 6869e010475a3..fdd0194f84dd0 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -44,10 +44,10 @@ static void bio_csum(struct bio *bio, struct bkey *k)
> uint64_t csum = 0;
>
> bio_for_each_segment(bv, bio, iter) {
> - void *d = kmap(bv.bv_page) + bv.bv_offset;
> + void *d = bvec_kmap_local(&bv);
>
> csum = crc64_be(csum, d, bv.bv_len);
> - kunmap(bv.bv_page);
> + kunmap_local(d);
> }
>
> k->ptr[KEY_PTRS(k)] = csum & (~0ULL >> 1);
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio
2022-03-03 11:18 ` [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio Christoph Hellwig
2022-03-03 14:48 ` Max Filippov
@ 2022-03-04 19:29 ` Jens Axboe
1 sibling, 0 replies; 18+ messages in thread
From: Jens Axboe @ 2022-03-04 19:29 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Justin Sanders, Nitin Gupta, nvdimm, Vishal Verma, linux-bcache,
Ira Weiny, drbd-dev, Philipp Reisner, Minchan Kim, linux-block,
linux-xtensa, Coly Li, Chris Zankel, Max Filippov,
Lars Ellenberg, Denis Efremov, Dan Williams
On Thu, 3 Mar 2022 14:18:56 +0300, Christoph Hellwig wrote:
> Using local kmaps slightly reduces the chances to stray writes, and
> the bvec interface cleans up the code a little bit.
>
>
Applied, thanks!
[01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio
commit: 143a70b8b4300faa92ad82468f65dccd440e7957
[02/10] aoe: use bvec_kmap_local in bvcpy
commit: b7ab4611b6c793100197abc93e069d6f9aab7960
[03/10] zram: use memcpy_to_bvec in zram_bvec_read
commit: b3bd0a8a74ab970cc1cf0849e66bd0906741105b
[04/10] zram: use memcpy_from_bvec in zram_bvec_write
commit: bd3d3203eb84d08a6daef805efe9316b79d3bf3c
[05/10] nvdimm-blk: use bvec_kmap_local in nd_blk_rw_integrity
commit: 20072ec828640b7d23a0cfdbccf0dea48e77ba3e
[06/10] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity
commit: 3205190655ea56ea5e00815eeff4dab2bde0af80
[07/10] bcache: use bvec_kmap_local in bio_csum
commit: 07fee7aba5472d0e65345146a68b4bd1a8b656c3
[08/10] drbd: use bvec_kmap_local in drbd_csum_bio
commit: 472278508dce25316e806e45778658c3e4b353b3
[09/10] drbd: use bvec_kmap_local in recv_dless_read
commit: 3eddaa60b8411c135d1c71090dea9b59ff3f2e26
[10/10] floppy: use memcpy_{to,from}_bvec
commit: 13d4ef0f66b7ee9415e101e213acaf94a0cb28ee
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 07/10] bcache: use bvec_kmap_local in bio_csum
2022-03-03 11:19 ` [PATCH 07/10] bcache: use bvec_kmap_local in bio_csum Christoph Hellwig
2022-03-04 3:06 ` Ira Weiny
@ 2022-03-05 14:02 ` Coly Li
1 sibling, 0 replies; 18+ messages in thread
From: Coly Li @ 2022-03-05 14:02 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Jens Axboe, Minchan Kim,
Nitin Gupta, Dan Williams, Vishal Verma, Ira Weiny, linux-xtensa,
linux-block, drbd-dev, linux-bcache, nvdimm
On 3/3/22 7:19 PM, 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>
Acked-by: Coly Li <colyli@suse.de>
Thanks.
Coly Li
> ---
> drivers/md/bcache/request.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 6869e010475a3..fdd0194f84dd0 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -44,10 +44,10 @@ static void bio_csum(struct bio *bio, struct bkey *k)
> uint64_t csum = 0;
>
> bio_for_each_segment(bv, bio, iter) {
> - void *d = kmap(bv.bv_page) + bv.bv_offset;
> + void *d = bvec_kmap_local(&bv);
>
> csum = crc64_be(csum, d, bv.bv_len);
> - kunmap(bv.bv_page);
> + kunmap_local(d);
> }
>
> k->ptr[KEY_PTRS(k)] = csum & (~0ULL >> 1);
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio
2022-02-22 15:51 ` [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio Christoph Hellwig
@ 2022-03-01 0:30 ` Ira Weiny
0 siblings, 0 replies; 18+ messages in thread
From: Ira Weiny @ 2022-03-01 0:30 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Chris Zankel, Max Filippov, Justin Sanders,
Philipp Reisner, Lars Ellenberg, Denis Efremov, Minchan Kim,
Nitin Gupta, Coly Li, Dan Williams, Vishal Verma, linux-xtensa,
linux-block, drbd-dev, linux-bcache, nvdimm
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
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio
2022-02-22 15:51 remove opencoded kmap of bio_vecs Christoph Hellwig
@ 2022-02-22 15:51 ` Christoph Hellwig
2022-03-01 0:30 ` Ira Weiny
0 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2022-02-22 15:51 UTC (permalink / raw)
To: Jens Axboe
Cc: Chris Zankel, Max Filippov, Justin Sanders, Philipp Reisner,
Lars Ellenberg, Denis Efremov, Minchan Kim, Nitin Gupta, Coly Li,
Dan Williams, Vishal Verma, linux-xtensa, linux-block, drbd-dev,
linux-bcache, 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>
---
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
^ permalink raw reply related [flat|nested] 18+ messages in thread
end of thread, other threads:[~2022-03-05 14:02 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 11:18 remove opencoded kmap of bio_vecs v2 Christoph Hellwig
2022-03-03 11:18 ` [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio Christoph Hellwig
2022-03-03 14:48 ` Max Filippov
2022-03-04 19:29 ` Jens Axboe
2022-03-03 11:18 ` [PATCH 02/10] aoe: use bvec_kmap_local in bvcpy Christoph Hellwig
2022-03-03 11:18 ` [PATCH 03/10] zram: use memcpy_to_bvec in zram_bvec_read Christoph Hellwig
2022-03-03 11:18 ` [PATCH 04/10] zram: use memcpy_from_bvec in zram_bvec_write Christoph Hellwig
2022-03-03 11:19 ` [PATCH 05/10] nvdimm-blk: use bvec_kmap_local in nd_blk_rw_integrity Christoph Hellwig
2022-03-03 11:19 ` [PATCH 06/10] nvdimm-btt: use bvec_kmap_local in btt_rw_integrity Christoph Hellwig
2022-03-04 3:05 ` Ira Weiny
2022-03-03 11:19 ` [PATCH 07/10] bcache: use bvec_kmap_local in bio_csum Christoph Hellwig
2022-03-04 3:06 ` Ira Weiny
2022-03-05 14:02 ` Coly Li
2022-03-03 11:19 ` [PATCH 08/10] drbd: use bvec_kmap_local in drbd_csum_bio Christoph Hellwig
2022-03-03 11:19 ` [PATCH 09/10] drbd: use bvec_kmap_local in recv_dless_read Christoph Hellwig
2022-03-03 11:19 ` [PATCH 10/10] floppy: use memcpy_{to,from}_bvec Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2022-02-22 15:51 remove opencoded kmap of bio_vecs Christoph Hellwig
2022-02-22 15:51 ` [PATCH 01/10] iss-simdisk: use bvec_kmap_local in simdisk_submit_bio Christoph Hellwig
2022-03-01 0:30 ` Ira Weiny
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.