All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/13] ext4: refactor partial block zero-out for iomap conversion
@ 2026-03-27 10:29 Zhang Yi
  2026-03-27 10:29 ` [PATCH v4 01/13] ext4: add did_zero output parameter to ext4_block_zero_page_range() Zhang Yi
                   ` (13 more replies)
  0 siblings, 14 replies; 21+ messages in thread
From: Zhang Yi @ 2026-03-27 10:29 UTC (permalink / raw)
  To: linux-ext4
  Cc: linux-fsdevel, linux-kernel, tytso, adilger.kernel, jack, ojaswin,
	ritesh.list, libaokun, yi.zhang, yi.zhang, yizhang089, yangerkun,
	yukuai

From: Zhang Yi <yi.zhang@huawei.com>

Changes since v3:
 - In patch 04, fix the comments of ext4_block_zero_range().
 - Add patch 09, ensure zeroed partial blocks are persisted in SYNC mode
   for ext4_punch_hole() and ext4_zero_range(), This can resolve the
   breaks in the guarantee of data-ordered mode caused by patch 05, as
   pointed out by Sashiko.
 - Add patch 10, unify the inconsistent SYNC mode checks in all
   fallocate paths.
 - In patch 12, fix two issues related to updating the file size in
   error paths, as pointed out by Sashiko.

Changes since v2:
 - Drop patch 02 in v2 because it will not be used in the later iomap
   conversion.
 - In patch 08, modify ext4_alloc_file_blocks() to zero out EOF block
   when new_size is larger than old_size, preventing the exposure of
   stale data when the user performs fallocate starting within the
   old_size. This was pointed out by Sashiko.
 - In patch 08, add checks for the return value of
   ext4_block_zero_eof().
 - Add patches 09 and 10, move pagecache_isize_extended() out of an
   active journal handle as well to prevent opposite lock ordering.
   This was pointed out by Sashiko.
 - In patch 11, add a check for IOCB_NOWAIT, which was also pointed out
   by Sashiko.

Changes since v1:
 - In patch 04, rename ext4_block_get_zero_range() to
   ext4_load_tail_bh() and drop the unused 'length' parameter as Jan
   suggested.
 - In patch 06, modify the commit message, add another reason to drop
   data=ordered mode when zeroing partial blocks in ext4_punch_hole()
   and ext4_punch_hole() as Jan pointed out.
 - In patch 10, modify the commit message, explain the race condition
   between the buffered write and mmap write that pointed out by Jan.
 - Collect reviewed tags from Jan.

v3: https://lore.kernel.org/linux-ext4/20260326111054.907252-1-yi.zhang@huaweicloud.com/
v2: https://lore.kernel.org/linux-ext4/20260325072850.3997161-1-yi.zhang@huaweicloud.com/
v1: https://lore.kernel.org/linux-ext4/20260310014101.4140698-1-yi.zhang@huaweicloud.com/

Original cover letter:

This patch series extracted from my iomap conversion v2 series[1]. It
refactors the ext4 zero partial block code path in preparation for
converting buffered I/O to the iomap infrastructure. The main changes
are:

[1] https://lore.kernel.org/linux-ext4/20260203062523.3869120-1-yi.zhang@huawei.com/

1. Introduce ext4_block_zero_eof(): Extend and rename
   ext4_block_truncate_page() to handle post-EOF partial block zeroing
   for both append writes and truncate operations.
2. Separate ordered data handling: Move data=ordered mode handling from
   __ext4_block_zero_page_range to ext4_block_zero_eof(). Only truncate
   and post-EOF append write/fallocate paths need ordered data mode,
   hole punching and zero range paths don't need ordered data handling.
3. Split journal mode handling: Extract
   ext4_block_journalled_zero_range() from
   __ext4_block_zero_page_range() for data=journal mode, leaving
   ext4_block_do_zero_range() for data=ordered/writeback modes.
4. Refactor ext4_alloc_file_blocks(): Change parameters to loff_t byte
   granularity to simplify callers and prepares removing the zero call
   from the allocation loop for unaligned append writes.
5. Remove handle parameters: Stop passing handle_t * to zero functions.
   Make ext4_block_journalled_zero_range() start its own handle, and
   move zero operations outside active handles. This is required because
   iomap uses "folio lock -> transaction start" lock ordering, opposite
   to the current lock ordering.
6. Centralize zeroing in ext4_write_checks(): Move all post-EOF partial
   block zeroing to ext4_write_checks() so it applies to both regular
   buffered writes and the upcoming iomap path.

Thanks
Yi.

Zhang Yi (13):
  ext4: add did_zero output parameter to ext4_block_zero_page_range()
  ext4: rename and extend ext4_block_truncate_page()
  ext4: factor out journalled block zeroing range
  ext4: rename ext4_block_zero_page_range() to ext4_block_zero_range()
  ext4: move ordered data handling out of ext4_block_do_zero_range()
  ext4: remove handle parameters from zero partial block functions
  ext4: pass allocate range as loff_t to ext4_alloc_file_blocks()
  ext4: move zero partial block range functions out of active handle
  ext4: ensure zeroed partial blocks are persisted in SYNC mode
  ext4: unify SYNC mode checks in fallocate paths
  ext4: remove ctime/mtime update from ext4_alloc_file_blocks()
  ext4: move pagecache_isize_extended() out of active handle
  ext4: zero post-EOF partial block before appending write

 fs/ext4/ext4.h    |   5 +-
 fs/ext4/extents.c | 163 ++++++++++++++-------------
 fs/ext4/file.c    |  17 +++
 fs/ext4/inode.c   | 273 +++++++++++++++++++++++++++++-----------------
 4 files changed, 278 insertions(+), 180 deletions(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-04-10 15:19 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 10:29 [PATCH v4 00/13] ext4: refactor partial block zero-out for iomap conversion Zhang Yi
2026-03-27 10:29 ` [PATCH v4 01/13] ext4: add did_zero output parameter to ext4_block_zero_page_range() Zhang Yi
2026-03-27 10:29 ` [PATCH v4 02/13] ext4: rename and extend ext4_block_truncate_page() Zhang Yi
2026-03-27 10:29 ` [PATCH v4 03/13] ext4: factor out journalled block zeroing range Zhang Yi
2026-03-27 10:29 ` [PATCH v4 04/13] ext4: rename ext4_block_zero_page_range() to ext4_block_zero_range() Zhang Yi
2026-03-27 10:29 ` [PATCH v4 05/13] ext4: move ordered data handling out of ext4_block_do_zero_range() Zhang Yi
2026-03-27 10:29 ` [PATCH v4 06/13] ext4: remove handle parameters from zero partial block functions Zhang Yi
2026-03-27 10:29 ` [PATCH v4 07/13] ext4: pass allocate range as loff_t to ext4_alloc_file_blocks() Zhang Yi
2026-03-27 10:29 ` [PATCH v4 08/13] ext4: move zero partial block range functions out of active handle Zhang Yi
2026-03-27 10:29 ` [PATCH v4 09/13] ext4: ensure zeroed partial blocks are persisted in SYNC mode Zhang Yi
2026-04-01 17:06   ` Jan Kara
2026-04-02  1:21     ` Zhang Yi
2026-03-27 10:29 ` [PATCH v4 10/13] ext4: unify SYNC mode checks in fallocate paths Zhang Yi
2026-04-01 17:06   ` Jan Kara
2026-03-27 10:29 ` [PATCH v4 11/13] ext4: remove ctime/mtime update from ext4_alloc_file_blocks() Zhang Yi
2026-04-01 17:09   ` Jan Kara
2026-03-27 10:29 ` [PATCH v4 12/13] ext4: move pagecache_isize_extended() out of active handle Zhang Yi
2026-03-31 13:42   ` kernel test robot
2026-04-01 17:21   ` Jan Kara
2026-03-27 10:29 ` [PATCH v4 13/13] ext4: zero post-EOF partial block before appending write Zhang Yi
2026-04-10 15:18 ` [PATCH v4 00/13] ext4: refactor partial block zero-out for iomap conversion Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.