The calculation is wrong, fix it.

Signed-off-by: Chao Yu <[email protected]>
---
 fsck/f2fs.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fsck/f2fs.h b/fsck/f2fs.h
index 030d750..2fd241f 100644
--- a/fsck/f2fs.h
+++ b/fsck/f2fs.h
@@ -416,8 +416,9 @@ static inline block_t __start_sum_addr(struct f2fs_sb_info 
*sbi)
 
 static inline block_t __end_block_addr(struct f2fs_sb_info *sbi)
 {
-       block_t end = SM_I(sbi)->main_blkaddr;
-       return end + le64_to_cpu(F2FS_RAW_SUPER(sbi)->block_count);
+       return SM_I(sbi)->main_blkaddr +
+               (le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment_count_main) <<
+               sbi->log_blocks_per_seg);
 }
 
 #define GET_ZONENO_FROM_SEGNO(sbi, segno)                               \
-- 
2.36.1



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to