aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-10-14 09:38:28 -0400
committerChris Mason <chris.mason@oracle.com>2009-10-14 10:32:50 -0400
commit444528b3e614f7f2391488d9bca8e0b872db909b (patch)
tree5326be87610ed3fc7a14d0f28e96e5e22207cf5f /fs
parent0634857488ec6e28fa22920cd0bee3c2ac07ccfd (diff)
Btrfs: always pin metadata in discard mode
We have an optimization in btrfs to allow blocks to be immediately freed if they were allocated in this transaction and never written. Otherwise they are pinned and freed when the transaction commits. This isn't optimal for discard mode because immediately freeing them means immediately discarding them. It is better to give the block to the pinning code and letting the (slow) discard happen later. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index d4a35283d99e..c56f91639dc1 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3686,6 +3686,14 @@ static int pin_down_bytes(struct btrfs_trans_handle *trans,
3686 if (is_data) 3686 if (is_data)
3687 goto pinit; 3687 goto pinit;
3688 3688
3689 /*
3690 * discard is sloooow, and so triggering discards on
3691 * individual btree blocks isn't a good plan. Just
3692 * pin everything in discard mode.
3693 */
3694 if (btrfs_test_opt(root, DISCARD))
3695 goto pinit;
3696
3689 buf = btrfs_find_tree_block(root, bytenr, num_bytes); 3697 buf = btrfs_find_tree_block(root, bytenr, num_bytes);
3690 if (!buf) 3698 if (!buf)
3691 goto pinit; 3699 goto pinit;