Commit f97a11c8 authored by Zijie Wang's avatar Zijie Wang Committed by Jaegeuk Kim

f2fs: use f2fs_get_node_page when write inline data

We just need inode page when write inline data, use
f2fs_get_node_page() to get it instead of using dnode_of_data,
which can eliminate unnecessary struct use.
Signed-off-by: default avatarZijie Wang <wangzijie1@honor.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 6f092b55
...@@ -262,33 +262,32 @@ int f2fs_convert_inline_inode(struct inode *inode) ...@@ -262,33 +262,32 @@ int f2fs_convert_inline_inode(struct inode *inode)
int f2fs_write_inline_data(struct inode *inode, struct page *page) int f2fs_write_inline_data(struct inode *inode, struct page *page)
{ {
struct dnode_of_data dn; struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
int err; struct page *ipage;
set_new_dnode(&dn, inode, NULL, NULL, 0); ipage = f2fs_get_node_page(sbi, inode->i_ino);
err = f2fs_get_dnode_of_data(&dn, 0, LOOKUP_NODE); if (IS_ERR(ipage))
if (err) return PTR_ERR(ipage);
return err;
if (!f2fs_has_inline_data(inode)) { if (!f2fs_has_inline_data(inode)) {
f2fs_put_dnode(&dn); f2fs_put_page(ipage, 1);
return -EAGAIN; return -EAGAIN;
} }
f2fs_bug_on(F2FS_I_SB(inode), page->index); f2fs_bug_on(F2FS_I_SB(inode), page->index);
f2fs_wait_on_page_writeback(dn.inode_page, NODE, true, true); f2fs_wait_on_page_writeback(ipage, NODE, true, true);
memcpy_from_page(inline_data_addr(inode, dn.inode_page), memcpy_from_page(inline_data_addr(inode, ipage),
page, 0, MAX_INLINE_DATA(inode)); page, 0, MAX_INLINE_DATA(inode));
set_page_dirty(dn.inode_page); set_page_dirty(ipage);
f2fs_clear_page_cache_dirty_tag(page); f2fs_clear_page_cache_dirty_tag(page);
set_inode_flag(inode, FI_APPEND_WRITE); set_inode_flag(inode, FI_APPEND_WRITE);
set_inode_flag(inode, FI_DATA_EXIST); set_inode_flag(inode, FI_DATA_EXIST);
clear_page_private_inline(dn.inode_page); clear_page_private_inline(ipage);
f2fs_put_dnode(&dn); f2fs_put_page(ipage, 1);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment