Skip to contentSkip to conversation

f2fs: fix to correct no_fggc_candidate

PATCH New Chao Yu 1 participant 1 message Oct 17, 2017 F2FS file system

lore
Share & tools
lore

Chao Yu

author maintainer
#0 lore raw

PATCH 1/1 f2fs: fix to correct no_fggc_candidate

From: Chao Yu <[email protected]>

There may be extreme case as below:

For one section contains one segment, and there are total 100 segments with 10% over-privision ratio in f2fs partition, fggc_threshold will be rounded down to 460 instead of 460.8 as below caclulation:

sbi->fggc_threshold = div_u64((u64)(main_count - ovp_count) *

			BLKS_PER_SEC(sbi), (main_count - resv_count));

If section usage is as:

As valid block number in all sections is large than fggc_threshold, so none of them will be chosen as candidate due to incorrect fggc_threshold.

Let's just soften the term of choosing foreground GC candidates.

---
 fs/f2fs/segment.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/segment.h +1 -1
index 5a1f7b9c8a72..8d93652d5b6a 100644
@@ -731,7 +731,7 @@ static inline block_t sum_blk_addr(struct f2fs_sb_info *sbi, int base, int type)
 static inline bool no_fggc_candidate(struct f2fs_sb_info *sbi,
 						unsigned int secno)
 {
-	if (get_valid_blocks(sbi, GET_SEG_FROM_SEC(sbi, secno), true) >=
+	if (get_valid_blocks(sbi, GET_SEG_FROM_SEC(sbi, secno), true) >
 						sbi->fggc_threshold)
 		return true;
 	return false;
Signature · 1 line
2.14.1.145.gb3622a4ee