f2fs-tools: allow unfixed f2fs_checkpoint.checksum_offset
authorChao Yu <yuchao0@huawei.com>
Tue, 14 May 2019 09:33:39 +0000 (17:33 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 21 May 2019 00:29:55 +0000 (17:29 -0700)
commit24dec562aec0e4e4e8769c3a8126d89d970677cb
tree13dc5261a895e45b4727a54df64eeddeb9c95a6d
parent90648a47e26fb1b43b3ba88eebf8547289674781
f2fs-tools: allow unfixed f2fs_checkpoint.checksum_offset

Previously, f2fs_checkpoint.checksum_offset points fixed position of
f2fs_checkpoint structure:

"#define CP_CHKSUM_OFFSET 4092"

It is unnecessary, and it breaks the consecutiveness of nat and sit
bitmap stored across checkpoint park block and payload blocks.

This patch allows f2fs-tools to handle unfixed .checksum_offset.

In addition, for the case checksum value is stored in the middle of
checkpoint park, calculating checksum value with superposition method
like we did for inode_checksum.

In addition, add below change:
- using MAX_BITMAP_SIZE_IN_CKPT to clean up codes.
- introduce verify_checksum_chksum() to verify chksum_{offset,value}

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck/fsck.c
fsck/mount.c
fsck/resize.c
include/f2fs_fs.h
lib/libf2fs.c
mkfs/f2fs_format.c