summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/aops.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2023-06-27 15:34:36 +0200
committerAndreas Gruenbacher <agruenba@redhat.com>2023-07-03 22:30:48 +0200
commitd68d0c6c3fc781c8a130e6a4d0666dbbd69e917b (patch)
treef284d052d5c95e8dba1399f94db1283fcface860 /fs/gfs2/aops.c
parentgfs2: Convert remaining kmap_atomic calls to kmap_local_page (diff)
downloadlinux-d68d0c6c3fc781c8a130e6a4d0666dbbd69e917b.tar.xz
linux-d68d0c6c3fc781c8a130e6a4d0666dbbd69e917b.zip
gfs2: Use memcpy_{from,to}_page where appropriate
Replace kmap_local_page() + memcpy() + kunmap_local() sequences with memcpy_{from,to}_page() where we are not doing anything else with the mapped page. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Diffstat (limited to 'fs/gfs2/aops.c')
-rw-r--r--fs/gfs2/aops.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index c45bac9b5408..b11ec198183b 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -488,7 +488,6 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos,
unsigned copied = 0;
unsigned amt;
struct page *page;
- void *p;
do {
page = read_cache_page(mapping, index, gfs2_read_folio, NULL);
@@ -497,12 +496,10 @@ int gfs2_internal_read(struct gfs2_inode *ip, char *buf, loff_t *pos,
continue;
return PTR_ERR(page);
}
- p = kmap_local_page(page);
amt = size - copied;
if (offset + size > PAGE_SIZE)
amt = PAGE_SIZE - offset;
- memcpy(buf + copied, p + offset, amt);
- kunmap_local(p);
+ memcpy_from_page(buf + copied, page, offset, amt);
put_page(page);
copied += amt;
index++;