Skip to content

btrfs-progs: mkfs: make sure we can clean up all temporary chunks

Qu Wenruo linux-btrfs 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 10 repliesIn review
  2. v13 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- Remove a duplicated recow_roots() call in create_raid_groups() This call makes no difference as we will later commit transaction and manually call recow_roots() again.
Remove such duplicated call to save some time.

- Replace the btrfs_next_sibling_tree_block() with btrfs_next_leaf() Since we're always handling leaves, there is no need for btrfs_next_sibling_tree_block()

- Work around a kernel bug which may cause false alerts
For single device RAID0, btrfs kernel is not respecting it, and will allocate new chunks using SINGLE instead.
This can be very noisy and cause false alerts, and not always reproducible, depending on how fast kernel creates new chunks.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs-progs: rename @data parameter to @profile in extent allocation pathkernel-shared/extent-tree.c+13 -130 replies
2/3btrfs-progs: mkfs: recow all tree blocks properlymkfs/main.c+77 -131 reply
3/3btrfs-progs: mfks-tests: make sure mkfs.btrfs cleans up temporary chunkstests/mkfs-tests/001-basic-profiles/test.sh+14 -22 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/3] btrfs-progs: mkfs: make sure we can clean up all temporary chunks

There is a bug report that with certain mkfs options, mkfs.btrfs may fail to cleanup some temporary chunks, leading to "btrfs filesystem df" warning about multiple profiles:

WARNING: Multiple block group profiles detected, see 'man btrfs(5)'.
WARNING: Metadata: single, raid1

The easiest way to reproduce is "mkfs.btrfs -f -R free-space-tree -m dup -d dup".

It turns out that, the old _recow_root() can not handle tree levels > 0, while with newer free space tree creation timing, the free space tree can reach level 1 or higher.

To fix the problem, Patch 2 will do the proper full tree re-CoW, with extra transaction commitment to make sure all free space tree get re-CoWed.

The 3rd patch will do the extra verification during mkfs-tests.

The first patch is just to fix a confusing parameter which also caused u64 -> int width reduction and can be problematic in the future.

Changelog:
v2:
- Remove a duplicated recow_roots() call in create_raid_groups() This call makes no difference as we will later commit transaction and manually call recow_roots() again.
Remove such duplicated call to save some time.

- Replace the btrfs_next_sibling_tree_block() with btrfs_next_leaf() Since we're always handling leaves, there is no need for btrfs_next_sibling_tree_block()

- Work around a kernel bug which may cause false alerts
For single device RAID0, btrfs kernel is not respecting it, and will allocate new chunks using SINGLE instead.
This can be very noisy and cause false alerts, and not always reproducible, depending on how fast kernel creates new chunks.

Work around it by mounting the RO before calling "btrfs fi df".

The kernel bug needs to be investigated and fixed.

Qu Wenruo (3):
btrfs-progs: rename @data parameter to @profile in extent allocation
path
btrfs-progs: mkfs: recow all tree blocks properly
btrfs-progs: mfks-tests: make sure mkfs.btrfs cleans up temporary
chunks

 kernel-shared/extent-tree.c                 | 26 +++---
 mkfs/main.c                                 | 90 ++++++++++++++++++---
 tests/mkfs-tests/001-basic-profiles/test.sh | 16 +++-
 3 files changed, 104 insertions(+), 28 deletions(-)
Signature · 1 line
2.33.0