inode.i_blocks includes inode, xnode and data block count, so, only fix in below condition: - i_blocks := 3 (inode + xnode + data_block) - i_blocks := 2 (inode + data_block)
In addition, it recovers symlink's i_size to 4k rather than i_blocks * 4k. Signed-off-by: Chao Yu <yuch...@huawei.com> --- fsck/fsck.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fsck/fsck.c b/fsck/fsck.c index 1ea8590..61d1a8d 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -1027,16 +1027,15 @@ skip_blkcnt_fix: free(en); - if (ftype == F2FS_FT_SYMLINK && i_blocks && i_size == 0) { + if (ftype == F2FS_FT_SYMLINK && i_size == 0 && + i_blocks == (i_xattr_nid ? 3 : 2)) { ASSERT_MSG("ino: 0x%x i_blocks: %lu with zero i_size\n", nid, (unsigned long)i_blocks); if (c.fix_on) { - u64 i_size = i_blocks * F2FS_BLKSIZE; - - node_blk->i.i_size = cpu_to_le64(i_size); + node_blk->i.i_size = cpu_to_le64(F2FS_BLKSIZE); need_fix = 1; FIX_MSG("Symlink: recover 0x%x with i_size=%lu", - nid, (unsigned long)i_size); + nid, (unsigned long)F2FS_BLKSIZE); } } -- 2.18.0.rc1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel