Skip to content
  • Filipe Manana's avatar
    Btrfs: remove unnecessary condition in btrfs_clone() to avoid too much nesting · b64119b5
    Filipe Manana authored
    
    
    The bulk of the work done when cloning extents, at ioctl.c:btrfs_clone(),
    is done inside an if statement that checks if the found key has the type
    BTRFS_EXTENT_DATA_KEY. That if statement is redundant however, because
    btrfs_search_slot() always leaves us in a leaf slot that points to a key
    that is always greater then or equals to the search key, and our search
    key here has that type, and because we bail out before that if statement
    if the key at the given leaf slot is greater then BTRFS_EXTENT_DATA_KEY.
    
    Therefore just remove that if statement, not only because it is useless
    but mostly because it increases the nesting/indentation level in this
    function which is quite big and makes things a bit awkward whenever I need
    to fix something that requires changing btrfs_clone() (and it has been
    like that for many years already).
    
    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>
    b64119b5