• Filipe Manana's avatar
    btrfs: remove pointless loop from btrfs_update_block_group() · 4d20c1de
    Filipe Manana authored
    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 9078a3e1 ("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: default avatarFilipe Manana <fdmanana@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    4d20c1de
block-group.c 135 KB