From: zhaowuyun@wingtech.com To: yuchao0@huawei.com, jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, zhaowuyun@wingtech.com Subject: [PATCH] f2fs-tools: set cold flag for non-dir node Date: Thu, 18 Jun 2020 20:48:07 +0800 [thread overview] Message-ID: <1592484487-12072-1-git-send-email-zhaowuyun@wingtech.com> (raw) From: Wuyun Zhao <zhaowuyun@wingtech.com> Signed-off-by: Wuyun Zhao <zhaowuyun@wingtech.com> --- fsck/dir.c | 1 + fsck/node.c | 1 + fsck/node.h | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/fsck/dir.c b/fsck/dir.c index 5f4f75e..dc03c98 100644 --- a/fsck/dir.c +++ b/fsck/dir.c @@ -522,6 +522,7 @@ static void init_inode_block(struct f2fs_sb_info *sbi, node_blk->footer.nid = cpu_to_le32(de->ino); node_blk->footer.flag = 0; node_blk->footer.cp_ver = ckpt->checkpoint_ver; + set_cold_node(node_blk, S_ISDIR(mode)); if (S_ISDIR(mode)) { make_empty_dir(sbi, node_blk); diff --git a/fsck/node.c b/fsck/node.c index 229a99c..1d291ca 100644 --- a/fsck/node.c +++ b/fsck/node.c @@ -79,6 +79,7 @@ block_t new_node_block(struct f2fs_sb_info *sbi, node_blk->footer.ino = f2fs_inode->footer.ino; node_blk->footer.flag = cpu_to_le32(ofs << OFFSET_BIT_SHIFT); node_blk->footer.cp_ver = ckpt->checkpoint_ver; + set_cold_node(node_blk, S_ISDIR(le16_to_cpu(f2fs_inode->i.i_mode))); type = CURSEG_COLD_NODE; if (IS_DNODE(node_blk)) { diff --git a/fsck/node.h b/fsck/node.h index 6bce1fb..99139b1 100644 --- a/fsck/node.h +++ b/fsck/node.h @@ -161,6 +161,17 @@ static inline int is_node(struct f2fs_node *node_blk, int type) return le32_to_cpu(node_blk->footer.flag) & (1 << type); } +static inline void set_cold_node(struct f2fs_node *rn, bool is_dir) +{ + unsigned int flag = le32_to_cpu(rn->footer.flag); + + if (is_dir) + flag &= ~(0x1 << COLD_BIT_SHIFT); + else + flag |= (0x1 << COLD_BIT_SHIFT); + rn->footer.flag = cpu_to_le32(flag); +} + #define is_fsync_dnode(node_blk) is_node(node_blk, FSYNC_BIT_SHIFT) #define is_dent_dnode(node_blk) is_node(node_blk, DENT_BIT_SHIFT) -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: zhaowuyun--- via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net> To: yuchao0@huawei.com, jaegeuk@kernel.org Cc: zhaowuyun@wingtech.com, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: [f2fs-dev] [PATCH] f2fs-tools: set cold flag for non-dir node Date: Thu, 18 Jun 2020 20:48:07 +0800 [thread overview] Message-ID: <1592484487-12072-1-git-send-email-zhaowuyun@wingtech.com> (raw) From: Wuyun Zhao <zhaowuyun@wingtech.com> Signed-off-by: Wuyun Zhao <zhaowuyun@wingtech.com> --- fsck/dir.c | 1 + fsck/node.c | 1 + fsck/node.h | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/fsck/dir.c b/fsck/dir.c index 5f4f75e..dc03c98 100644 --- a/fsck/dir.c +++ b/fsck/dir.c @@ -522,6 +522,7 @@ static void init_inode_block(struct f2fs_sb_info *sbi, node_blk->footer.nid = cpu_to_le32(de->ino); node_blk->footer.flag = 0; node_blk->footer.cp_ver = ckpt->checkpoint_ver; + set_cold_node(node_blk, S_ISDIR(mode)); if (S_ISDIR(mode)) { make_empty_dir(sbi, node_blk); diff --git a/fsck/node.c b/fsck/node.c index 229a99c..1d291ca 100644 --- a/fsck/node.c +++ b/fsck/node.c @@ -79,6 +79,7 @@ block_t new_node_block(struct f2fs_sb_info *sbi, node_blk->footer.ino = f2fs_inode->footer.ino; node_blk->footer.flag = cpu_to_le32(ofs << OFFSET_BIT_SHIFT); node_blk->footer.cp_ver = ckpt->checkpoint_ver; + set_cold_node(node_blk, S_ISDIR(le16_to_cpu(f2fs_inode->i.i_mode))); type = CURSEG_COLD_NODE; if (IS_DNODE(node_blk)) { diff --git a/fsck/node.h b/fsck/node.h index 6bce1fb..99139b1 100644 --- a/fsck/node.h +++ b/fsck/node.h @@ -161,6 +161,17 @@ static inline int is_node(struct f2fs_node *node_blk, int type) return le32_to_cpu(node_blk->footer.flag) & (1 << type); } +static inline void set_cold_node(struct f2fs_node *rn, bool is_dir) +{ + unsigned int flag = le32_to_cpu(rn->footer.flag); + + if (is_dir) + flag &= ~(0x1 << COLD_BIT_SHIFT); + else + flag |= (0x1 << COLD_BIT_SHIFT); + rn->footer.flag = cpu_to_le32(flag); +} + #define is_fsync_dnode(node_blk) is_node(node_blk, FSYNC_BIT_SHIFT) #define is_dent_dnode(node_blk) is_node(node_blk, DENT_BIT_SHIFT) -- 2.7.4 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next reply other threads:[~2020-06-18 12:48 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-18 12:48 zhaowuyun [this message] 2020-06-18 12:48 ` [f2fs-dev] [PATCH] f2fs-tools: set cold flag for non-dir node zhaowuyun--- via Linux-f2fs-devel 2020-06-19 1:31 ` Chao Yu 2020-06-19 1:31 ` [f2fs-dev] " Chao Yu 2020-06-19 2:21 ` 回复: " Zac 2020-06-19 2:21 ` [f2fs-dev] " Zac via Linux-f2fs-devel 2020-06-19 2:48 ` Chao Yu 2020-06-19 2:48 ` [f2fs-dev] " 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=1592484487-12072-1-git-send-email-zhaowuyun@wingtech.com \ --to=zhaowuyun@wingtech.com \ --cc=jaegeuk@kernel.org \ --cc=linux-f2fs-devel@lists.sourceforge.net \ --cc=linux-kernel@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 an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.