fsck.f2fs: read nat block if nat entry is invalid
authorSheng Yong <shengyong1@huawei.com>
Fri, 23 Feb 2018 03:18:00 +0000 (11:18 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 7 May 2018 21:49:38 +0000 (14:49 -0700)
fsck will cache all valid nat entries in memory. But when we try to
get a nat entry which is not cached, for example allocate a new nid
during reconnecting files, we need to read the uncached nat entry
from nat block again.

Signed-off-by: Sheng Yong <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck/mount.c

index 19853e3..ab60a9b 100644 (file)
@@ -1610,7 +1610,9 @@ void get_node_info(struct f2fs_sb_info *sbi, nid_t nid, struct node_info *ni)
        ni->nid = nid;
        if (c.func == FSCK) {
                node_info_from_raw_nat(ni, &(F2FS_FSCK(sbi)->entries[nid]));
-               return;
+               if (ni->blk_addr)
+                       return;
+               /* nat entry is not cached, read it */
        }
 
        get_nat_entry(sbi, nid, &raw_nat);