• Filipe Manana's avatar
    btrfs: correctly calculate delayed ref bytes when starting transaction · 0f69d1f4
    Filipe Manana authored
    When starting a transaction, we are assuming the number of bytes used for
    each delayed ref update matches the number of bytes used for each item
    update, that is the return value of:
    
       btrfs_calc_insert_metadata_size(fs_info, num_items)
    
    However that is not correct when we are using the free space tree, as we
    need to multiply that value by 2, since delayed ref updates need to modify
    the free space tree besides the extent tree.
    
    So fix this by using btrfs_calc_delayed_ref_bytes() to get the correct
    number of bytes used for delayed ref updates.
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    0f69d1f4
transaction.c 77.9 KB