[PATCH 1/2] f2fs: allow to recover node blocks given updated checkpoint

From: Jaegeuk Kim
Date: Fri Jan 19 2018 - 23:27:57 EST


If fsck.f2fs changes crc, we have no way to recover some inode blocks by roll-
forward recovery. Let's relax the condition to recover them.

Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>
---
fs/f2fs/node.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/node.h b/fs/f2fs/node.h
index 0ee3e5ff49a3..15280eeb24ea 100644
--- a/fs/f2fs/node.h
+++ b/fs/f2fs/node.h
@@ -305,10 +305,11 @@ static inline bool is_recoverable_dnode(struct page *page)
struct f2fs_checkpoint *ckpt = F2FS_CKPT(F2FS_P_SB(page));
__u64 cp_ver = cur_cp_version(ckpt);

- if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG))
+ if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG)) {
cp_ver |= (cur_cp_crc(ckpt) << 32);
-
- return cp_ver == cpver_of_node(page);
+ return cp_ver == cpver_of_node(page);
+ }
+ return (cp_ver << 32) == (cpver_of_node(page) << 32);
}

/*
--
2.15.0.531.g2ccb3012c9-goog