diff options
author | Chao Yu <chao@kernel.org> | 2024-02-26 08:35:39 +0100 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2024-03-04 18:51:52 +0100 |
commit | a217f1873ab992c9f175d08d951334df173d3d54 (patch) | |
tree | 1f56e24cdb3cc70bbae88728231b7616ad211e72 /fs/f2fs | |
parent | f2fs: ro: compress: fix to avoid caching unaligned extent (diff) | |
download | linux-a217f1873ab992c9f175d08d951334df173d3d54.tar.xz linux-a217f1873ab992c9f175d08d951334df173d3d54.zip |
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@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>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/segment.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 3b8aed8ca7d4..8014ea9f7a55 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; |