mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <slava@dubeyko.com>
To: glaubitz@physik.fu-berlin.de, frank.li@vivo.com, hch@lst.de
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	vdubeyko@coreweave.com, brauner@kernel.org,
	linux-xfs@vger.kernel.org, Viacheslav Dubeyko <slava@dubeyko.com>
Subject: [PATCH v5 0/5] hfsplus: convert regular file I/O to iomap
Date: Tue, 17 Nov 2026 16:48:39 -0800	[thread overview]
Message-ID: <20261118004844.3849979-1-slava@dubeyko.com> (raw)

Switch the HFS+ regular file data path from buffer heads and
blockdev_direct_IO() to iomap.

(1) adds a generic iomap_dio_end_io() helper to
include/linux/iomap.h: a direct write ->end_io callback that updates
i_size when the write goes beyond the end-of-file. It can be used by
file systems that issue all extending direct writes synchronously
under inode_lock.

(2) moves the file related operations (open, release, fsync and
file_operations) from inode.c into the new file.c, without functional
changes, to prepare the place for the iomap-based file operations.

(3) splits the extent lookup/allocation logic out of
hfsplus_get_block() into hfsplus_map_extent(), which reports the
mapping without a buffer_head, so that the iomap path can use it
directly. No functional change for the buffer_head path.

(4) makes hfsplus_map_extent() return -EIO when no extent covers
the requested block. On a corrupted volume, hfsplus_get_block() mapped
such a block to allocation block 0, i.e. the boot blocks and the volume
header. The iomap path relies on this check, since a zero-length extent
would otherwise produce a zero-length mapping.

(5) adds the HFS+ iomap operations, implements iomap-based
llseek/read_iter/write_iter, switches hfsplus_aops to iomap (removing
hfsplus_direct_IO() and the LEGACY_DIRECT_IO dependency), and rolls
back i_size and the allocated blocks when the zero-filling extension
or the data write fails. HFS+ doesn't support holes, so extending
writes and truncates zero-fill the gap up to the new end-of-file.

Changes since v4:
- iomap_dio_end_io() is extracted into a dedicated patch 1.
- Rebased on top of "hfsplus: don't take inode_lock in
  hfsplus_file_fsync()", "hfsplus: set s_maxbytes from the volume
  capacity" and "hfsplus: release preallocated blocks in
  hfsplus_file_truncate()", which are already applied.
- v5 patches 04, 06, 07 and 10 are squashed into patch 5.
- The -EIO check in hfsplus_map_extent() is moved out of the iomap
  conversion into the separate, documented patch 4.
- The phys_size change in hfsplus_get_block() is dropped: it is not
  related to iomap, since after the conversion hfsplus_get_block() only
  allocates blocks when phys_size is block-aligned.
- hfsplus_write_iomap_end() keeps fs_blocks and the inode byte count in
  whole blocks, as hfsplus_inode_read_fork() and hfsplus_file_truncate()
  do, while phys_size stays byte-granular for a partially written block.
- __hfsplus_iomap_begin() ends a mapping of initialized blocks at the
  block boundary above phys_size instead of at phys_size itself. With
  an unaligned on-disk size this used to produce a mapping length that
  is not a multiple of the logical block size, and an aligned O_DIRECT
  overwrite failed with -EINVAL.
- The fsync locking change is dropped from this series, since it is
  handled by the separate prep patch.
- The volume capacity check in hfsplus_file_write_iter() is dropped,
  since generic_write_checks() enforces s_maxbytes, which is set from
  the volume capacity.

Viacheslav Dubeyko (5):
  iomap: add iomap_dio_end_io() helper
  hfsplus: move file related operations to file.c
  hfsplus: rework hfsplus_get_block() logic
  hfsplus: return -EIO from hfsplus_map_extent() if no extent covers the
    block
  hfsplus: convert regular file I/O to iomap

 fs/hfsplus/Kconfig      |   2 +-
 fs/hfsplus/Makefile     |   5 +-
 fs/hfsplus/extents.c    | 163 +++++++++++++++------
 fs/hfsplus/file.c       | 308 ++++++++++++++++++++++++++++++++++++++++
 fs/hfsplus/hfsplus_fs.h |  26 +++-
 fs/hfsplus/inode.c      | 274 +++++++++++------------------------
 fs/hfsplus/iomap.c      | 254 +++++++++++++++++++++++++++++++++
 fs/hfsplus/iomap.h      |  17 +++
 include/linux/iomap.h   |  20 +++
 9 files changed, 823 insertions(+), 246 deletions(-)
 create mode 100644 fs/hfsplus/file.c
 create mode 100644 fs/hfsplus/iomap.c
 create mode 100644 fs/hfsplus/iomap.h

-- 
2.53.0


             reply	other threads:[~2026-11-18  0:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  0:48 Viacheslav Dubeyko [this message]
2026-11-18  0:48 ` [PATCH v5 1/5] iomap: add iomap_dio_end_io() helper Viacheslav Dubeyko
2026-11-18  0:48 ` [PATCH v5 2/5] hfsplus: move file related operations to file.c Viacheslav Dubeyko
2026-11-18  0:48 ` [PATCH v5 3/5] hfsplus: rework hfsplus_get_block() logic Viacheslav Dubeyko
2026-11-18  0:48 ` [PATCH v5 4/5] hfsplus: return -EIO from hfsplus_map_extent() if no extent covers the block Viacheslav Dubeyko
2026-11-18  0:48 ` [PATCH v5 5/5] hfsplus: convert regular file I/O to iomap 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=20261118004844.3849979-1-slava@dubeyko.com \
    --to=slava@dubeyko.com \
    --cc=brauner@kernel.org \
    --cc=frank.li@vivo.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=vdubeyko@coreweave.com \
    /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

all inboxes | Powered by JetHome®