• Filipe Manana's avatar
    btrfs: don't reserve space for checksums when writing to nocow files · feefe1f4
    Filipe Manana authored
    Currently when doing a write to a file we always reserve metadata space
    for inserting data checksums. However we don't need to do it if we have
    a nodatacow file (-o nodatacow mount option or chattr +C) or if checksums
    are disabled (-o nodatasum mount option), as in that case we are only
    adding unnecessary pressure to metadata reservations.
    
    For example on x86_64, with the default node size of 16K, a 4K buffered
    write into a nodatacow file is reserving 655360 bytes of metadata space,
    as it's accounting for checksums. After this change, which stops reserving
    space for checksums if we have a nodatacow file or checksums are disabled,
    we only need to reserve 393216 bytes of metadata.
    
    CC: stable@vger.kernel.org # 6.1+
    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>
    feefe1f4
delalloc-space.c 17.4 KB