mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
ocfs2: use a folio in ocfs2_fast_symlink_read_folio()
Use folio_end_read() instead of SetPageUptodate() and unlock_page(). Use memcpy_to_folio() instead of open-coding a kmap_atomic() sequence. Link: https://lkml.kernel.org/r/20241205171653.3179945-21-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Joel Becker <jlbec@evilplan.org> Cc: Jun Piao <piaojun@huawei.com> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Mark Fasheh <mark@fasheh.com> Cc: Mark Tinguely <mark.tinguely@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
c55caf3cad
commit
81f09ef4c7
@ -54,13 +54,11 @@
|
||||
|
||||
static int ocfs2_fast_symlink_read_folio(struct file *f, struct folio *folio)
|
||||
{
|
||||
struct page *page = &folio->page;
|
||||
struct inode *inode = page->mapping->host;
|
||||
struct inode *inode = folio->mapping->host;
|
||||
struct buffer_head *bh = NULL;
|
||||
int status = ocfs2_read_inode_block(inode, &bh);
|
||||
struct ocfs2_dinode *fe;
|
||||
const char *link;
|
||||
void *kaddr;
|
||||
size_t len;
|
||||
|
||||
if (status < 0) {
|
||||
@ -72,12 +70,9 @@ static int ocfs2_fast_symlink_read_folio(struct file *f, struct folio *folio)
|
||||
link = (char *) fe->id2.i_symlink;
|
||||
/* will be less than a page size */
|
||||
len = strnlen(link, ocfs2_fast_symlink_chars(inode->i_sb));
|
||||
kaddr = kmap_atomic(page);
|
||||
memcpy(kaddr, link, len + 1);
|
||||
kunmap_atomic(kaddr);
|
||||
SetPageUptodate(page);
|
||||
memcpy_to_folio(folio, 0, link, len + 1);
|
||||
out:
|
||||
unlock_page(page);
|
||||
folio_end_read(folio, status == 0);
|
||||
brelse(bh);
|
||||
return status;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user