Skip to content

mkfs/rootdir: refactor and enhancements, part 1

Qu Wenruo linux-btrfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs-progs: rename logical bytenr parameter for add_file_item_extent()kernel-shared/extent_io.c mkfs/rootdir.c+18 -180 replies
2/3btrfs: mkfs/rootdir: refactor the last block handlingmkfs/rootdir.c+63 -920 replies
3/3btrfs-progs: mkfs-tests: add a new one for '--reflink' optiontests/mkfs-tests/043-rootdir-reflink/test.sh+57 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/3] mkfs/rootdir: refactor and enhancements, part 1

We have "--reflink" option introduced for mkfs for a while, and recently the new get_csums ioctl is also introduced, making add_file_item_extent() much larger and harder to maintain.

I have some concerns about the larger and larger add_file_item_extent(), and will address some of them in the series:

- Minor mismatches on some parameter/variable names Use more commonly used names to replace them.

- Duplicated partial block handling
Which not only makes add_file_item_extent() larger but also harder to read/maintain.

To remove those duplicated partial block handling, the idea is to shrink the range to block boundary when possible.
If we can not shrink the range anymore, disable reflink/get_csums.

So that we do not need to handle partial blocks for reflink/get_csums. All the duplicated code can be removed.

- No test case for --reflink nor the latest get_csums option A new test case, to verify all above mentioned cases.

Qu Wenruo (3):
btrfs-progs: rename logical bytenr parameter for
add_file_item_extent()
btrfs: mkfs/rootdir: refactor the last block handling
btrfs-progs: mkfs-tests: add a new one for '--reflink' option

 kernel-shared/extent_io.c                    |  10 +-
 mkfs/rootdir.c                               | 175 ++++++++-----------
 tests/mkfs-tests/043-rootdir-reflink/test.sh |  57 ++++++
 3 files changed, 135 insertions(+), 107 deletions(-)
 create mode 100755 tests/mkfs-tests/043-rootdir-reflink/test.sh

--
2.54.0