From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:01:01
Hi all,
this series switches the core block layer code and all users of the
existing bvec kmap helpers to use kmap_local_page. Drivers that
currently use open coded kmap_atomic calls will converted in a follow
on series.
To do so a new kunmap variant is added that calls
flush_kernel_dcache_page. I'm not entirely sure where to call
flush_dcache_page vs flush_kernel_dcache_page, so I've tried to follow
the documentation here, but additional feedback would be welcome.
Note that the ps3disk has a minir conflict with the
flush_kernel_dcache_page removal in linux-next through the -mm tree.
I had hoped that change would go into 5.14, but it seems like it is
being held for 5.15.
Changes since v2:
- rely on the flush_dcache_helpers in memcpy_to_page and memzero_page
that now hit mainline
Changes since v1:
- add more/better comments
- add a new kunmap_local_dirty helper to feal with
flush(_kernel)_dcache_page
Diffstat:
arch/mips/include/asm/mach-rc32434/rb.h | 2 -
block/bio-integrity.c | 14 +++-----
block/bio.c | 37 ++++++----------------
block/blk-map.c | 2 -
block/bounce.c | 39 +++++-------------------
block/t10-pi.c | 16 +++------
drivers/block/ps3disk.c | 19 +----------
drivers/block/rbd.c | 15 +--------
drivers/md/dm-writecache.c | 5 +--
include/linux/bio.h | 42 -------------------------
include/linux/bvec.h | 52 ++++++++++++++++++++++++++++++--
include/linux/highmem-internal.h | 7 ++++
include/linux/highmem.h | 10 ++++--
13 files changed, 102 insertions(+), 158 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:03:14
There is no need to include genhd.h from a random arch header, and not
doing so prevents the possibility for nasty include loops.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Ira Weiny <redacted>
---
arch/mips/include/asm/mach-rc32434/rb.h | 2 --
1 file changed, 2 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:03:45
Fix the include guards to match the file naming.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Ira Weiny <redacted>
---
include/linux/bvec.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:04:38
Add a helper to call kmap_local_page on a bvec. There is no need for
an unmap helper given that kunmap_local accept any address in the mapped
page.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Ira Weiny <redacted>
---
include/linux/bvec.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:06:50
Add helpers to perform common memory operation on a bvec.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Ira Weiny <redacted>
---
include/linux/bvec.h | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:07:47
Use memzero_bvec to zero each segment in the bio instead of manually
mapping and zeroing the data.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Ira Weiny <redacted>
---
block/bio.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:09:08
Use memzero_bvec instead of reimplementing it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Ira Weiny <redacted>
---
drivers/block/rbd.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:11:00
There is no need to disable interrupts in bio_copy_block, and the local
only mappings helps to avoid any sort of problems with stray writes
into the bio data.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Ira Weiny <redacted>
---
drivers/md/dm-writecache.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:12:34
Use the bvec helpers instead of open coding the copy.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Tested-by: Geoff Levand <geoff@infradead.org>
---
drivers/block/ps3disk.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:14:43
These two helpers are entirely unused now.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
include/linux/bio.h | 42 ------------------------------------------
1 file changed, 42 deletions(-)
@@ -5,7 +5,6 @@#ifndef __LINUX_BIO_H#define __LINUX_BIO_H-#include<linux/highmem.h>#include<linux/mempool.h>#include<linux/ioprio.h>/* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:16:38
Use the proper helpers instead of open coding the copy.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
block/bio.c | 28 ++++++++--------------------
1 file changed, 8 insertions(+), 20 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:18:44
Use memcpy_to_bvec instead of opencoding the logic.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
block/bounce.c | 20 ++------------------
1 file changed, 2 insertions(+), 18 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:20:11
Use memcpy_from_bvec instead of open coding the logic.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
block/blk-map.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:21:29
Rewrite the actual bounce buffering loop in __blk_queue_bounce to that
the memcpy_to_bvec helper can be used to perform the data copies.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
block/bounce.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:23:36
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: Martin K. Petersen <martin.petersen@oracle.com>
---
block/t10-pi.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
From: Christoph Hellwig <hch@lst.de> Date: 2021-07-27 06:25:17
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: Martin K. Petersen <martin.petersen@oracle.com>
---
block/bio-integrity.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
Hi all,
this series switches the core block layer code and all users of the
existing bvec kmap helpers to use kmap_local_page. Drivers that
currently use open coded kmap_atomic calls will converted in a follow
on series.
To do so a new kunmap variant is added that calls
flush_kernel_dcache_page. I'm not entirely sure where to call
flush_dcache_page vs flush_kernel_dcache_page, so I've tried to follow
the documentation here, but additional feedback would be welcome.
Note that the ps3disk has a minir conflict with the
flush_kernel_dcache_page removal in linux-next through the -mm tree.
I had hoped that change would go into 5.14, but it seems like it is
being held for 5.15.