Skip to contentSkip to conversation

f2fs: stop discard thread if has fsck tag

PATCH In review Yangtao Li 2 participants 2 messages Oct 28, 2022 – Nov 1, 2022 F2FS file system

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH v2 1/1 f2fs: stop discard thread if has fsck tag

Under the current logic, after the fsck flag is set, the discard thread will still run periodically.

So stop the discard thread from running to avoid
energy consumption after the fsck flag is set.

Fixes d618477473eb ("f2fs: stop issue discard if something wrong with f2fs")

---
v2:
- commit msg changes.

 fs/f2fs/segment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +2 -2
index 7786351de429..b3600bcadfc7 100644
@@ -1716,8 +1716,8 @@ static int issue_discard_thread(void *data)
 		if (kthread_should_stop())
 			return 0;
 		if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) {
-			wait_ms = dpolicy.max_interval;
-			continue;
+			dcc->f2fs_issue_discard = NULL;
+			return 0;
 		}
 		if (!atomic_read(&dcc->discard_cmd_cnt))
 			continue;
Signature · 8 lines
2.25.1



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
maintainer
#1 lore raw
Quoted 19 lines · Yangtao Li

Under the current logic, after the fsck flag is set, the discard thread will still run periodically.

So stop the discard thread from running to avoid
energy consumption after the fsck flag is set.

Fixes d618477473eb ("f2fs: stop issue discard if something wrong with f2fs")

---
v2:
- commit msg changes.

  fs/f2fs/segment.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +0 -0
index 7786351de429..b3600bcadfc7 100644

fs/f2fs/segment.c static int issue_discard_thread(void *data) · line 1720

Quoted 7 lines
fs/f2fs/segment.c +2 -2
@@ -1716,8 +1716,8 @@ static int issue_discard_thread(void *data)
  		if (kthread_should_stop())
  			return 0;
  		if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) {
-			wait_ms = dpolicy.max_interval;
-			continue;
+			dcc->f2fs_issue_discard = NULL;
+			return 0;

I don't think there will be much energy consumption, I guess we can keep as it is.

fs/f2fs/segment.c static int issue_discard_thread(void *data) · line 1723

Quoted 3 lines
fs/f2fs/segment.c +0 -0
  		}
  		if (!atomic_read(&dcc->discard_cmd_cnt))
  			continue;

_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel