From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 2/2] f2fs: ro: don't start discard thread for readonly image
Date: Mon, 26 Feb 2024 15:35:39 +0800 [thread overview]
Message-ID: <20240226073539.2509926-2-chao@kernel.org> (raw)
In-Reply-To: <20240226073539.2509926-1-chao@kernel.org>
[ 9299.893835] F2FS-fs (vdd): Allow to mount readonly mode only
mount: /mnt/f2fs: WARNING: source write-protected, mounted read-only.
root@qemu:/ 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@kernel.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
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2024-02-26 7:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 7:35 [f2fs-dev] [PATCH 1/2] f2fs: ro: compress: fix to avoid caching unaligned extent Chao Yu
2024-02-26 7:35 ` Chao Yu [this message]
2024-03-04 18:20 ` patchwork-bot+f2fs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240226073539.2509926-2-chao@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).