Skip to content

btrfs: More intelligent degraded chunk allocator

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3btrfs: volumes: Refactor device holes gathering into a separate functionfs/btrfs/volumes.c+74 -553 replies
2/3btrfs: volumes: Add btrfs_fs_devices::missing_list to collect missing devicesfs/btrfs/volumes.c fs/btrfs/volumes.h+27 -64 replies
3/3btrfs: volumes: Allocate degraded chunks if rw devices can't fullfil a chunkfs/btrfs/block-group.c fs/btrfs/volumes.c+22 -68 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchQu Wenruo
1/3
2/3
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] btrfs: More intelligent degraded chunk allocator

This patchset will make btrfs degraded mount more intelligent and provide more consistent profile keeping function.

One of the most problematic aspect of degraded mount is, btrfs may create unwanted profiles.

 # mkfs.btrfs -f /dev/test/scratch[12] -m raid1 -d raid1
 # wipefs -fa /dev/test/scratch2
 # mount -o degraded /dev/test/scratch1 /mnt/btrfs
 # fallocate -l 1G /mnt/btrfs/foobar
 # btrfs ins dump-tree -t chunk /dev/test/scratch1
        item 7 key (FIRST_CHUNK_TREE CHUNK_ITEM 1674575872) itemoff 15511 itemsize 80
                length 536870912 owner 2 stripe_len 65536 type DATA
 New data chunk will fallback to SINGLE or DUP.

The cause is pretty simple, when mounted degraded, missing devices can't be used for chunk allocation.
Thus btrfs has to fall back to SINGLE profile.

This patchset will make btrfs to consider missing devices as last resort if current rw devices can't fulfil the profile request.

This should provide a good balance between considering all missing device as RW and completely ruling out missing devices (current mainline behavior).

Qu Wenruo (3):
btrfs: volumes: Refactor device holes gathering into a separate
function
btrfs: volumes: Add btrfs_fs_devices::missing_list to collect missing
devices
btrfs: volumes: Allocate degraded chunks if rw devices can't fullfil a
chunk

 fs/btrfs/block-group.c |  10 ++-
 fs/btrfs/volumes.c     | 170 ++++++++++++++++++++++++++---------------
 fs/btrfs/volumes.h     |   6 ++
 3 files changed, 121 insertions(+), 65 deletions(-)
Signature · 1 line
2.24.0