btrfs-progs: rework how we traverse rootdir
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest5 patches 0 repliesNew
- v13 patches 6 repliesSuperseded
Changes in v2 from the cover letter
- Change the current_path.level, so that 0 means uninitialized This makes the current_path level to match the ftwbuf level.
- Add a comment explaining how the current_path stack works With an example layout and stack changes.
- Add two new test cases
Both test cases are for the old rootdir bugs:
* Extra hard link are out of the rootdir
Old --rootdir will create a corrupted fs with incorrect nlink. This is because we use st_nlink without any extra verification
* Conflicting inode numbers caused by different mount points Old --rootdir will fail gracefully, but still not ideal as the error message doesn't explain it at all.
This is because we use st_inode without any extra verification
- Newline and typo fixes
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | btrfs-progs: constify the name parameter of btrfs_add_link()kernel-shared/ kernel-shared/ | +2 | 0 replies | |
| 2/5 | btrfs-progs: mkfs: rework how we traverse rootdirmkfs/ mkfs/ | +290 | 0 replies | |
| 3/5 | btrfs-progs: rootdir: warn about hard linksmkfs/ | +15 | 0 replies | |
| 4/5 | btrfs-progs: mkfs-tests: a new test case to verify handling of hard linkstests/ | +24 | 0 replies | |
| 5/5 | btrfs-progs: mkfs-tests: verify cross mount point behavior for rootdirtests/ | +46 | 0 replies |
Reviews trailers per patch
2 of 5 patches have a Reviewed-by or Acked-by.
| Patch | Boris Burkov |
|---|---|
| 1/5 | R-b |
| 2/5 | R-b |
| 3/5 | |
| 4/5 | |
| 5/5 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/5] btrfs-progs: rework how we traverse rootdir
[CHANGELOG]
v2:
- Change the current_path.level, so that 0 means uninitialized This makes the current_path level to match the ftwbuf level.
- Add a comment explaining how the current_path stack works With an example layout and stack changes.
- Add two new test cases
Both test cases are for the old rootdir bugs:
* Extra hard link are out of the rootdir
Old --rootdir will create a corrupted fs with incorrect nlink. This is because we use st_nlink without any extra verification
* Conflicting inode numbers caused by different mount points Old --rootdir will fail gracefully, but still not ideal as the error message doesn't explain it at all.
This is because we use st_inode without any extra verification
- Newline and typo fixes
Thanks to Mark's recent work, I finally get some time to rework rootdir traversal.
All the problems are described inside the second patch. While the last patch is a small enhancement to --rootdir to reject hard links.
With this change, it's much easier to support subvolume creations at mkfs time:
- Create a hashmap (or other similar structure) to record all the directories that should be subvolume
- Call btrfs_make_subvoume() other than btrfs_insert_inode() if a path should be a subvolume
- Call btrfs_link_subvolume() other than btrfs_add_link() for a subvolume
Everything like parent directory inode size is properly handled by btrfs_link_subvolume() and btrfs_add_link() already.
Qu Wenruo (5):
btrfs-progs: constify the name parameter of btrfs_add_link()
btrfs-progs: mkfs: rework how we traverse rootdir
btrfs-progs: rootdir: warn about hard links
btrfs-progs: mkfs-tests: a new test case to verify handling of hard
links
btrfs-progs: mkfs-tests: verify cross mount point behavior for rootdir
kernel-shared/ctree.h | 2 +- kernel-shared/inode.c | 2 +- mkfs/rootdir.c | 711 ++++++++---------- mkfs/rootdir.h | 8 - .../034-rootdir-extra-hard-links/test.sh | 24 + .../035-rootdir-cross-mount/test.sh | 46 ++ 6 files changed, 377 insertions(+), 416 deletions(-) create mode 100755 tests/mkfs-tests/034-rootdir-extra-hard-links/test.sh create mode 100755 tests/mkfs-tests/035-rootdir-cross-mount/test.sh
--
2.45.2