From: Chao Yu <chao@kernel.org>
To: Yuwei Guan <ssawgyw@gmail.com>, jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Yuwei.Guan@zeekrlife.com
Subject: Re: [PATCH 1/3] f2fs: fix to alloc_mode changed after remount on a small volume device
Date: Mon, 14 Nov 2022 22:42:56 +0800 [thread overview]
Message-ID: <983de611-a9e7-56d0-d375-f2b54e1f4d05@kernel.org> (raw)
In-Reply-To: <20221112083250.295700-2-Yuwei.Guan@zeekrlife.com>
On 2022/11/12 16:32, Yuwei Guan wrote:
> The commit 84b89e5d943d8 ("f2fs: add auto tuning for small devices") add
> tuning for small volume device, now support to tune alloce_mode to 'reuse'
> if it's small size. But the alloc_mode will change to 'default' when do
> remount on this small size dievce.
>
> The commit 4cac90d5491c9 ("f2fs: relocate readdir_ra configure
> initialization") relocates readdir_ra variable to tuning process.
>
> This patch fo fix alloc_mode changed when do remount for a small volume
> device.
>
> For a small device,
> - alloc_mode will keep 'reuse', if no alloc_mode option in remount
> command,
> - alloc_mode will be set as remount command, if it has 'alloc_mode='.
>
> Signed-off-by: Yuwei Guan <Yuwei.Guan@zeekrlife.com>
> ---
> fs/f2fs/super.c | 37 ++++++++++++++++++++-----------------
> 1 file changed, 20 insertions(+), 17 deletions(-)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 3834ead04620..2f36824ff84b 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -2190,6 +2190,23 @@ static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
> f2fs_flush_ckpt_thread(sbi);
> }
>
> +static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi, bool is_remount)
> +{
> + struct f2fs_sm_info *sm_i = SM_I(sbi);
> +
> + /* adjust parameters according to the volume size */
> + if (sm_i->main_segments <= SMALL_VOLUME_SEGMENTS) {
> + F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_REUSE;
How about moving above logic into default_options()?
Thanks,
> + if (f2fs_block_unit_discard(sbi))
> + sm_i->dcc_info->discard_granularity = 1;
> + sm_i->ipu_policy = 1 << F2FS_IPU_FORCE |
> + 1 << F2FS_IPU_HONOR_OPU_WRITE;
> + }
> +
> + if (!is_remount)
> + sbi->readdir_ra = 1;
> +}
> +
> static int f2fs_remount(struct super_block *sb, int *flags, char *data)
> {
> struct f2fs_sb_info *sbi = F2FS_SB(sb);
> @@ -2248,6 +2265,8 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
>
> default_options(sbi);
>
> + f2fs_tuning_parameters(sbi, true);
> +
> /* parse mount options */
> err = parse_options(sb, data, true);
> if (err)
> @@ -4054,22 +4073,6 @@ static int f2fs_setup_casefold(struct f2fs_sb_info *sbi)
> return 0;
> }
>
> -static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi)
> -{
> - struct f2fs_sm_info *sm_i = SM_I(sbi);
> -
> - /* adjust parameters according to the volume size */
> - if (sm_i->main_segments <= SMALL_VOLUME_SEGMENTS) {
> - F2FS_OPTION(sbi).alloc_mode = ALLOC_MODE_REUSE;
> - if (f2fs_block_unit_discard(sbi))
> - sm_i->dcc_info->discard_granularity = 1;
> - sm_i->ipu_policy = 1 << F2FS_IPU_FORCE |
> - 1 << F2FS_IPU_HONOR_OPU_WRITE;
> - }
> -
> - sbi->readdir_ra = 1;
> -}
> -
> static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
> {
> struct f2fs_sb_info *sbi;
> @@ -4475,7 +4478,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
>
> f2fs_join_shrinker(sbi);
>
> - f2fs_tuning_parameters(sbi);
> + f2fs_tuning_parameters(sbi, false);
>
> f2fs_notice(sbi, "Mounted with checkpoint version = %llx",
> cur_cp_version(F2FS_CKPT(sbi)));
next prev parent reply other threads:[~2022-11-14 14:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-12 8:32 [PATCH 0/3] " Yuwei Guan
2022-11-12 8:32 ` [PATCH 1/3] f2fs: fix to " Yuwei Guan
2022-11-14 14:42 ` Chao Yu [this message]
2022-11-14 16:13 ` Yuwei Guan
2022-11-15 1:23 ` Chao Yu
2022-11-15 6:01 ` Yuwei Guan
2022-11-12 8:32 ` [PATCH 2/3] f2fs: cleanup for 'f2fs_tuning_parameters' function Yuwei Guan
2022-11-12 8:32 ` [PATCH 3/3] f2fs: change type for 'sbi->readdir_ra' Yuwei Guan
2022-11-14 14:59 ` Chao Yu
2022-11-14 16:27 ` Yuwei Guan
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=983de611-a9e7-56d0-d375-f2b54e1f4d05@kernel.org \
--to=chao@kernel.org \
--cc=Yuwei.Guan@zeekrlife.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ssawgyw@gmail.com \
/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
all inboxes | Powered by JetHome®