From: Yuwei Guan <ssawgyw@gmail.com>
To: Chao Yu <chao@kernel.org>, 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: Tue, 15 Nov 2022 14:01:42 +0800 [thread overview]
Message-ID: <abaa605d-a288-b6d5-49f5-932d4497c207@gmail.com> (raw)
In-Reply-To: <29fa9df4-dc5f-a944-a150-68d34904cc91@kernel.org>
On 2022/11/15 9:23, Chao Yu wrote:
> On 2022/11/15 0:13, Yuwei Guan wrote:
>>
>> On 2022/11/14 22:42, Chao Yu wrote:
>>> 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()?
>>>
>> Hi Chao,
>>
>> 'sm_i->main_segments' init in func 'f2fs_build_segment_manager()',
>>
>> when do fill super process, so it cannot move into default_options().
>
> How about checking le32_to_cpu(raw_super->segment_count_main) directly?
>
Hi Chao,
Thanks a lot for it, I will update with v1 patch.
> Thanks,
>
>>
>>> 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-15 6:01 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
2022-11-14 16:13 ` Yuwei Guan
2022-11-15 1:23 ` Chao Yu
2022-11-15 6:01 ` Yuwei Guan [this message]
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=abaa605d-a288-b6d5-49f5-932d4497c207@gmail.com \
--to=ssawgyw@gmail.com \
--cc=Yuwei.Guan@zeekrlife.com \
--cc=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
all inboxes | Powered by JetHome®