hfsplus: convert regular file I/O to iomap
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest5 patches 9 repliesIn review
- v47 patches 17 repliesSuperseded
- v37 patches 1 replySuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 7 patches | 9 replies | Superseded | |
| v1 | 6 patches | 14 replies | Superseded |
Changes in v5 from the cover letter
- 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.
Patches in v5 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | iomap: add iomap_dio_end_io() helperinclude/ | +20 | 4 replies | |
| 2/5 | hfsplus: move file related operations to file.cfs/ fs/ fs/ +1 more | +135 | 2 replies | |
| 3/5 | hfsplus: rework hfsplus_get_block() logicfs/ fs/ | +85 | 1 reply | |
| 4/5 | hfsplus: return -EIO from hfsplus_map_extent() if no extent covers the blockfs/ | +6 | 1 reply | |
| 5/5 | hfsplus: convert regular file I/O to iomapfs/ fs/ fs/ +5 more | +583 | 1 reply |
Reviews trailers per patch
3 of 5 patches have a Reviewed-by or Acked-by.
| Patch | Christoph Hellwig | Darrick J. Wong |
|---|---|---|
| 1/5 | ||
| 2/5 | R-b | A-b |
| 3/5 | R-b R-b | A-b |
| 4/5 | R-b | |
| 5/5 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v5 0/5] hfsplus: convert regular file I/O to iomap
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
Signature · 1 line
2.53.0