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

From: Chao Yu
Date: Sat Jan 20 2018 - 04:33:59 EST


On 2018/1/20 12:26, Jaegeuk Kim wrote:
> 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.

As this is fsck case only, what about writing checkpoint with special flag
for such case, and relax the condition if flag was set, so, for normal case,
it can avoid recovering obsolete data.

Thanks,

>
> 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);
> }
>
> /*
>