• Marcos Paulo de Souza's avatar
    btrfs: introduce btrfs_search_backwards function · 0ff40a91
    Marcos Paulo de Souza authored
    It's a common practice to start a search using offset (u64)-1, which is
    the u64 maximum value, meaning that we want the search_slot function to
    be set in the last item with the same objectid and type.
    
    Once we are in this position, it's a matter to start a search backwards
    by calling btrfs_previous_item, which will check if we'll need to go to
    a previous leaf and other necessary checks, only to be sure that we are
    in last offset of the same object and type.
    
    The new btrfs_search_backwards function does the all these steps when
    necessary, and can be used to avoid code duplication.
    Signed-off-by: default avatarMarcos Paulo de Souza <mpdesouza@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    0ff40a91
volumes.c 219 KB