]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: remove pointless loop from btrfs_update_block_group()
authorFilipe Manana <fdmanana@suse.com>
Wed, 13 Sep 2023 11:23:18 +0000 (12:23 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 12 Oct 2023 14:44:07 +0000 (16:44 +0200)
commit4d20c1def946f1faa57334c4b99d3cb0ccd18944
tree2c2b755b32a7fac455d7e7f4bc8fcdb1f8da84df
parent4ebe8d478879c84a9e0c4f655cd8652fdbe239ac
btrfs: remove pointless loop from btrfs_update_block_group()

When an extent is allocated or freed, we call btrfs_update_block_group()
to update its block group and space info. An extent always belongs to a
single block group, it can never span multiple block groups, so the loop
we have at btrfs_update_block_group() is pointless, as it always has a
single iteration. The loop was added in the very early days, 2007, when
the block group code was added in commit 9078a3e1e4e4 ("Btrfs: start of
block group code"), but even back then it seemed pointless.

So remove the loop and assert the block group containing the start offset
of the extent also contains the whole extent.

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