• Filipe Manana's avatar
    btrfs: avoid pointless extent map tree search when flushing delalloc · b54bb865
    Filipe Manana authored
    When flushing delalloc, in COW mode at cow_file_range(), before entering
    the loop that allocates extents and creates ordered extents, we do a call
    to btrfs_drop_extent_map_range() for the whole range. This is pointless
    because in the loop we call create_io_em(), which will also call
    btrfs_drop_extent_map_range() before inserting the new extent map.
    
    So remove that call at cow_file_range() not only because it is not needed,
    but also because it will make the btrfs_drop_extent_map_range() calls made
    from create_io_em() waste time searching the extent map tree, and that
    tree can be large for files with many extents. It also makes us waste time
    at btrfs_drop_extent_map_range() allocating and freeing the split extent
    maps for nothing.
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    b54bb865
inode.c 323 KB