public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] btrfs-progs: mkfs/rootdir: cleanup and new fiemap based prealloc detection
@ 2026-04-03  4:32 Qu Wenruo
  2026-04-03  4:32 ` [PATCH v2 1/6] btrfs-progs: mkfs-tests: also test hole-deteciton without no-holes Qu Wenruo
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Qu Wenruo @ 2026-04-03  4:32 UTC (permalink / raw)
  To: linux-btrfs

[CHANGELOG]
v2:
- Add a new test case to verify hole detection with/without no-holes
  There is a bug in the ^no-holes handling that an incorrect file extent
  is inserted with uninitialized type.

  Exposed and fixed by Mark.

- Add a new test case to verify the file contents of hole detection

  There is a bug in the refactor of read, which overwrites the buffer
  instead of properly advance the cursor.

  Exposed by Mark with Chris Mason's review prompts.

- Keep the existing first block based bad compress ratio detection
  Previously if we had bad compression ratio after the first block, we
  do not mark the inode incompressible.

  Follow the existing behavior.

- Fix the hole size capping in fiemap mode
  Which previously is not capping the hole size, and can trigger
  UASSERT()s.

- Enhance the new fiemap test case with fssum
  To verify both the hole and file contents matches.

The PR can be found here:

  https://github.com/kdave/btrfs-progs/pull/1103

Although previously I added a SEEK_DATA/SEEK_HOLE based hole detection,
it doesn't distinguish holes from preallocated ranges.
Thus if a rootdir contains some preallocated extents and the end user
also expects such preallocated space in the target fs, they will be
replaced by holes.

The first 2 patches are enhancing mkfs test cases to be more robust,
covering both no-holes and ^no-holes features, as Mark exposed a bug
affecting ^no-holes only in previous hole-detection.

The 3rd patch extracts btrfs_insert_hole_extent() to make it a little
simpler to use, without the need to populate a local on-stack file
extent item.

The 4th patch makes compressed write path easier to read, without
combining both compressed and uncompressed paths.

The 5th patch is the core of the new fiemap based hole detection, which
utilized fiemap to detect preallocated space.

The final one is a functional test for the new fiemap feature.

Qu Wenruo (6):
  btrfs-progs: mkfs-tests: also test hole-deteciton without no-holes
  btrfs-progs: mkfs-tests: add a test case to verify the content of
    rootdir
  btrfs-progs: implement the missing btrfs_insert_hole_extent()
  btrfs-progs: mkfs/rootdir: extract compressed write path
  btrfs-progs: mkfs/rootdir: use fiemap to do prealloc detection
  btrfs-progs: mkfs-tests: add a new test case for fiemap based
    detection

 Makefile                                      |   2 +-
 kernel-shared/file-item.c                     |  17 +
 kernel-shared/file.c                          |   6 +-
 mkfs/rootdir.c                                | 369 ++++++++++++------
 tests/mkfs-tests/041-hole-detection/test.sh   |  48 ++-
 tests/mkfs-tests/042-rootdir-contents/test.sh |  57 +++
 tests/mkfs-tests/043-fiemap-detection/test.sh |  64 +++
 7 files changed, 420 insertions(+), 143 deletions(-)
 create mode 100755 tests/mkfs-tests/042-rootdir-contents/test.sh
 create mode 100755 tests/mkfs-tests/043-fiemap-detection/test.sh

--
2.53.0


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

end of thread, other threads:[~2026-04-03  4:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03  4:32 [PATCH v2 0/6] btrfs-progs: mkfs/rootdir: cleanup and new fiemap based prealloc detection Qu Wenruo
2026-04-03  4:32 ` [PATCH v2 1/6] btrfs-progs: mkfs-tests: also test hole-deteciton without no-holes Qu Wenruo
2026-04-03  4:32 ` [PATCH v2 2/6] btrfs-progs: mkfs-tests: add a test case to verify the content of rootdir Qu Wenruo
2026-04-03  4:32 ` [PATCH v2 3/6] btrfs-progs: implement the missing btrfs_insert_hole_extent() Qu Wenruo
2026-04-03  4:32 ` [PATCH v2 4/6] btrfs-progs: mkfs/rootdir: extract compressed write path Qu Wenruo
2026-04-03  4:32 ` [PATCH v2 5/6] btrfs-progs: mkfs/rootdir: use fiemap to do prealloc detection Qu Wenruo
2026-04-03  4:33 ` [PATCH v2 6/6] btrfs-progs: mkfs-tests: add a new test case for fiemap based detection Qu Wenruo

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