Skip to contentSkip to conversation

f2fs: avoid redundant call to has_not_enough_free_secs in f2fs_gc

PATCH In review Namjae Jeon 2 participants 3 messages Jan 30, 2013 – Jan 31, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 f2fs: avoid redundant call to has_not_enough_free_secs in f2fs_gc

From: Namjae Jeon <[email protected]>

After doing a write_checkpoint from garbage collection path if there is still need to do more garbage collection, gc_more label is used to jump and start the process again. And in that process, first step before getting victim is to check if there are not enough free sections, which is already done before doing a jump to gc_more. We can avoid the redundant call to check free sections, by checking the gc_type flag which will remain FG_GC(value 1) under this condition.

---
 fs/f2fs/gc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +1 -1
index 9b5d0aa..0dfdaa5 100644
@@ -672,7 +672,7 @@ gc_more:
 	if (!(sbi->sb->s_flags & MS_ACTIVE))
 		goto stop;
 
-	if (has_not_enough_free_secs(sbi))
+	if (!gc_type && has_not_enough_free_secs(sbi))
 		gc_type = FG_GC;
 
 	if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE))
Signature · 1 line
1.7.9.5
#1 lore raw

2013-01-30 (수), 22:47 +0900, Namjae Jeon:

Quoted 21 lines

From: Namjae Jeon <[email protected]>

After doing a write_checkpoint from garbage collection path if there is still need to do more garbage collection, gc_more label is used to jump and start the process again. And in that process, first step before getting victim is to check if there are not enough free sections, which is already done before doing a jump to gc_more. We can avoid the redundant call to check free sections, by checking the gc_type flag which will remain FG_GC(value 1) under this condition.

---
 fs/f2fs/gc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +0 -0
index 9b5d0aa..0dfdaa5 100644

fs/f2fs/gc.c gc_more: · line 675

Quoted 5 lines
fs/f2fs/gc.c +1 -1
@@ -672,7 +672,7 @@ gc_more:
 	if (!(sbi->sb->s_flags & MS_ACTIVE))
 		goto stop;
 
-	if (has_not_enough_free_secs(sbi))
+	if (!gc_type && has_not_enough_free_secs(sbi))

I applied this patch with the following change:

	if (gc_type == BG_GC && has_not_enough_free_secs(sbi))

Thank you. :)

Quoted 3 lines
fs/f2fs/gc.c +0 -0
 		gc_type = FG_GC;
 
 	if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE))
Signature · 2 lines
Jaegeuk Kim
Samsung
#2 lore raw

2013/1/31, Jaegeuk Kim <[email protected]>:

Quoted 29 lines

2013-01-30 (수), 22:47 +0900, Namjae Jeon:

Quoted 28 lines

From: Namjae Jeon <[email protected]>

After doing a write_checkpoint from garbage collection path if there is still
need to do more garbage collection, gc_more label is used to jump and start
the process again. And in that process, first step before getting victim is to
check if there are not enough free sections, which is already done before doing a jump to gc_more. We can avoid the redundant call to check free sections, by checking the gc_type flag which will remain FG_GC(value 1) under
this condition.

---
 fs/f2fs/gc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +0 -0
index 9b5d0aa..0dfdaa5 100644
@@ -672,7 +672,7 @@ gc_more:
 	if (!(sbi->sb->s_flags & MS_ACTIVE))
 		goto stop;
 
Quoted 7 lines

fs/f2fs/gc.c gc_more: · line 675

Quoted 2 lines
fs/f2fs/gc.c +1 -1
-	if (has_not_enough_free_secs(sbi))
+	if (!gc_type && has_not_enough_free_secs(sbi))

I applied this patch with the following change:

	if (gc_type == BG_GC && has_not_enough_free_secs(sbi))

Thank you. :)

Right!, Thanks Jaegeuk :)

Quoted 9 lines

fs/f2fs/gc.c gc_more: · line 678

Quoted 4 lines
fs/f2fs/gc.c +0 -0
 		gc_type = FG_GC;
 
 	if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE))

--
Jaegeuk Kim
Samsung

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html