f2fs: fix wrong continue condition in GC
Jaegeuk Kim
maintainerPATCH 1/1 f2fs: fix wrong continue condition in GC
We should decrease the frozen counter.
Fixes 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")
Signed-off-by Jaegeuk Kim <[email protected]>
--- fs/f2fs/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/gc.c +1 -1
@@ -102,7 +102,7 @@ static int gc_thread_func(void *data) sbi->gc_urgent_high_limited = false;spin_unlock (&sbi->gc_urgent_high_lock); sbi->gc_mode =GC_NORMAL ; -continue ; + goto next; } sbi->gc_urgent_high_remaining--; }
Signature · 1 line
2.37.1.595.g718a3a8f04-goog
Chao Yu
maintainerQuoted 14 lines · Jaegeuk Kim
We should decrease the frozen counter.
Fixes 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/gc.c +0
-0
fs/f2fs/gc.c static int gc_thread_func(void *data) · line 108
Quoted 8 lines
fs/f2fs/gc.c +1
-1@@ -102,7 +102,7 @@ static int gc_thread_func(void *data) sbi->gc_urgent_high_limited = false;spin_unlock (&sbi->gc_urgent_high_lock); sbi->gc_mode =GC_NORMAL ; -continue ; + goto next; } sbi->gc_urgent_high_remaining--; }
Why not:
if (!sbi->gc_urgent_high_remaining) {
sbi->gc_urgent_high_limited = false;
spin_unlock(&sbi->gc_urgent_high_lock);
sbi->gc_mode = GC_NORMAL;
} else {
sbi->gc_urgent_high_remaining--;
}Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
maintainerQuoted 26 lines · Chao Yu
Quoted 14 lines · Jaegeuk Kim
We should decrease the frozen counter.
Fixes 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")Signed-off-by Jaegeuk Kim <[email protected]>--- fs/f2fs/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/gc.c +0
-0fs/f2fs/gc.c static int gc_thread_func(void *data) · line 108
Quoted 8 lines
fs/f2fs/gc.c +1
-1@@ -102,7 +102,7 @@ static int gc_thread_func(void *data) sbi->gc_urgent_high_limited = false;spin_unlock (&sbi->gc_urgent_high_lock); sbi->gc_mode =GC_NORMAL ; -continue ; + goto next; } sbi->gc_urgent_high_remaining--; }Why not:
Quoted 3 lines
if (!sbi->gc_urgent_high_remaining) {
sbi->gc_urgent_high_limited = false;
spin_unlock(&sbi->gc_urgent_high_lock);Should not call spin_unlock, if so. Anyway, let me send v2.
Quoted 6 lines
sbi->gc_mode = GC_NORMAL; } else { sbi->gc_urgent_high_remaining--; }Thanks,
Jaegeuk Kim
maintainerWe should decrease the frozen counter.
Fixes 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")
Signed-off-by Jaegeuk Kim <[email protected]>
---
Change log from v1:
- fix by refactoring the flow
fs/f2fs/gc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
fs/f2fs/gc.c +4 -8
@@ -97,14 +97,10 @@ static int gc_thread_func(void *data)*/ if (sbi->gc_mode ==GC_URGENT_HIGH ) {spin_lock (&sbi->gc_urgent_high_lock); -if (sbi->gc_urgent_high_limited) { -if (!sbi->gc_urgent_high_remaining) { - sbi->gc_urgent_high_limited = false; -spin_unlock (&sbi->gc_urgent_high_lock); - sbi->gc_mode =GC_NORMAL ; -continue ; - } - sbi->gc_urgent_high_remaining--; +if (sbi->gc_urgent_high_limited && + !sbi->gc_urgent_high_remaining--) { + sbi->gc_urgent_high_limited = false; + sbi->gc_mode =GC_NORMAL ; }spin_unlock (&sbi->gc_urgent_high_lock); }
Signature · 1 line
2.37.1.595.g718a3a8f04-goog
Quoted 5 lines · Jaegeuk Kim
We should decrease the frozen counter.
Fixes 325163e9892b ("f2fs: add gc_urgent_high_remaining sysfs node")Signed-off-by Jaegeuk Kim <[email protected]>
Reviewed-by Chao Yu <[email protected]>
Thanks,