Skip to contentSkip to conversation

f2fs: should get a victim from retrials

PATCH In review Jaegeuk Kim 2 participants 3 messages Sep 21, 2015 – Sep 30, 2015

Subsystems (2)
lore
Share & tools
lore

Jaegeuk Kim

author maintainer
#0 lore raw

PATCH 1/1 f2fs: should get a victim from retrials

If we do not call get_victim first, we cannot get a new victim for retrial path.

---
 fs/f2fs/gc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +2 -1
index 782b8e7..e932740 100644
@@ -823,7 +823,8 @@ gc_more:
 			write_checkpoint(sbi, &cpc);
 	}
 
-	if (segno == NULL_SEGNO && !__get_victim(sbi, &segno, gc_type))
+	/* should call __get_victim first to get a victim from retrial path */
+	if (!__get_victim(sbi, &segno, gc_type) && segno == NULL_SEGNO)
 		goto stop;
 	ret = 0;
 
Signature · 1 line
2.1.1
author maintainer
#1 lore raw

Change log from v1:
o avoid __get_victim call twice, since each call registers the victim in bitmap

Quoted 1 line

From 45c3aaea805751e5c1899dd9c76d89e6f73a7a8f Mon Sep 17 00:00:00 2001

From: Jaegeuk Kim <[email protected]>
Date: Fri, 18 Sep 2015 17:33:00 -0700
Subject: [PATCH] f2fs: should get a victim from retrials

If we do not call get_victim first, we cannot get a new victim for retrial path.

---
 fs/f2fs/gc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/f2fs/gc.c +3 -2
index b6e03eb..343b096 100644
@@ -799,8 +799,7 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, unsigned int segno,
 
 int f2fs_gc(struct f2fs_sb_info *sbi)
 {
-	unsigned int segno = NULL_SEGNO;
-	unsigned int i;
+	unsigned int segno, i;
 	int gc_type = BG_GC;
 	int sec_freed = 0;
 	int ret = -1;
@@ -812,6 +811,8 @@ int f2fs_gc(struct f2fs_sb_info *sbi)
 
 	cpc.reason = __get_cp_reason(sbi);
 gc_more:
+	segno = NULL_SEGNO;
+
 	if (unlikely(!(sbi->sb->s_flags & MS_ACTIVE)))
 		goto stop;
 	if (unlikely(f2fs_cp_error(sbi)))
Signature · 1 line
2.1.1
Reviewed-by
#2 lore raw
Quoted 11 lines

-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Tuesday, September 29, 2015 5:44 AM
To: [email protected]; [email protected]; [email protected]
Subject: Re: [f2fs-dev] [PATCH v2] f2fs: should get a victim from retrials

Change log from v1:
o avoid __get_victim call twice, since each call registers the victim in bitmap

Quoted 1 line

From 45c3aaea805751e5c1899dd9c76d89e6f73a7a8f Mon Sep 17 00:00:00 2001

Quoted 8 lines

From: Jaegeuk Kim <[email protected]>
Date: Fri, 18 Sep 2015 17:33:00 -0700
Subject: [PATCH] f2fs: should get a victim from retrials

If we do not call get_victim first, we cannot get a new victim for retrial path.

------------------------------------------------------------------------------