]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: codify pattern for adding block_group to bg_list
authorBoris Burkov <boris@bur.io>
Thu, 6 Mar 2025 00:30:24 +0000 (16:30 -0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Mar 2025 19:35:51 +0000 (20:35 +0100)
commit0497dfba98c00edbc7af12d53c0b1138eb318bf7
treed7e4ec07b3327451987b9a35e2d6def274cb0678
parent7cbce3cb4c5cfffd8b08f148e2136afc1ec1ba94
btrfs: codify pattern for adding block_group to bg_list

Similar to mark_bg_unused() and mark_bg_to_reclaim(), we have a few
places that use bg_list with refcounting, mostly for retrying failures
to reclaim/delete unused.

These have custom logic for handling locking and refcounting the bg_list
properly, but they actually all want to do the same thing, so pull that
logic out into a helper. Unfortunately, mark_bg_unused() does still need
the NEW flag to avoid prematurely marking stuff unused (even if refcount
is fine, we don't want to mess with bg creation), so it cannot use the
new helper.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/block-group.c