]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: populate fully_remapped_bgs_list on mount
authorMark Harmstone <mark@harmstone.com>
Wed, 7 Jan 2026 14:09:17 +0000 (14:09 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:54:36 +0000 (07:54 +0100)
commit2aef934b56b3ae07c292831cf9bf6bafcaaa005e
treea41b591e015f426b0a849aee97acfa42bd19acd6
parent7cddbb4339d4be16aa5341e3a27e63c34d2c4e0d
btrfs: populate fully_remapped_bgs_list on mount

Add a function btrfs_populate_fully_remapped_bgs_list() which gets
called on mount, which looks for fully remapped block groups
(i.e. identity_remap_count == 0) which haven't yet had their chunk
stripes and device extents removed.

This happens when a filesystem is unmounted while async discard has not
yet finished, as otherwise the data range occupied by the chunk stripes
would be permanently unusable.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c
fs/btrfs/block-group.h
fs/btrfs/disk-io.c
fs/btrfs/free-space-cache.c
fs/btrfs/relocation.c