From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Any way to ensure minimal folio size and alignment for iomap based direct IO?
Date: Mon, 15 Sep 2025 19:32:53 +0930 [thread overview]
Message-ID: <9598a140-aa45-4d73-9cd2-0c7ca6e4020a@gmx.com> (raw)
Hi,
Recently I'm implementing block size > page size support for btrfs.
One core point of the bs > ps support is:
- No fs block is allowed to cross (large) folio boundaries
This ensure that the btrfs checksum routine needs no multi-shot calls
for a single data block, and ensures we can use a lot of
bio_advance_iter_single() calls to move to the next block.
This is pretty easy since filemap is already supporting a minimal folio
order, thus most part it's a very smooth sail for buffered IOs.
But things are going crazy for iomap based direct IOs.
I'm getting the following bio during my local tests, which is using 8K
fs block size with 4K page size:
[ 130.957366] root=5 inode=2464 logical=15974400 length=8192 index=0
bv_offset=0 bv_len=4096 is not aligned to 8192
[ 130.957376] i=0 page=0xffff8cc616e96000 offset=0 size=4096
[ 130.961977] i=1 page=0xffff8cc61730e000 offset=0 size=4096
The bio initially looks fine, the length is 8K, properly aligned.
But the dump of the bio shows it's not the case, instead of a large
folio, it's two page sized folios.
This will not pass the btrfs requirement, but weirdly the alignment
check for the iov_iter at check_direct_IO() shows no problem.
But unfortunately I can not find any folio allocation for the direct IO
routine except the zero_page...
Any clue on the iomap part, or is the btrfs requirement incompatible
with iomap in the first place?
Thanks,
Qu
next reply other threads:[~2025-09-15 10:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 10:02 Qu Wenruo [this message]
2025-09-15 13:03 ` Any way to ensure minimal folio size and alignment for iomap based direct IO? Matthew Wilcox
2025-09-15 18:12 ` Pankaj Raghav (Samsung)
2025-09-15 21:46 ` Qu Wenruo
2025-09-15 23:05 ` Matthew Wilcox
2025-09-15 23:20 ` Qu Wenruo
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=9598a140-aa45-4d73-9cd2-0c7ca6e4020a@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@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