]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/btrfs/extent-tree.c
Btrfs: always pin metadata in discard mode
[net-next-2.6.git] / fs / btrfs / extent-tree.c
index d4a35283d99e13e7cd9f4ad27140d51789ceed37..c56f91639dc13562dbe107dcd5d2d0f0e72683eb 100644 (file)
@@ -3686,6 +3686,14 @@ static int pin_down_bytes(struct btrfs_trans_handle *trans,
        if (is_data)
                goto pinit;
 
+       /*
+        * discard is sloooow, and so triggering discards on
+        * individual btree blocks isn't a good plan.  Just
+        * pin everything in discard mode.
+        */
+       if (btrfs_test_opt(root, DISCARD))
+               goto pinit;
+
        buf = btrfs_find_tree_block(root, bytenr, num_bytes);
        if (!buf)
                goto pinit;