diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/delayed-ref.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index ae9411773397..105b265470dd 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c | |||
@@ -36,16 +36,19 @@ | |||
36 | * compare two delayed tree backrefs with same bytenr and type | 36 | * compare two delayed tree backrefs with same bytenr and type |
37 | */ | 37 | */ |
38 | static int comp_tree_refs(struct btrfs_delayed_tree_ref *ref2, | 38 | static int comp_tree_refs(struct btrfs_delayed_tree_ref *ref2, |
39 | struct btrfs_delayed_tree_ref *ref1) | 39 | struct btrfs_delayed_tree_ref *ref1, int type) |
40 | { | 40 | { |
41 | if (ref1->root < ref2->root) | 41 | if (type == BTRFS_TREE_BLOCK_REF_KEY) { |
42 | return -1; | 42 | if (ref1->root < ref2->root) |
43 | if (ref1->root > ref2->root) | 43 | return -1; |
44 | return 1; | 44 | if (ref1->root > ref2->root) |
45 | if (ref1->parent < ref2->parent) | 45 | return 1; |
46 | return -1; | 46 | } else { |
47 | if (ref1->parent > ref2->parent) | 47 | if (ref1->parent < ref2->parent) |
48 | return 1; | 48 | return -1; |
49 | if (ref1->parent > ref2->parent) | ||
50 | return 1; | ||
51 | } | ||
49 | return 0; | 52 | return 0; |
50 | } | 53 | } |
51 | 54 | ||
@@ -109,7 +112,8 @@ static int comp_entry(struct btrfs_delayed_ref_node *ref2, | |||
109 | if (ref1->type == BTRFS_TREE_BLOCK_REF_KEY || | 112 | if (ref1->type == BTRFS_TREE_BLOCK_REF_KEY || |
110 | ref1->type == BTRFS_SHARED_BLOCK_REF_KEY) { | 113 | ref1->type == BTRFS_SHARED_BLOCK_REF_KEY) { |
111 | return comp_tree_refs(btrfs_delayed_node_to_tree_ref(ref2), | 114 | return comp_tree_refs(btrfs_delayed_node_to_tree_ref(ref2), |
112 | btrfs_delayed_node_to_tree_ref(ref1)); | 115 | btrfs_delayed_node_to_tree_ref(ref1), |
116 | ref1->type); | ||
113 | } else if (ref1->type == BTRFS_EXTENT_DATA_REF_KEY || | 117 | } else if (ref1->type == BTRFS_EXTENT_DATA_REF_KEY || |
114 | ref1->type == BTRFS_SHARED_DATA_REF_KEY) { | 118 | ref1->type == BTRFS_SHARED_DATA_REF_KEY) { |
115 | return comp_data_refs(btrfs_delayed_node_to_data_ref(ref2), | 119 | return comp_data_refs(btrfs_delayed_node_to_data_ref(ref2), |