[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240226073539.2509926-2-chao@kernel.org>
Date: Mon, 26 Feb 2024 15:35:39 +0800
From: Chao Yu <chao@...nel.org>
To: jaegeuk@...nel.org
Cc: linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
Chao Yu <chao@...nel.org>
Subject: [PATCH 2/2] f2fs: ro: don't start discard thread for readonly image
[ 9299.893835] F2FS-fs (vdd): Allow to mount readonly mode only
mount: /mnt/f2fs: WARNING: source write-protected, mounted read-only.
root@...u:/ ps -ef|grep f2fs
root 94 2 0 03:46 ? 00:00:00 [kworker/u17:0-f2fs_post_read_wq]
root 6282 2 0 06:21 ? 00:00:00 [f2fs_discard-253:48]
There will be no deletion in readonly image, let's skip starting
discard thread to save system resources.
Signed-off-by: Chao Yu <chao@...nel.org>
---
fs/f2fs/segment.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index b486fe4485f9..cc27c5440188 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2253,6 +2253,12 @@ int f2fs_start_discard_thread(struct f2fs_sb_info *sbi)
struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
int err = 0;
+ if (f2fs_sb_has_readonly(sbi)) {
+ f2fs_info(sbi,
+ "Skip to start discard thread for readonly image");
+ return 0;
+ }
+
if (!f2fs_realtime_discard_enable(sbi))
return 0;
--
2.40.1
Powered by blists - more mailing lists