If i_links is wrong, we should not check block count, since it doesn't count correctly which results in changing the block count to 1.
This patch fixes that. Signed-off-by: Jaegeuk Kim <jaeg...@kernel.org> --- fsck/fsck.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 8cfea56..97bf6ce 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -440,7 +440,7 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid, "i_links= 0x%x -> 0x%x", nid, i_links, i_links + 1); } - goto check; + goto skip_blkcnt_fix; } /* No need to go deep into the node */ return; @@ -550,6 +550,18 @@ void fsck_chk_inode_blk(struct f2fs_sb_info *sbi, u32 nid, } } check: + if (i_blocks != *blk_cnt) { + ASSERT_MSG("ino: 0x%x has i_blocks: %08"PRIx64", " + "but has %u blocks", + nid, i_blocks, *blk_cnt); + if (config.fix_on) { + node_blk->i.i_blocks = cpu_to_le64(*blk_cnt); + need_fix = 1; + FIX_MSG("[0x%x] i_blocks=0x%08"PRIx64" -> 0x%x", + nid, i_blocks, *blk_cnt); + } + } +skip_blkcnt_fix: if (ftype == F2FS_FT_DIR) DBG(1, "Directory Inode: 0x%x [%s] depth: %d has %d files\n\n", le32_to_cpu(node_blk->footer.ino), @@ -562,17 +574,6 @@ check: node_blk->i.i_name, (u32)i_blocks); - if (i_blocks != *blk_cnt) { - ASSERT_MSG("ino: 0x%x has i_blocks: %08"PRIx64", " - "but has %u blocks", - nid, i_blocks, *blk_cnt); - if (config.fix_on) { - node_blk->i.i_blocks = cpu_to_le64(*blk_cnt); - need_fix = 1; - FIX_MSG("[0x%x] i_blocks=0x%08"PRIx64" -> 0x%x", - nid, i_blocks, *blk_cnt); - } - } if (ftype == F2FS_FT_DIR && i_links != child_cnt) { ASSERT_MSG("ino: 0x%x has i_links: %u but real links: %u", nid, i_links, child_cnt); -- 2.1.1 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel