mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Joanne Chang <joannechien@google.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] f2fs: improve check for enough free sections
Date: Mon, 15 Dec 2025 09:49:52 +0800	[thread overview]
Message-ID: <2a330404-8518-4891-8ec9-dfe18074780a@kernel.org> (raw)
In-Reply-To: <20251212084034.2878836-1-joannechien@google.com>

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@google.com>

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

Thanks,

  reply	other threads:[~2025-12-15  1:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-12  8:40 Joanne Chang
2025-12-15  1:49 ` Chao Yu [this message]
2025-12-16 19:20 ` [f2fs-dev] " patchwork-bot+f2fs

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=2a330404-8518-4891-8ec9-dfe18074780a@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=joannechien@google.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome