Btrfs: add missing extent state caching calls
authorFilipe David Borba Manana <fdmanana@gmail.com>
Tue, 26 Nov 2013 15:01:34 +0000 (15:01 +0000)
committerChris Mason <clm@fb.com>
Tue, 28 Jan 2014 21:19:48 +0000 (13:19 -0800)
When we didn't find a matching extent state, we inserted a new one
but didn't cache it in the **cached_state parameter, which makes a
subsequent call do a tree lookup to get it.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/extent_io.c

index 3721820687d78c3258efd0bbffb46ac3f335bf8a..01a1412458622bb096649fbef0176396be01f5ad 100644 (file)
@@ -817,6 +817,7 @@ again:
                if (err)
                        extent_io_tree_panic(tree, err);
 
+               cache_state(prealloc, cached_state);
                prealloc = NULL;
                goto out;
        }
@@ -1040,9 +1041,10 @@ again:
                        goto out;
                }
                err = insert_state(tree, prealloc, start, end, &bits);
-               prealloc = NULL;
                if (err)
                        extent_io_tree_panic(tree, err);
+               cache_state(prealloc, cached_state);
+               prealloc = NULL;
                goto out;
        }
        state = rb_entry(node, struct extent_state, rb_node);