• Josef Bacik's avatar
    btrfs: cache the failed state when locking extents · 123a7f00
    Josef Bacik authored
    Currently if we fail to lock a range we'll return the start of the range
    that we failed to lock.  We'll then search down to this range and wait
    on any extent states in this range.
    
    However we can avoid this search altogether if we simply cache the
    extent_state that had the contention.  We can pass this into
    wait_extent_bit() and start from that extent_state without doing the
    search.  In the most optimistic case we can avoid all searches, more
    likely we'll avoid the initial search and have to perform the search
    after we wait on the failed state, or worst case we must search both
    times which is what currently happens.
    Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    123a7f00
extent-io-tree.c 43.6 KB