• Filipe Manana's avatar
    btrfs: skip unnecessary extent map searches during fiemap and lseek · 013f9c70
    Filipe Manana authored
    If we have no outstanding extents it means we don't have any extent maps
    corresponding to delalloc that is flushing, as when an ordered extent is
    created we increment the number of outstanding extents to 1 and when we
    remove the ordered extent we decrement them by 1. So skip extent map tree
    searches if the number of outstanding ordered extents is 0, saving time as
    the tree is not empty if we have previously made some reads or flushed
    delalloc, as in those cases it can have a very large number of extent maps
    for files with many extents.
    
    This helps save time when processing a file range corresponding to a hole
    or prealloc (unwritten) extent.
    
    The next patch in the series has a performance test in its changelog and
    its subject is:
    
        "btrfs: skip unnecessary delalloc search during fiemap and lseek"
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    013f9c70
file.c 115 KB