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 <shengyo...@huawei.com>
---
 fsck/mount.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fsck/mount.c b/fsck/mount.c
index 6482721..b8e7643 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -1600,7 +1600,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);
-- 
2.14.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to