[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2a330404-8518-4891-8ec9-dfe18074780a@kernel.org>
Date: Mon, 15 Dec 2025 09:49:52 +0800
From: Chao Yu <chao@...nel.org>
To: Joanne Chang <joannechien@...gle.com>, Jaegeuk Kim <jaegeuk@...nel.org>
Cc: chao@...nel.org, linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] f2fs: improve check for enough free sections
On 12/12/25 16:40, Joanne Chang wrote:
> The check for enough sections in segment.h has the following issues:
>
> 1. has_not_enough_free_secs() should return "enough secs" when "free_secs
>> = upper_secs", not just structly greater. Conversely, it should only
> return "not enough secs" when "free_secs < lower_secs", not when they are
> equal. This accounts for the possibility that blocks can fit within
> curseg without requiring an additional free section.
>
> 2. __get_secs_required() currently separates the needed space to section
> and block parts, checking them against free sections and curseg,
> respectively. This does not consider the case where curseg cannot hold
> the whole block part, but excess free sections beyond the section part
> can accommodate some of the block part.
>
> 3. has_curseg_enough_space() only checks CURSEG_HOT_DATA for dentry
> blocks, but when active_logs=6, they may be placed in WARM and COLD
> sections. Also, the current logic does not consider that dentry and data
> blocks can be put in the same section when active_logs=2 or 6.
>
> This patch modifies the three functions to address the above issues:
>
> 1. Rename has_curseg_enough_space() to get_additional_blocks_required().
> Calculate the minimum node, dentry, and data blocks curseg can
> accommodate. Then subtract these from the total required blocks of
> respective type to determine the worst-case number of blocks that must
> be placed in free sections.
>
> 2. In __get_secs_required(), get the number of blocks needing new
> sections from the new get_additional_blocks_required(). Return the upper
> bound of necessary free sections for these blocks. For active_logs=2 or
> 6, dentry blocks are combined with data blocks.
>
> 3. In has_not_enough_free_secs(), get the required sections from
> __get_secs_required(), and return “not enough secs” if “free_secs <
> required_secs”.
>
> Signed-off-by: Joanne Chang <joannechien@...gle.com>
Reviewed-by: Chao Yu <chao@...nel.org>
Thanks,
Powered by blists - more mailing lists