aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorLiu Bo <liubo2009@cn.fujitsu.com>2012-07-23 07:50:03 -0400
committerChris Mason <chris.mason@fusionio.com>2012-07-23 16:28:10 -0400
commitdf57dbe6bf73cc44305d81c24982a11da49b1f79 (patch)
tree4695986bc2458a8a66b5ac217a5ed03941014937 /fs/btrfs
parent51561ffec9614618f3da362f9d1b03a95b717484 (diff)
Btrfs: make btrfs's allocation smoothly with preallocation
For backref walking, we've introduce delayed ref's sequence. However, it changes our preallocation behavior. The story is that when we preallocate an extent and then mark it written piece by piece, the ideal case should be that we don't need to COW the extent, which is why we use 'preallocate'. But we may not make use of preallocation, since when we check for cross refs on the extent, we may have two ref entries which have the same content except the sequence value, and we recognize them as cross refs and do COW to allocate another extent. So we end up with several pieces of space instead of an whole extent. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/extent-tree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 6621ed72f3c3..71b2d1c7da69 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2581,8 +2581,10 @@ static noinline int check_delayed_ref(struct btrfs_trans_handle *trans,
2581 2581
2582 node = rb_prev(node); 2582 node = rb_prev(node);
2583 if (node) { 2583 if (node) {
2584 int seq = ref->seq;
2585
2584 ref = rb_entry(node, struct btrfs_delayed_ref_node, rb_node); 2586 ref = rb_entry(node, struct btrfs_delayed_ref_node, rb_node);
2585 if (ref->bytenr == bytenr) 2587 if (ref->bytenr == bytenr && ref->seq == seq)
2586 goto out_unlock; 2588 goto out_unlock;
2587 } 2589 }
2588 2590