Skip to content

btrfs-progs: mkfs/rootdir: cleanup and test case enhancement

Qu Wenruo linux-btrfs 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 0 repliesNew
  2. v35 patches 0 repliesSuperseded
  3. v26 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches0 repliesSuperseded

Changes in v4 from the cover letter

- Fix a bug that adds the data size twice
It's in the last patch, when the source fs supports SEEK_DATA, ftw_data_size is added twice (by on-disk size and st_size)

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5btrfs-progs: mkfs-tests: also test hole-deteciton without no-holestests/mkfs-tests/041-hole-detection/test.sh+27 -210 replies
2/5btrfs-progs: mkfs-tests: add a test case to verify the content of rootdirMakefile tests/mkfs-tests/042-rootdir-contents/test.sh+58 -10 replies
3/5btrfs-progs: implement the missing btrfs_insert_hole_extent()kernel-shared/file-item.c kernel-shared/file.c mkfs/rootdir.c+20 -110 replies
4/5btrfs-progs: mkfs/rootdir: extract compressed write pathmkfs/rootdir.c+141 -1080 replies
5/5btrfs-progs: mkfs/rootdir: use st_blocks for size estimationmkfs/rootdir.c+19 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/5] btrfs-progs: mkfs/rootdir: cleanup and test case enhancement

[CHANGELOG]
v4:
- Fix a bug that adds the data size twice
It's in the last patch, when the source fs supports SEEK_DATA, ftw_data_size is added twice (by on-disk size and st_size)

v3:
- Remove the fiemap based prealloc detection
The complexity doesn't really bring any other benefit and preallocated space itself is not that commonly used for fs image creation.

- Update the image size estimation
To fully co-operate with the new hole detection.

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

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 final one is to use st_blocks to estimate the data size, so the resulted fs image can be as small as possible.

Qu Wenruo (5):
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 st_blocks for size estimation

 Makefile                                      |   2 +-
 kernel-shared/file-item.c                     |  17 ++
 kernel-shared/file.c                          |   6 +-
 mkfs/rootdir.c                                | 277 ++++++++++--------
 tests/mkfs-tests/041-hole-detection/test.sh   |  48 +--
 tests/mkfs-tests/042-rootdir-contents/test.sh |  57 ++++
 6 files changed, 265 insertions(+), 142 deletions(-)
 create mode 100755 tests/mkfs-tests/042-rootdir-contents/test.sh

--
2.53.0