• Filipe Manana's avatar
    btrfs: pass a space_info argument to btrfs_reserve_metadata_bytes() · 03551d65
    Filipe Manana authored
    We are passing a block reserve argument to btrfs_reserve_metadata_bytes()
    which is not really used, all we need is to pass the space_info associated
    to the block reserve, we don't change the block reserve at all.
    
    Not only it's pointless to pass the block reserve, it's also confusing as
    one might think that the reserved bytes will end up being added to the
    passed block reserve, when that's not the case. The pattern for reserving
    space and adding it to a block reserve is to first reserve space with
    btrfs_reserve_metadata_bytes() and if that succeeds, then add the space to
    a block reserve by calling btrfs_block_rsv_add_bytes().
    
    Also the reverse of btrfs_reserve_metadata_bytes(), which is
    btrfs_space_info_free_bytes_may_use(), takes a space_info argument and
    not a block reserve, so one more reason to pass a space_info and not a
    block reserve to btrfs_reserve_metadata_bytes().
    
    So change btrfs_reserve_metadata_bytes() and its callers to pass a
    space_info argument instead of a block reserve argument.
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    03551d65
delayed-ref.c 31.2 KB