• Josef Bacik's avatar
    Btrfs: fix how we merge extent states and deal with cached states · df98b6e2
    Josef Bacik authored
    First, we can sometimes free the state we're merging, which means anybody who
    calls merge_state() may have the state it passed in free'ed.  This is
    problematic because we could end up caching the state, which makes caching
    useless as the state will no longer be part of the tree.  So instead of free'ing
    the state we passed into merge_state(), set it's end to the other->end and free
    the other state.  This way we are sure to cache the correct state.  Also because
    we can merge states together, instead of only using the cache'd state if it's
    start == the start we are looking for, go ahead and use it if the start we are
    looking for is within the range of the cached state.  Thanks,
    Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
    df98b6e2
extent_io.c 93.8 KB