• Filipe Manana's avatar
    btrfs: remove useless condition check before splitting leaf · e5e1c174
    Filipe Manana authored
    When inserting a key, we check if the write_lock_level is less than 1,
    and if so we set it to 1, release the path and retry the tree traversal.
    
    However that is unnecessary, because when ins_len is greater than 0, we
    know that write_lock_level can never be less than 1.
    
    The logic to retry is also buggy, because in case ins_len was decremented,
    due to an exact key match and the search is not meant for item extension
    (path->search_for_extension is 0), we retry without incrementing ins_len,
    which would make the next retry decrement it again by the same amount.
    
    So remove the check for write_lock_level being less than 1 and add an
    assertion to assert it's always >= 1.
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    e5e1c174
ctree.c 124 KB