fsck.f2fs: fix to repair cp_loads blocks at correct position
authorChao Yu <yuchao0@huawei.com>
Sun, 19 May 2019 05:05:52 +0000 (13:05 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 21 May 2019 00:29:50 +0000 (17:29 -0700)
Let's fix the wrong start offset of cp_payload blocks in
fix_checkpoint().

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

index 07657b8..1dd3c01 100644 (file)
@@ -2059,8 +2059,8 @@ static void fix_checkpoint(struct f2fs_sb_info *sbi)
        ASSERT(ret >= 0);
 
        for (i = 0; i < get_sb(cp_payload); i++) {
-               ret = dev_write_block(((unsigned char *)cp) + i * F2FS_BLKSIZE,
-                                                               cp_blk_no++);
+               ret = dev_write_block(((unsigned char *)cp) +
+                                       (i + 1) * F2FS_BLKSIZE, cp_blk_no++);
                ASSERT(ret >= 0);
        }