mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Zhiguo Niu <zhiguo.niu@unisoc.com>, jaegeuk@kernel.org
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, niuzhiguo84@gmail.com,
	ke.wang@unisoc.com, Hao_hao.Wang@unisoc.com
Subject: Re: [PATCH v2] f2fs: fix to preserve previous reserve_{blocks,node} value when remount
Date: Mon, 9 Mar 2026 10:49:47 +0800	[thread overview]
Message-ID: <0c0baadd-06f5-4b2a-bae8-2bd93077025d@kernel.org> (raw)
In-Reply-To: <1772680966-29939-1-git-send-email-zhiguo.niu@unisoc.com>

On 3/5/26 11:22, Zhiguo Niu wrote:
> The following steps will change previous value of reserve_{blocks,node},
> this dones not match the original intention.
> 
> 1.mount -t f2fs -o reserve_root=8192 imgfile test_mount/
> F2FS-fs (loop56): Mounted with checkpoint version = 1b69f8c7
> mount info:
> /dev/block/loop56 on /data/test_mount type f2fs (xxx,reserve_root=8192,reserve_node=0,resuid=0,resgid=0,xxx)
> 
> 2.mount -t f2fs -o remount,reserve_root=4096 /data/test_mount
> F2FS-fs (loop56): Preserve previous reserve_root=8192
> check mount info: reserve_root change to 4096
> /dev/block/loop56 on /data/test_mount type f2fs (xxx,reserve_root=4096,reserve_node=0,resuid=0,resgid=0,xxx)
> 
> Prior to commit d18535132523 ("f2fs: separate the options parsing and options checking"),
> the value of reserve_{blocks,node} was only set during the first mount, along with
> the corresponding mount option F2FS_MOUNT_RESERVE_{ROOT,NODE} . If the mount option
> F2FS_MOUNT_RESERVE_{ROOT,NODE} was found to have been set during the mount/remount,
> the previously value of reserve_{blocks,node} would also be preserved, as shown in
> the code below.
>              if (test_opt(sbi, RESERVE_ROOT)) {
>                    f2fs_info(sbi, "Preserve previous reserve_root=%u",
>                           F2FS_OPTION(sbi).root_reserved_blocks);
>              } else {
>                    F2FS_OPTION(sbi).root_reserved_blocks = arg;
>                    set_opt(sbi, RESERVE_ROOT);
>              }
> But commit d18535132523 ("f2fs: separate the options parsing and options checking")
> only preserved the previous mount option; it did not preserve the previous value of
> reserve_{blocks,node}. Since value of reserve_{blocks,node} value is assigned
> or not depends on ctx->spec_mask, ctx->spec_mask should be alos handled in
> f2fs_check_opt_consistency.
> 
> This patch will clear the corresponding ctx->spec_mask bits in f2fs_check_opt_consistency
> to preserve the previously values of reserve_{blocks,node} if it already have a value.
> 
> Fixes: d18535132523 ("f2fs: separate the options parsing and options checking")
> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
> ---
> v2: add more detail info in commit msg suggested by Chao

Thanks Zhiguo, the commit message makes sense to me, and it looks good now.

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


  reply	other threads:[~2026-03-09  2:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05  3:22 Zhiguo Niu
2026-03-09  2:49 ` Chao Yu [this message]
2026-03-24  7:56   ` Chao Yu

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=0c0baadd-06f5-4b2a-bae8-2bd93077025d@kernel.org \
    --to=chao@kernel.org \
    --cc=Hao_hao.Wang@unisoc.com \
    --cc=jaegeuk@kernel.org \
    --cc=ke.wang@unisoc.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=niuzhiguo84@gmail.com \
    --cc=zhiguo.niu@unisoc.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®