Skip to contentSkip to conversation

f2fs: fix the wrong stat count of calling gc

PATCH In review Chao Yu 1 participant 1 message Feb 22, 2016 F2FS file system

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/5 f2fs: fix the wrong stat count of calling gc

With a partition which was formated as multi segments in one section, we stated incorrectly for count of gc operation.

e.g., for a partition with segs_per_sec = 4

cat /sys/kernel/debug/f2fs/status

GC calls: 208 (BG: 7)
- data segments : 104 (52)
- node segments : 104 (24)

GC called count should be (104 (data segs) + 104 (node segs)) / 4 = 52, rather than 208. Fix it.

---
 fs/f2fs/gc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +3 -1
index 47ade35..6b2d704 100644
@@ -816,7 +816,6 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
 								gc_type);
 
 		stat_inc_seg_count(sbi, type, gc_type);
-		stat_inc_call_count(sbi->stat_info);
 
 		f2fs_put_page(sum_page, 0);
 	}
@@ -841,6 +840,9 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi,
 			if (get_valid_blocks(sbi, start_segno++, 1) == 0)
 				seg_freed++;
 	}
+
+	stat_inc_call_count(sbi->stat_info);
+
 	return seg_freed;
 }
 
Signature · 1 line
2.7.0