[PATCH 2/3] f2fs: export f2fs_stop_flush_thread() for external use

From: Yangtao Li
Date: Thu Oct 27 2022 - 08:08:31 EST


Need to stop the flush thread running externally,
so export it.

Signed-off-by: Yangtao Li <frank.li@xxxxxxxx>
---
fs/f2fs/f2fs.h | 1 +
fs/f2fs/segment.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index b467c0ca1118..0d072b029187 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -3732,6 +3732,7 @@ unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi,
unsigned int segno);
unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
unsigned int segno);
+void f2fs_stop_flush_thread(struct f2fs_sb_info *sbi);

#define DEF_FRAGMENT_SIZE 4
#define MIN_FRAGMENT_SIZE 1
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 282616e6852a..f0f52979397e 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -671,7 +671,7 @@ int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi)
return 0;
}

-void f2fs_destroy_flush_cmd_control(struct f2fs_sb_info *sbi, bool free)
+void f2fs_stop_flush_thread(struct f2fs_sb_info *sbi)
{
struct flush_cmd_control *fcc = SM_I(sbi)->fcc_info;

@@ -681,6 +681,13 @@ void f2fs_destroy_flush_cmd_control(struct f2fs_sb_info *sbi, bool free)
fcc->f2fs_issue_flush = NULL;
kthread_stop(flush_thread);
}
+}
+
+void f2fs_destroy_flush_cmd_control(struct f2fs_sb_info *sbi, bool free)
+{
+ struct flush_cmd_control *fcc = SM_I(sbi)->fcc_info;
+
+ f2fs_stop_flush_thread(sbi);
if (free) {
kfree(fcc);
SM_I(sbi)->fcc_info = NULL;
--
2.25.1