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 15829320A37 for ; Tue, 24 Mar 2026 07:56:55 +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=1774339016; cv=none; b=DDLvtchGsdsO3ECzggC3Nt5CG5h4kkg0SpOmhDjkB/u42auF7PpWsESjfoMR4KWmdcTxY70IZB+dQnh/nkdGqjo3vC2QS/Mf5M/4rb5wro3iC2F3fk+Ik5Tl2xM0n0NGjrhPzRwH95Nfr2S2mcyD4iyp587nzRPL0Tf1MbkCaWE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774339016; c=relaxed/simple; bh=QHZDt4wAk+wxUGOxlTr3AvSDrBZXQCmVa/9qNRTSsAE=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=C1BtaoqaXYYgPGOiXwGFUFM4GuEDC8qn0/GMwi4pfFb0o2B5c/BAQUzhXCa9sCI4azRFDa7WwNTS/sr9UebxD39pYyBN1JrJbhupdm4xxlTCagiPvGglpPnmrd/QBV5RCXJv9oTba/MqiRSyHxvKHpk2uYfmKA68eysa75ZMpfo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bPxUv3ns; 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="bPxUv3ns" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A035C19424; Tue, 24 Mar 2026 07:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774339015; bh=QHZDt4wAk+wxUGOxlTr3AvSDrBZXQCmVa/9qNRTSsAE=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=bPxUv3nsXR6sThUFJUm7F1uap6AvgCCxiP9ONmE40Xjrn8vbKQ9LOMbyx7WZRfcZI dxUMHK1yfj4VwZBaNRoUeSFEjWfdAXWae5uwO/34PZnMaZ8u0lho5MA71qJ8nfnTRq uXD0YKL9upruPFVcQ5NejGOTu3hLiItvdVfidHE5wmLrftgIwduyB09+OdFt7rzfLX Ik+7ktrEIXNAyvVzdVN5saIpX4rxFNX9H76LIeteg2+T1DWpFmJuIMopgJvBQRmJRa 43ppKhifjBdniJnRwXuHQFD9rYKDPiOQJSJDjPAtMUsg0yiQMTyEx3LzH2sikPqMLB CDgcGCWyRF90g== Message-ID: <73af1081-6ea1-4f8f-9f6a-cb5235c7b1c5@kernel.org> Date: Tue, 24 Mar 2026 15:56:48 +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: jaegeuk@kernel.org, Zhiguo Niu References: <1772680966-29939-1-git-send-email-zhiguo.niu@unisoc.com> <0c0baadd-06f5-4b2a-bae8-2bd93077025d@kernel.org> Content-Language: en-US From: Chao Yu In-Reply-To: <0c0baadd-06f5-4b2a-bae8-2bd93077025d@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Jaegeuk, I guess you may missed this email. :) On 3/9/26 10:49, Chao Yu wrote: > 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, >