From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 932FA2010EE for ; Mon, 9 Mar 2026 02:49:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773024591; cv=none; b=RbP+CwCJxbYYeFCyTO+MEyfjuZkLu/J9Uzh28khOvJS8vSYjv251G7F21ALF7QwjODNW5tQDx+tCjNwKxsydy0tGGfOvZenRJbNcirS7ED12yNrIfI36fx/YafPpVdQ0ovj7jP7DdMTTFYtofw9ErTr620WCWNH+7jhre7hlu8U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773024591; c=relaxed/simple; bh=KunRiZRpKiAcU8qeAYLyCv5F+lGXNF0SOMxOLWjWRMs=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=SgsWURxo/I1Na5NEZ3z9BeiiWoMhbrtE5d2rv/NSY5LwFugF+80MOyorgGce6rhNJljJKMgy/cIXKdTtn0cLs683NQsJ5f7noOW4XIJ55LeoDZrMy4TJ+wru+dHOED/PB2GwKro64xf9NDWzSoxKOfluAcubhWKCdvzBLM3kxVk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aM6eCcNs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aM6eCcNs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9ADCEC116C6; Mon, 9 Mar 2026 02:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773024591; bh=KunRiZRpKiAcU8qeAYLyCv5F+lGXNF0SOMxOLWjWRMs=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=aM6eCcNs+WcEUo6AYvxn+68+BRWLqAmQuaCLPkzxuKmzJE1e5qYjjEVpYc+HUK4ZO jek7+9PiSILKxmX9RzRVmlxsuElvOvTDw2k67s3M/n3hbpzfb4vOtTNqFGUAvkjjom ABxAj10evXVLNuOrWVCWru0E8DkUvlAEJij6TEYo0lAda6/WFnLegNCNSN+UdrBFkn 8RA8xMJMDDBaPUJNssNrYuxIRSonpEPElVaovoa8pOsf5+SEjAGDI/i/no9wCpfhdG BanC04JGHj3maq7GCbYroBnjrAthnObQSTg6cy6pAUyqfskc1AnJPj6aSX4G8vtMLv AFgVFccVeMK7Q== Message-ID: <0c0baadd-06f5-4b2a-bae8-2bd93077025d@kernel.org> Date: Mon, 9 Mar 2026 10:49:47 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird 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 To: Zhiguo Niu , jaegeuk@kernel.org References: <1772680966-29939-1-git-send-email-zhiguo.niu@unisoc.com> Content-Language: en-US From: Chao Yu In-Reply-To: <1772680966-29939-1-git-send-email-zhiguo.niu@unisoc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 > --- > 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 Thanks,