2020-11-24 06:11:01

by Ira Weiny

[permalink] [raw]
Subject: [PATCH 12/17] fs/cramfs: Use memcpy_from_page()

From: Ira Weiny <[email protected]>

Remove open coded kmap/memcpy/kunmap and use mempcy_from_page() instead.

Cc: Nicolas Pitre <[email protected]>
Signed-off-by: Ira Weiny <[email protected]>
---
fs/cramfs/inode.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 4b90cfd1ec36..996a3a32a01f 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -247,8 +247,7 @@ static void *cramfs_blkdev_read(struct super_block *sb, unsigned int offset,
struct page *page = pages[i];

if (page) {
- memcpy(data, kmap(page), PAGE_SIZE);
- kunmap(page);
+ memcpy_from_page(data, page, 0, PAGE_SIZE);
put_page(page);
} else
memset(data, 0, PAGE_SIZE);
--
2.28.0.rc0.12.gb6a658bd00c9


2020-11-24 23:20:31

by Nicolas Pitre

[permalink] [raw]
Subject: Re: [PATCH 12/17] fs/cramfs: Use memcpy_from_page()

On Mon, 23 Nov 2020, [email protected] wrote:

> From: Ira Weiny <[email protected]>
>
> Remove open coded kmap/memcpy/kunmap and use mempcy_from_page() instead.
>
> Cc: Nicolas Pitre <[email protected]>
> Signed-off-by: Ira Weiny <[email protected]>

Acked-by: Nicolas Pitre <[email protected]>


> ---
> fs/cramfs/inode.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
> index 4b90cfd1ec36..996a3a32a01f 100644
> --- a/fs/cramfs/inode.c
> +++ b/fs/cramfs/inode.c
> @@ -247,8 +247,7 @@ static void *cramfs_blkdev_read(struct super_block *sb, unsigned int offset,
> struct page *page = pages[i];
>
> if (page) {
> - memcpy(data, kmap(page), PAGE_SIZE);
> - kunmap(page);
> + memcpy_from_page(data, page, 0, PAGE_SIZE);
> put_page(page);
> } else
> memset(data, 0, PAGE_SIZE);
> --
> 2.28.0.rc0.12.gb6a658bd00c9
>
>