linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] fsck.f2fs: fix __end_block_addr()
@ 2022-10-06 15:16 Chao Yu
  0 siblings, 0 replies; only message in thread
From: Chao Yu @ 2022-10-06 15:16 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel

The calculation is wrong, fix it.

Signed-off-by: Chao Yu <chao@kernel.org>
---
 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
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-06 15:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-06 15:16 [f2fs-dev] [PATCH] fsck.f2fs: fix __end_block_addr() Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).