public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Jeuk Kim <jeuk20.kim@gmail.com>, jaegeuk@kernel.org
Cc: chao@kernel.org, Jinyoung Choi <j-young.choi@samsung.com>,
	Jeuk Kim <jeuk20.kim@samsung.com>,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: Question: batching block allocation in f2fs DIO path
Date: Tue, 30 Dec 2025 17:27:26 +0800	[thread overview]
Message-ID: <c28020f1-e2f2-42e8-9c0c-0ff70ec219cd@kernel.org> (raw)
In-Reply-To: <CAPjHTeSsvb7UOAn9mWoqXwWTw1J9SEEDo1k=8KVcAxwVsys+Og@mail.gmail.com>

Hi Jeuk,

On 12/29/2025 2:33 PM, Jeuk Kim wrote:
> Hi F2FS maintainers,
> 
> Sorry for the duplicate — I’m resending this because the previous
> message was sent in HTML format.
> 
> I’ve been looking into the DIO allocation path in f2fs, specifically
> when a DIO write needs to allocate new blocks (e.g., hole-filling).
>  From f2fs_map_blocks() through __allocate_data_block() →
> f2fs_allocate_data_block(), it seems each block allocation is handled
> one-by-one, taking curseg_lock/curseg_mutex and the SIT sentry lock
> per block.
> 
> I’m wondering whether batching allocations (a bounded batch, e.g., a
> small run within the current segment) could be feasible in the DIO
> path. My intuition is that with multiple threads doing DIO, reducing
> per-block lock contention and improving sequentiality could help
> throughput.

I agree w/ you.

> 
> Questions:
> 
> Is there a technical or correctness reason that makes batching for DIO
> infeasible (e.g., LFS/SSR/GC interactions, summary/SIT update
> ordering, etc.)?
> 
> Or is this simply an optimization that hasn’t been implemented?

I've implemented a prototype of multiple block allocation for any potential
use cases: pinfile fallocation, direct IO and buffered IO. I can see benefits
from my previous test.

I plan to upstream all implementations, but I think I need more time to clean
up the draft codes and check all corner cases.

You can check the MBA implementation for pinfile use case in below link, I
guess this version is close to upstream.

https://github.com/chaseyu/f2fs-dev/commits/feature/inbatch_write

Thanks,

> 
> If this seems acceptable, would you consider patches in this direction?
> 
> If there are prior discussions or known issues on this, I’d appreciate pointers.
> 
> Thanks for your time.
> 
> Best regards,
> Jeuk Kim


  reply	other threads:[~2025-12-30  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-29  6:33 Question: batching block allocation in f2fs DIO path Jeuk Kim
2025-12-30  9:27 ` Chao Yu [this message]
2025-12-30 13:25   ` Jeuk Kim

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=c28020f1-e2f2-42e8-9c0c-0ff70ec219cd@kernel.org \
    --to=chao@kernel.org \
    --cc=j-young.choi@samsung.com \
    --cc=jaegeuk@kernel.org \
    --cc=jeuk20.kim@gmail.com \
    --cc=jeuk20.kim@samsung.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