linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] f2fs: stop discard thread if has fsck tag
@ 2022-10-28 14:37 Yangtao Li
  2022-11-01 15:17 ` Chao Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li @ 2022-10-28 14:37 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, 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")
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
v2:
- commit msg changes.
 fs/f2fs/segment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 7786351de429..b3600bcadfc7 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -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;
-- 
2.25.1


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

* Re: [PATCH v2] f2fs: stop discard thread if has fsck tag
  2022-10-28 14:37 [PATCH v2] f2fs: stop discard thread if has fsck tag Yangtao Li
@ 2022-11-01 15:17 ` Chao Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2022-11-01 15:17 UTC (permalink / raw)
  To: Yangtao Li, jaegeuk; +Cc: linux-f2fs-devel, linux-kernel

On 2022/10/28 22:37, Yangtao Li wrote:
> 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")
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
> v2:
> - commit msg changes.
>   fs/f2fs/segment.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 7786351de429..b3600bcadfc7 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -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.

>   		}
>   		if (!atomic_read(&dcc->discard_cmd_cnt))
>   			continue;

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

end of thread, other threads:[~2022-11-01 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 14:37 [PATCH v2] f2fs: stop discard thread if has fsck tag Yangtao Li
2022-11-01 15:17 ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).