summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/verity.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2022-08-19 15:33:00 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2022-08-29 21:15:51 -0700
commitb87846bd61c7c09560617da416208a5454530d57 (patch)
treee694fdbe8e363abbccaffb0a8b255e42eefe085c /fs/f2fs/verity.c
parent605b0a778aa2599aa902ae639b8e9937c74b869b (diff)
downloadlinux-stable-b87846bd61c7c09560617da416208a5454530d57.tar.gz
linux-stable-b87846bd61c7c09560617da416208a5454530d57.tar.bz2
linux-stable-b87846bd61c7c09560617da416208a5454530d57.zip
f2fs: use memcpy_{to,from}_page() where possible
This is simpler, and as a side effect it replaces several uses of kmap_atomic() with its recommended replacement kmap_local_page(). Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/verity.c')
-rw-r--r--fs/f2fs/verity.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c
index 7b8f2b41c29b..97ec60f39d69 100644
--- a/fs/f2fs/verity.c
+++ b/fs/f2fs/verity.c
@@ -47,16 +47,13 @@ static int pagecache_read(struct inode *inode, void *buf, size_t count,
size_t n = min_t(size_t, count,
PAGE_SIZE - offset_in_page(pos));
struct page *page;
- void *addr;
page = read_mapping_page(inode->i_mapping, pos >> PAGE_SHIFT,
NULL);
if (IS_ERR(page))
return PTR_ERR(page);
- addr = kmap_atomic(page);
- memcpy(buf, addr + offset_in_page(pos), n);
- kunmap_atomic(addr);
+ memcpy_from_page(buf, page, offset_in_page(pos), n);
put_page(page);
@@ -85,16 +82,13 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count,
PAGE_SIZE - offset_in_page(pos));
struct page *page;
void *fsdata;
- void *addr;
int res;
res = aops->write_begin(NULL, mapping, pos, n, &page, &fsdata);
if (res)
return res;
- addr = kmap_atomic(page);
- memcpy(addr + offset_in_page(pos), buf, n);
- kunmap_atomic(addr);
+ memcpy_to_page(page, offset_in_page(pos), buf, n);
res = aops->write_end(NULL, mapping, pos, n, n, page, fsdata);
if (res < 0)