Re: [f2fs-dev] [PATCH] f2fs: fix i_size when pinned fallocate partially fails

Zhan Xusheng <[email protected]>
Newsgroups net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
On 8/17/26 11:12, Chao Yu wrote:
> Can you please provide a reproducer?

It needs a start offset that is not section aligned, plus a fallocate that
hits ENOSPC partway so the error path runs with expanded > 0.

  truncate -s 80M img
  mkfs.f2fs -s 1 -f img              # 2 MiB sections, sec_blks = 512
  mount -o loop img /mnt
  touch /mnt/pinned
  f2fs_io pinfile set /mnt/pinned
  # 2093056 = block 511, so pg_start % sec_blks = 511
  f2fs_io fallocate 0 2093056 536870912 /mnt/pinned
  stat -c %s /mnt/pinned
  filefrag -v /mnt/pinned

7.2, last extent and i_size:

  ext:  logical_offset:  length:  flags:
    2:  5120..   10737:    5618:  last,merged
  i_size=46075904

  i_size block 11249, allocated through 10738, overshoot 511

With this patch:

  ext:  logical_offset:  length:  flags:
    2:  5120..   10737:    5618:  last,merged,eof
  i_size=43982848

  i_size block 10738, allocated through 10738, overshoot 0

filefrag prints eof only once the last extent reaches i_size, so its
absence in the first run shows the mismatch on its own.

7.0, before 4275b59673eb, also gives overshoot 0.  Absolute block numbers
differ there because the start rounding changes how much fits before
ENOSPC, so only the overshoot compares across the three.

I will add this to the changelog in v2.

Thanks,
Zhan Xusheng


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.