From: Viacheslav Dubeyko <slava@dubeyko.com>
To: konishi.ryusuke@gmail.com, hch@lst.de
Cc: linux-nilfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
lilinmao@kylinos.cn, Viacheslav Dubeyko <slava@dubeyko.com>
Subject: [PATCH v2 0/2] nilfs2: eliminate blockdev_direct_IO() call
Date: Fri, 7 Aug 2026 17:35:21 -0700 [thread overview]
Message-ID: <20260808003523.2760509-1-slava@dubeyko.com> (raw)
The patchset eliminates blockdev_direct_IO() from
nilfs2 entirely. It adds iomap.h with declaration of iomaps
operations and iomap.c with implementation of
nilfs_iomap_begin(). The nilfs_direct_IO() and the .direct_IO
callback on nilfs_aops are removed. The nilfs_file_read_iter()
dispatches O_DIRECT reads to iomap_dio_rw() using nilfs_iomap_ops.
Everything else still goes through generic_file_read_iter().
The unnecessary "select LEGACY_DIRECT_IO" has been exchanged on
"select FS_IOMAP" in Kconfig.
v2
The bug has been discovered in nilfs_iomap_begin() of patchset's
first version thanks to Linmao Li.
nilfs_iomap_begin() looks up the filesystem block containing the requested
offset and returns the physical address of that block. However, it sets
iomap->offset to the original, possibly sub-block, offset while leaving
iomap->addr at the start of the physical block.
iomap_sector() adds the difference between the I/O position and
iomap->offset to iomap->addr. For an O_DIRECT read at offset 512 on a
filesystem with 4 KiB blocks, the two file offsets are equal and the I/O is
therefore submitted at the start of the physical block instead of 512 bytes
into it. iomap direct I/O permits this alignment when the device logical
block size is 512 bytes.
Describe mapped and hole extents from the filesystem-block-aligned file
offset. This makes the physical and file offsets refer to the same byte.
It also prevents a one-block hole mapping from extending into the following
block.
Viacheslav Dubeyko (2):
nilfs2: add iomap operations for direct I/O
nilfs2: switch O_DIRECT to iomap based operations
fs/nilfs2/Kconfig | 2 +-
fs/nilfs2/Makefile | 2 +-
fs/nilfs2/file.c | 40 ++++++++++++++++++++++++--
fs/nilfs2/inode.c | 13 ---------
fs/nilfs2/iomap.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++
fs/nilfs2/iomap.h | 13 +++++++++
6 files changed, 124 insertions(+), 18 deletions(-)
create mode 100644 fs/nilfs2/iomap.c
create mode 100644 fs/nilfs2/iomap.h
--
2.43.0
next reply other threads:[~2026-08-08 0:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 0:35 Viacheslav Dubeyko [this message]
2026-08-08 0:35 ` [PATCH v2 1/2] nilfs2: add iomap operations for direct I/O Viacheslav Dubeyko
2026-08-08 0:35 ` [PATCH v2 2/2] nilfs2: switch O_DIRECT to iomap based operations Viacheslav Dubeyko
2026-08-08 23:51 ` Ryusuke Konishi
2026-08-10 0:15 ` Viacheslav Dubeyko
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=20260808003523.2760509-1-slava@dubeyko.com \
--to=slava@dubeyko.com \
--cc=hch@lst.de \
--cc=konishi.ryusuke@gmail.com \
--cc=lilinmao@kylinos.cn \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nilfs@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