LKML Archive on lore.kernel.org help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org> To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Chao Yu <yuchao0@huawei.com>, stable@vger.kernel.org, Jaegeuk Kim <jaegeuk@kernel.org> Subject: [PATCH] f2fs: don't use GFP_ZERO for page caches Date: Mon, 9 Apr 2018 12:00:12 -0700 [thread overview] Message-ID: <20180409190012.21552-1-jaegeuk@kernel.org> (raw) From: Chao Yu <yuchao0@huawei.com> Related to https://lkml.org/lkml/2018/4/8/661 Sometimes, we need to write meta data to new allocated block address, then we will allocate a zeroed page in inner inode's address space, and fill partial data in it, and leave other place with zero value which means some fields are initial status. There are two inner inodes (meta inode and node inode) setting __GFP_ZERO, I have just checked them, for both of them, we can avoid using __GFP_ZERO, and do initialization by ourselves to avoid unneeded/redundant zeroing from mm. Cc: <stable@vger.kernel.org> Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- fs/f2fs/inode.c | 4 ++-- fs/f2fs/node.c | 6 ++++-- fs/f2fs/node.h | 7 ++----- fs/f2fs/recovery.c | 3 +-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 417c9dcd0269..87535bf63421 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -320,10 +320,10 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino) make_now: if (ino == F2FS_NODE_INO(sbi)) { inode->i_mapping->a_ops = &f2fs_node_aops; - mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_ZERO); + mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); } else if (ino == F2FS_META_INO(sbi)) { inode->i_mapping->a_ops = &f2fs_meta_aops; - mapping_set_gfp_mask(inode->i_mapping, GFP_F2FS_ZERO); + mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS); } else if (S_ISREG(inode->i_mode)) { inode->i_op = &f2fs_file_inode_operations; inode->i_fop = &f2fs_file_operations; diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 9a99243054ba..6fc3311820ec 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1096,7 +1096,8 @@ struct page *new_node_page(struct dnode_of_data *dn, unsigned int ofs) set_node_addr(sbi, &new_ni, NEW_ADDR, false); f2fs_wait_on_page_writeback(page, NODE, true); - fill_node_footer(page, dn->nid, dn->inode->i_ino, ofs, true); + memset(F2FS_NODE(page), 0, PAGE_SIZE); + fill_node_footer(page, dn->nid, dn->inode->i_ino, ofs); set_cold_node(page, S_ISDIR(dn->inode->i_mode)); if (!PageUptodate(page)) SetPageUptodate(page); @@ -2311,7 +2312,8 @@ int recover_inode_page(struct f2fs_sb_info *sbi, struct page *page) if (!PageUptodate(ipage)) SetPageUptodate(ipage); - fill_node_footer(ipage, ino, ino, 0, true); + memset(F2FS_NODE(page), 0, PAGE_SIZE); + fill_node_footer(ipage, ino, ino, 0); set_cold_node(page, false); src = F2FS_INODE(page); diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h index b95e49e4a928..42cd081114ab 100644 --- a/fs/f2fs/node.h +++ b/fs/f2fs/node.h @@ -263,15 +263,12 @@ static inline block_t next_blkaddr_of_node(struct page *node_page) } static inline void fill_node_footer(struct page *page, nid_t nid, - nid_t ino, unsigned int ofs, bool reset) + nid_t ino, unsigned int ofs) { struct f2fs_node *rn = F2FS_NODE(page); unsigned int old_flag = 0; - if (reset) - memset(rn, 0, sizeof(*rn)); - else - old_flag = le32_to_cpu(rn->footer.flag); + old_flag = le32_to_cpu(rn->footer.flag); rn->footer.nid = cpu_to_le32(nid); rn->footer.ino = cpu_to_le32(ino); diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index 1b23d3febe4c..de24f3247aa5 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -540,8 +540,7 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, } copy_node_footer(dn.node_page, page); - fill_node_footer(dn.node_page, dn.nid, ni.ino, - ofs_of_node(page), false); + fill_node_footer(dn.node_page, dn.nid, ni.ino, ofs_of_node(page)); set_page_dirty(dn.node_page); err: f2fs_put_dnode(&dn); -- 2.15.0.531.g2ccb3012c9-goog
next reply other threads:[~2018-04-09 19:00 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-09 19:00 Jaegeuk Kim [this message] 2018-04-09 19:03 ` [PATCH] f2fs: don't use GFP_ZERO for page caches Jaegeuk Kim 2018-04-09 20:42 ` [PATCH v2] " Jaegeuk Kim 2018-04-10 1:35 ` [f2fs-dev] " Jaegeuk Kim 2018-04-10 1:47 ` Chao Yu 2018-04-10 3:29 ` [f2fs-dev] [PATCH v3] " Jaegeuk Kim 2018-04-10 6:33 ` Chao Yu 2018-04-10 6:40 ` Jaegeuk Kim 2018-04-10 7:27 ` Chao Yu 2018-04-10 3:32 ` [PATCH] " Chao Yu 2018-04-10 3:50 ` Jaegeuk Kim 2018-04-10 6:36 ` Chao Yu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180409190012.21552-1-jaegeuk@kernel.org \ --to=jaegeuk@kernel.org \ --cc=linux-f2fs-devel@lists.sourceforge.net \ --cc=linux-kernel@vger.kernel.org \ --cc=stable@vger.kernel.org \ --cc=yuchao0@huawei.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).