All of lore.kernel.org
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH v2 1/2] f2fs: fix gc mode when gc_urgent_high_remaining is 1
@ 2022-10-25  6:50 ` Yangtao Li
  0 siblings, 0 replies; 14+ messages in thread
From: Yangtao Li via Linux-f2fs-devel @ 2022-10-25  6:50 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: Yangtao Li, linux-kernel, linux-f2fs-devel

Under the current logic, when gc_urgent_high_remaining is set to 1,
the mode will be switched to normal at the beginning, instead of
running in gc_urgent mode.

Let's switch the gc mode back to normal when the gc ends.

Fixes: 265576181b4a ("f2fs: remove gc_urgent_high_limited for cleanup")

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/f2fs/gc.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index 4546e01b2ee0..e0ff99c7e3f2 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -96,16 +96,6 @@ static int gc_thread_func(void *data)
 		 * invalidated soon after by user update or deletion.
 		 * So, I'd like to wait some time to collect dirty segments.
 		 */
-		if (sbi->gc_mode == GC_URGENT_HIGH) {
-			spin_lock(&sbi->gc_urgent_high_lock);
-			if (sbi->gc_urgent_high_remaining) {
-				sbi->gc_urgent_high_remaining--;
-				if (!sbi->gc_urgent_high_remaining)
-					sbi->gc_mode = GC_NORMAL;
-			}
-			spin_unlock(&sbi->gc_urgent_high_lock);
-		}
-
 		if (sbi->gc_mode == GC_URGENT_HIGH ||
 				sbi->gc_mode == GC_URGENT_MID) {
 			wait_ms = gc_th->urgent_sleep_time;
@@ -162,6 +152,15 @@ static int gc_thread_func(void *data)
 		/* balancing f2fs's metadata periodically */
 		f2fs_balance_fs_bg(sbi, true);
 next:
+		if (sbi->gc_mode == GC_URGENT_HIGH) {
+			spin_lock(&sbi->gc_urgent_high_lock);
+			if (sbi->gc_urgent_high_remaining) {
+				sbi->gc_urgent_high_remaining--;
+				if (!sbi->gc_urgent_high_remaining)
+					sbi->gc_mode = GC_NORMAL;
+			}
+			spin_unlock(&sbi->gc_urgent_high_lock);
+		}
 		sb_end_write(sbi->sb);
 
 	} while (!kthread_should_stop());
-- 
2.25.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-10-28  3:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-25  6:50 [f2fs-dev] [PATCH v2 1/2] f2fs: fix gc mode when gc_urgent_high_remaining is 1 Yangtao Li via Linux-f2fs-devel
2022-10-25  6:50 ` Yangtao Li
2022-10-25  6:50 ` [f2fs-dev] [PATCH v2 2/2] f2fs: introducr gc_urgent_idle_remaining sysfs node and mark gc_urgent_high_remaining node deprecated Yangtao Li via Linux-f2fs-devel
2022-10-25  6:50   ` Yangtao Li
2022-10-28  2:25   ` [f2fs-dev] " Chao Yu
2022-10-28  2:25     ` Chao Yu
2022-10-28  3:22     ` [f2fs-dev] " Jaegeuk Kim
2022-10-28  3:22       ` Jaegeuk Kim
2022-10-28  3:46       ` [f2fs-dev] " Chao Yu
2022-10-28  3:46         ` Chao Yu
2022-10-28  3:52         ` [f2fs-dev] " Jaegeuk Kim
2022-10-28  3:52           ` Jaegeuk Kim
2022-10-25  7:33 ` [f2fs-dev] [PATCH v2 1/2] f2fs: fix gc mode when gc_urgent_high_remaining is 1 Chao Yu
2022-10-25  7:33   ` Chao Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.