From: Chao Yu <chao@kernel.org>
To: Sheng Yong <shengyong1@huawei.com>,
jaegeuk@kernel.org, yuchao0@huawei.com
Cc: miaoxie@huawei.com, heyunlei@huawei.com,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [RFC PATCH 3/5] fsck.f2fs: integrate sanity_check_inode to __check_inode_mode
Date: Thu, 8 Feb 2018 21:44:46 +0800 [thread overview]
Message-ID: <5ee01435-23fa-028e-68b8-44964027ff78@kernel.org> (raw)
In-Reply-To: <20180206043125.134191-4-shengyong1@huawei.com>
On 2018/2/6 12:31, Sheng Yong wrote:
> In sanity_check_nid, __check_inode_mode will check i_mode value of an
> inode. So integrate sanity_check_inode to __check_inode_mode to clean
> up the code.
>
> Signed-off-by: Sheng Yong <shengyong1@huawei.com>
> ---
> fsck/fsck.c | 26 +++++---------------------
> 1 file changed, 5 insertions(+), 21 deletions(-)
>
> diff --git a/fsck/fsck.c b/fsck/fsck.c
> index 29823a1..fcaab14 100644
> --- a/fsck/fsck.c
> +++ b/fsck/fsck.c
> @@ -334,6 +334,11 @@ static int __check_inode_mode(u32 nid, enum FILE_TYPE ftype, u32 mode)
> {
> if (ftype >= F2FS_FT_MAX)
> return 0;
> + /* f2fs_iget will return -EIO if mode is not valid file type */
> + if (!S_ISLNK(mode) && !S_ISREG(mode) && !S_ISDIR(mode) &&
> + !S_ISCHR(mode) && !S_ISBLK(mode) && !S_ISFIFO(mode) &&
> + !S_ISSOCK(mode))
Need an extra error message for this case instead of below one.
Thanks,
> + goto err;
> if (S_ISLNK(mode) && ftype != F2FS_FT_SYMLINK)
> goto err;
> if (S_ISREG(mode) && ftype != F2FS_FT_REG_FILE)
> @@ -465,25 +470,6 @@ static int sanity_check_nid(struct f2fs_sb_info *sbi, u32 nid,
> return 0;
> }
>
> -static int sanity_check_inode(struct f2fs_sb_info *sbi, struct f2fs_node *node)
> -{
> - struct f2fs_fsck *fsck = F2FS_FSCK(sbi);
> - struct f2fs_inode *fi = &node->i;
> -
> - if (!(le16_to_cpu(fi->i_mode) & S_IFMT)) {
> - ASSERT_MSG("i_mode is not valid. [0x%x]", le16_to_cpu(fi->i_mode));
> - goto remove_node;
> - }
> -
> - return 0;
> -
> -remove_node:
> - f2fs_set_bit(le32_to_cpu(node->footer.ino), fsck->nat_area_bitmap);
> - fsck->chk.valid_blk_cnt--;
> - fsck->chk.valid_node_cnt--;
> - return -EINVAL;
> -}
> -
> static int fsck_chk_xattr_blk(struct f2fs_sb_info *sbi, u32 ino,
> u32 x_nid, u32 *blk_cnt)
> {
> @@ -528,8 +514,6 @@ int fsck_chk_node_blk(struct f2fs_sb_info *sbi, struct f2fs_inode *inode,
> if (ntype == TYPE_INODE) {
> struct f2fs_fsck *fsck = F2FS_FSCK(sbi);
>
> - if (sanity_check_inode(sbi, node_blk))
> - goto err;
> fsck_chk_inode_blk(sbi, nid, ftype, node_blk, blk_cnt, &ni, child);
> quota_add_inode_usage(fsck->qctx, nid, &node_blk->i);
> } else {
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
next prev parent reply other threads:[~2018-02-08 13:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-06 4:31 [RFC PATCH 0/5] f2fs-tools: introduce lost+found feature Sheng Yong
2018-02-06 4:31 ` [RFC PATCH 1/5] mkfs.f2fs: introduce mkfs parameters in f2fs_configuration Sheng Yong
2018-02-08 13:30 ` Chao Yu
2018-02-09 3:21 ` Sheng Yong
2018-02-09 12:59 ` Chao Yu
2018-02-06 4:31 ` [RFC PATCH 2/5] f2fs-tools: init f2fs_configuration as 0 Sheng Yong
2018-02-08 13:32 ` Chao Yu
2018-02-10 2:49 ` Jaegeuk Kim
2018-02-06 4:31 ` [RFC PATCH 3/5] fsck.f2fs: integrate sanity_check_inode to __check_inode_mode Sheng Yong
2018-02-08 13:44 ` Chao Yu [this message]
2018-02-06 4:31 ` [RFC PATCH 4/5] mkfs.f2fs: create lost+found directory Sheng Yong
2018-02-08 15:08 ` Chao Yu
2018-02-09 3:21 ` Sheng Yong
2018-02-09 13:13 ` Chao Yu
2018-02-06 4:31 ` [RFC PATCH 5/5] fsck.f2fs: reconnect unreachable files to lost+found Sheng Yong
2018-02-07 10:01 ` Sheng Yong
2018-02-07 10:04 ` Sheng Yong
2018-02-13 14:22 ` 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=5ee01435-23fa-028e-68b8-44964027ff78@kernel.org \
--to=chao@kernel.org \
--cc=heyunlei@huawei.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=miaoxie@huawei.com \
--cc=shengyong1@huawei.com \
--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: link
Be 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).