Skip to contentSkip to conversation

fsck.f2fs: avoid wrong IS_VALID_BLK_ADDR

PATCH In review Jaegeuk Kim 2 participants 2 messages Dec 28, 2017 – Dec 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsck.f2fs: avoid wrong IS_VALID_BLK_ADDR

This patch avoids to check next free block offset in current segments, since we are using IS_VALID_BLK_ADDR during fsck which is able to be valid for a while. Let's just check this at the end of fsck.

---
 fsck/f2fs.h | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
fsck/f2fs.h +1 -10
index 34b2481..b7b6305 100644
@@ -369,21 +369,12 @@ static inline bool IS_VALID_NID(struct f2fs_sb_info *sbi, u32 nid)
 
 static inline bool IS_VALID_BLK_ADDR(struct f2fs_sb_info *sbi, u32 addr)
 {
-	int i;
-
 	if (addr >= le64_to_cpu(F2FS_RAW_SUPER(sbi)->block_count) ||
 				addr < SM_I(sbi)->main_blkaddr) {
 		DBG(1, "block addr [0x%x]\n", addr);
 		return 0;
 	}
-
-	for (i = 0; i < NO_CHECK_TYPE; i++) {
-		struct curseg_info *curseg = CURSEG_I(sbi, i);
-
-		if (START_BLOCK(sbi, curseg->segno) +
-					curseg->next_blkoff == addr)
-			return 0;
-	}
+	/* next block offset will be checked at the end of fsck. */
 	return 1;
 }
 
Signature · 6 lines
2.15.0.531.g2ccb3012c9-goog


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jaegeuk Kim

This patch avoids to check next free block offset in current segments, since we are using IS_VALID_BLK_ADDR during fsck which is able to be valid for a while. Let's just check this at the end of fsck.

Thanks,

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot