Skip to contentSkip to conversation

f2fs: get victim segment again after new cp

PATCH Superseded Yunlei He 2 participants 2 messages Jul 21, 2016 F2FS file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yunlei He

author
#0 lore raw

PATCH 1/1 f2fs: get victim segment again after new cp

previous segment selected may become free after write_checkpoint, so here, we select victim again.

---
 fs/f2fs/gc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +1 -1
index de6c41c..704e2e1 100644
@@ -914,7 +914,7 @@ gc_more:
 			write_checkpoint(sbi, &cpc);
 	}
 
-	if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
+	if (!__get_victim(sbi, &segno, gc_type) && segno == NULL_SEGNO)
 		goto stop;
 	ret = 0;
 
Signature · 9 lines
1.9.1


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
maintainer
#1 lore raw

Hi Yunlei,

The problem may be the above stale segno.
How about this?

---
 fs/f2fs/gc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/f2fs/gc.c +4 -2
index de6c41c..8a0ed89 100644
@@ -908,10 +908,12 @@ gc_more:
 		 * enough free sections, we should flush dent/node blocks and do
 		 * garbage collections.
 		 */
-		if (__get_victim(sbi, &segno, gc_type) || prefree_segments(sbi))
+		if (__get_victim(sbi, &segno, gc_type) || prefree_segments(sbi)) {
+			segno = NULL_SEGNO;
 			write_checkpoint(sbi, &cpc);
-		else if (has_not_enough_free_secs(sbi, 0))
+		} else if (has_not_enough_free_secs(sbi, 0)) {
 			write_checkpoint(sbi, &cpc);
+		}
 	}
 
 	if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
Signature · 1 line
2.8.3
Quoted 23 lines · Yunlei He

previous segment selected may become free after write_checkpoint, so here, we select victim again.

---
 fs/f2fs/gc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +1 -1
index de6c41c..704e2e1 100644
@@ -914,7 +914,7 @@ gc_more:
 			write_checkpoint(sbi, &cpc);
 	}
 
-	if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
+	if (!__get_victim(sbi, &segno, gc_type) && segno == NULL_SEGNO)
 		goto stop;
 	ret = 0;
 
Signature · 1 line
1.9.1

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev