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 <[email protected]>
Reviewed-by: Chao Yu <[email protected]> Thanks, _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
