Linux EXT4 FS development
 help / color / mirror / Atom feed
* [PATCH v3 0/2] ext4: punch hole beyond i_size
@ 2026-12-03 13:06 Ding Feng
  2026-12-03 13:06 ` [PATCH v3 1/2] ext4: fix the fast commit range of a punched hole Ding Feng
  2026-12-03 13:06 ` [PATCH v3 2/2] ext4: punch hole beyond i_size Ding Feng
  0 siblings, 2 replies; 3+ messages in thread
From: Ding Feng @ 2026-12-03 13:06 UTC (permalink / raw)
  To: tytso, adilger.kernel
  Cc: jack, libaokun, ojaswin, ritesh.list, yi.zhang, hughd, david,
	linux-ext4, linux-kernel

ext4 cannot punch out blocks that FALLOC_FL_KEEP_SIZE allocated past
EOF: ext4_punch_hole() returns early for a hole that starts at or past
i_size, and ends any other hole at the block that holds i_size. Patch 2
lifts that limit. Patch 1 fixes the range the punch records for fast
commit, which wraps to 0 once a hole can run to s_maxbytes.

Changes since v2 [1], from the Sashiko review [2]:

- Patch 2: keep rounding a hole that reaches i_size up to the end of
  the block that holds i_size. v2 dropped the round-up with the clamp,
  so punching [0, 5000) or [0, 6000) on a 5000-byte file zeroed the EOF
  block and left it allocated (st_blocks 8); with v3 it is freed
  (st_blocks 0), as on v7.4-rc5.

Changes since v1 [3]:

- New patch 1. With v1 on a fast_commit filesystem, punching
  [0, s_maxbytes) over a 1 MiB file, then fsync and a shutdown, brought
  the punched data back after replay; with v2 and v3 the blocks stay
  freed. Patch 1 also moves ext4_fc_track_inode() out of
  "if (end_lblk > start_lblk)", so a hole within one block still queues
  the inode, as the old call at the end did.
- Patch 2: zero partial blocks only for a hole that starts below i_size,
  and Fixes: 2be4751b21ae instead of a4bb6b64e39a.

Tested on v7.4-rc5, x86_64 under QEMU, ext4 with 4k blocks:

- fstests -g punch: 24 run, 27 not run; generic/042 fails with and
  without the series, nothing else fails.
- generic/811, "generic: punch a hole past EOF over preallocated
  blocks" [4], fails without the series and passes with it; it passes
  on XFS.
- The fast commit crash check and the 5000-byte cases above.

[1] https://lore.kernel.org/all/20261203115201.48810-1-dingf3ng@gmail.com/
[2] https://lore.kernel.org/all/sashiko-outbox-247711@kernel.org/
[3] https://lore.kernel.org/all/20261203091435.73786-1-dingf3ng@gmail.com/
[4] https://lore.kernel.org/all/20261203115229.50163-1-dingf3ng@gmail.com/

Ding Feng (2):
  ext4: fix the fast commit range of a punched hole
  ext4: punch hole beyond i_size

 fs/ext4/inode.c | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

-- 
2.39.5


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

end of thread, other threads:[~2026-12-03 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 13:06 [PATCH v3 0/2] ext4: punch hole beyond i_size Ding Feng
2026-12-03 13:06 ` [PATCH v3 1/2] ext4: fix the fast commit range of a punched hole Ding Feng
2026-12-03 13:06 ` [PATCH v3 2/2] ext4: punch hole beyond i_size Ding Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox