aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index d560831c10a7..2cee9df001f6 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -12,8 +12,9 @@ static int finish_current_insert(struct btrfs_trans_handle *trans, struct
12static int del_pending_extents(struct btrfs_trans_handle *trans, struct 12static int del_pending_extents(struct btrfs_trans_handle *trans, struct
13 btrfs_root *extent_root); 13 btrfs_root *extent_root);
14 14
15static int inc_block_ref(struct btrfs_trans_handle *trans, struct btrfs_root 15int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
16 *root, u64 blocknr, u64 num_blocks) 16 struct btrfs_root *root,
17 u64 blocknr, u64 num_blocks)
17{ 18{
18 struct btrfs_path *path; 19 struct btrfs_path *path;
19 int ret; 20 int ret;
@@ -50,8 +51,9 @@ static int inc_block_ref(struct btrfs_trans_handle *trans, struct btrfs_root
50 return 0; 51 return 0;
51} 52}
52 53
53static int lookup_block_ref(struct btrfs_trans_handle *trans, struct btrfs_root 54static int lookup_extent_ref(struct btrfs_trans_handle *trans,
54 *root, u64 blocknr, u64 num_blocks, u32 *refs) 55 struct btrfs_root *root, u64 blocknr,
56 u64 num_blocks, u32 *refs)
55{ 57{
56 struct btrfs_path *path; 58 struct btrfs_path *path;
57 int ret; 59 int ret;
@@ -80,7 +82,7 @@ static int lookup_block_ref(struct btrfs_trans_handle *trans, struct btrfs_root
80int btrfs_inc_root_ref(struct btrfs_trans_handle *trans, 82int btrfs_inc_root_ref(struct btrfs_trans_handle *trans,
81 struct btrfs_root *root) 83 struct btrfs_root *root)
82{ 84{
83 return inc_block_ref(trans, root, bh_blocknr(root->node), 1); 85 return btrfs_inc_extent_ref(trans, root, bh_blocknr(root->node), 1);
84} 86}
85 87
86int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, 88int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
@@ -107,13 +109,13 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
107 continue; 109 continue;
108 fi = btrfs_item_ptr(buf_leaf, i, 110 fi = btrfs_item_ptr(buf_leaf, i,
109 struct btrfs_file_extent_item); 111 struct btrfs_file_extent_item);
110 ret = inc_block_ref(trans, root, 112 ret = btrfs_inc_extent_ref(trans, root,
111 btrfs_file_extent_disk_blocknr(fi), 113 btrfs_file_extent_disk_blocknr(fi),
112 btrfs_file_extent_disk_num_blocks(fi)); 114 btrfs_file_extent_disk_num_blocks(fi));
113 BUG_ON(ret); 115 BUG_ON(ret);
114 } else { 116 } else {
115 blocknr = btrfs_node_blockptr(buf_node, i); 117 blocknr = btrfs_node_blockptr(buf_node, i);
116 ret = inc_block_ref(trans, root, blocknr, 1); 118 ret = btrfs_inc_extent_ref(trans, root, blocknr, 1);
117 BUG_ON(ret); 119 BUG_ON(ret);
118 } 120 }
119 } 121 }
@@ -563,7 +565,7 @@ static int walk_down_tree(struct btrfs_trans_handle *trans, struct btrfs_root
563 565
564 WARN_ON(*level < 0); 566 WARN_ON(*level < 0);
565 WARN_ON(*level >= BTRFS_MAX_LEVEL); 567 WARN_ON(*level >= BTRFS_MAX_LEVEL);
566 ret = lookup_block_ref(trans, root, bh_blocknr(path->nodes[*level]), 568 ret = lookup_extent_ref(trans, root, bh_blocknr(path->nodes[*level]),
567 1, &refs); 569 1, &refs);
568 BUG_ON(ret); 570 BUG_ON(ret);
569 if (refs > 1) 571 if (refs > 1)
@@ -587,7 +589,7 @@ static int walk_down_tree(struct btrfs_trans_handle *trans, struct btrfs_root
587 } 589 }
588 blocknr = btrfs_node_blockptr(btrfs_buffer_node(cur), 590 blocknr = btrfs_node_blockptr(btrfs_buffer_node(cur),
589 path->slots[*level]); 591 path->slots[*level]);
590 ret = lookup_block_ref(trans, root, blocknr, 1, &refs); 592 ret = lookup_extent_ref(trans, root, blocknr, 1, &refs);
591 BUG_ON(ret); 593 BUG_ON(ret);
592 if (refs != 1) { 594 if (refs != 1) {
593 path->slots[*level]++; 595 path->slots[*level]++;