aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-13 10:46:10 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-13 10:46:10 -0400
commit234b63a091e1df6bd4261dd7b3a7490074830628 (patch)
tree1947f6e49aa3c19017c948205378c5cb76a7b536 /fs/btrfs/extent-tree.c
parentcf27e1eec063fa68a89c57ae0a83f93aa38851d6 (diff)
rename funcs and structs to btrfs
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c147
1 files changed, 74 insertions, 73 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 1676a6595cce..4a4f2d810d9f 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6,11 +6,11 @@
6#include "disk-io.h" 6#include "disk-io.h"
7#include "print-tree.h" 7#include "print-tree.h"
8 8
9static int find_free_extent(struct ctree_root *orig_root, u64 num_blocks, 9static int find_free_extent(struct btrfs_root *orig_root, u64 num_blocks,
10 u64 search_start, u64 search_end, 10 u64 search_start, u64 search_end,
11 struct btrfs_key *ins); 11 struct btrfs_key *ins);
12static int finish_current_insert(struct ctree_root *extent_root); 12static int finish_current_insert(struct btrfs_root *extent_root);
13static int run_pending(struct ctree_root *extent_root); 13static int run_pending(struct btrfs_root *extent_root);
14 14
15/* 15/*
16 * pending extents are blocks that we're trying to allocate in the extent 16 * pending extents are blocks that we're trying to allocate in the extent
@@ -21,62 +21,63 @@ static int run_pending(struct ctree_root *extent_root);
21 */ 21 */
22#define CTREE_EXTENT_PENDING_DEL 0 22#define CTREE_EXTENT_PENDING_DEL 0
23 23
24static int inc_block_ref(struct ctree_root *root, u64 blocknr) 24static int inc_block_ref(struct btrfs_root *root, u64 blocknr)
25{ 25{
26 struct ctree_path path; 26 struct btrfs_path path;
27 int ret; 27 int ret;
28 struct btrfs_key key; 28 struct btrfs_key key;
29 struct leaf *l; 29 struct btrfs_leaf *l;
30 struct extent_item *item; 30 struct btrfs_extent_item *item;
31 struct btrfs_key ins; 31 struct btrfs_key ins;
32 u32 refs; 32 u32 refs;
33 33
34 find_free_extent(root->extent_root, 0, 0, (u64)-1, &ins); 34 find_free_extent(root->extent_root, 0, 0, (u64)-1, &ins);
35 init_path(&path); 35 btrfs_init_path(&path);
36 key.objectid = blocknr; 36 key.objectid = blocknr;
37 key.flags = 0; 37 key.flags = 0;
38 key.offset = 1; 38 key.offset = 1;
39 ret = search_slot(root->extent_root, &key, &path, 0, 1); 39 ret = btrfs_search_slot(root->extent_root, &key, &path, 0, 1);
40 if (ret != 0) 40 if (ret != 0)
41 BUG(); 41 BUG();
42 BUG_ON(ret != 0); 42 BUG_ON(ret != 0);
43 l = &path.nodes[0]->leaf; 43 l = &path.nodes[0]->leaf;
44 item = (struct extent_item *)(l->data + btrfs_item_offset(l->items + 44 item = (struct btrfs_extent_item *)(l->data +
45 path.slots[0])); 45 btrfs_item_offset(l->items +
46 path.slots[0]));
46 refs = btrfs_extent_refs(item); 47 refs = btrfs_extent_refs(item);
47 btrfs_set_extent_refs(item, refs + 1); 48 btrfs_set_extent_refs(item, refs + 1);
48 49
49 BUG_ON(list_empty(&path.nodes[0]->dirty)); 50 BUG_ON(list_empty(&path.nodes[0]->dirty));
50 release_path(root->extent_root, &path); 51 btrfs_release_path(root->extent_root, &path);
51 finish_current_insert(root->extent_root); 52 finish_current_insert(root->extent_root);
52 run_pending(root->extent_root); 53 run_pending(root->extent_root);
53 return 0; 54 return 0;
54} 55}
55 56
56static int lookup_block_ref(struct ctree_root *root, u64 blocknr, u32 *refs) 57static int lookup_block_ref(struct btrfs_root *root, u64 blocknr, u32 *refs)
57{ 58{
58 struct ctree_path path; 59 struct btrfs_path path;
59 int ret; 60 int ret;
60 struct btrfs_key key; 61 struct btrfs_key key;
61 struct leaf *l; 62 struct btrfs_leaf *l;
62 struct extent_item *item; 63 struct btrfs_extent_item *item;
63 init_path(&path); 64 btrfs_init_path(&path);
64 key.objectid = blocknr; 65 key.objectid = blocknr;
65 key.flags = 0; 66 key.flags = 0;
66 key.offset = 1; 67 key.offset = 1;
67 ret = search_slot(root->extent_root, &key, &path, 0, 0); 68 ret = btrfs_search_slot(root->extent_root, &key, &path, 0, 0);
68 if (ret != 0) 69 if (ret != 0)
69 BUG(); 70 BUG();
70 l = &path.nodes[0]->leaf; 71 l = &path.nodes[0]->leaf;
71 item = (struct extent_item *)(l->data + 72 item = (struct btrfs_extent_item *)(l->data +
72 btrfs_item_offset(l->items + 73 btrfs_item_offset(l->items +
73 path.slots[0])); 74 path.slots[0]));
74 *refs = btrfs_extent_refs(item); 75 *refs = btrfs_extent_refs(item);
75 release_path(root->extent_root, &path); 76 btrfs_release_path(root->extent_root, &path);
76 return 0; 77 return 0;
77} 78}
78 79
79int btrfs_inc_ref(struct ctree_root *root, struct tree_buffer *buf) 80int btrfs_inc_ref(struct btrfs_root *root, struct btrfs_buffer *buf)
80{ 81{
81 u64 blocknr; 82 u64 blocknr;
82 int i; 83 int i;
@@ -93,9 +94,9 @@ int btrfs_inc_ref(struct ctree_root *root, struct tree_buffer *buf)
93 return 0; 94 return 0;
94} 95}
95 96
96int btrfs_finish_extent_commit(struct ctree_root *root) 97int btrfs_finish_extent_commit(struct btrfs_root *root)
97{ 98{
98 struct ctree_root *extent_root = root->extent_root; 99 struct btrfs_root *extent_root = root->extent_root;
99 unsigned long gang[8]; 100 unsigned long gang[8];
100 int ret; 101 int ret;
101 int i; 102 int i;
@@ -115,10 +116,10 @@ int btrfs_finish_extent_commit(struct ctree_root *root)
115 return 0; 116 return 0;
116} 117}
117 118
118static int finish_current_insert(struct ctree_root *extent_root) 119static int finish_current_insert(struct btrfs_root *extent_root)
119{ 120{
120 struct btrfs_key ins; 121 struct btrfs_key ins;
121 struct extent_item extent_item; 122 struct btrfs_extent_item extent_item;
122 int i; 123 int i;
123 int ret; 124 int ret;
124 125
@@ -130,7 +131,7 @@ static int finish_current_insert(struct ctree_root *extent_root)
130 131
131 for (i = 0; i < extent_root->current_insert.flags; i++) { 132 for (i = 0; i < extent_root->current_insert.flags; i++) {
132 ins.objectid = extent_root->current_insert.objectid + i; 133 ins.objectid = extent_root->current_insert.objectid + i;
133 ret = insert_item(extent_root, &ins, &extent_item, 134 ret = btrfs_insert_item(extent_root, &ins, &extent_item,
134 sizeof(extent_item)); 135 sizeof(extent_item));
135 BUG_ON(ret); 136 BUG_ON(ret);
136 } 137 }
@@ -141,14 +142,14 @@ static int finish_current_insert(struct ctree_root *extent_root)
141/* 142/*
142 * remove an extent from the root, returns 0 on success 143 * remove an extent from the root, returns 0 on success
143 */ 144 */
144int __free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks) 145static int __free_extent(struct btrfs_root *root, u64 blocknr, u64 num_blocks)
145{ 146{
146 struct ctree_path path; 147 struct btrfs_path path;
147 struct btrfs_key key; 148 struct btrfs_key key;
148 struct ctree_root *extent_root = root->extent_root; 149 struct btrfs_root *extent_root = root->extent_root;
149 int ret; 150 int ret;
150 struct btrfs_item *item; 151 struct btrfs_item *item;
151 struct extent_item *ei; 152 struct btrfs_extent_item *ei;
152 struct btrfs_key ins; 153 struct btrfs_key ins;
153 u32 refs; 154 u32 refs;
154 155
@@ -157,16 +158,16 @@ int __free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks)
157 key.offset = num_blocks; 158 key.offset = num_blocks;
158 159
159 find_free_extent(root, 0, 0, (u64)-1, &ins); 160 find_free_extent(root, 0, 0, (u64)-1, &ins);
160 init_path(&path); 161 btrfs_init_path(&path);
161 ret = search_slot(extent_root, &key, &path, -1, 1); 162 ret = btrfs_search_slot(extent_root, &key, &path, -1, 1);
162 if (ret) { 163 if (ret) {
163 printf("failed to find %Lu\n", key.objectid); 164 printf("failed to find %Lu\n", key.objectid);
164 print_tree(extent_root, extent_root->node); 165 btrfs_print_tree(extent_root, extent_root->node);
165 printf("failed to find %Lu\n", key.objectid); 166 printf("failed to find %Lu\n", key.objectid);
166 BUG(); 167 BUG();
167 } 168 }
168 item = path.nodes[0]->leaf.items + path.slots[0]; 169 item = path.nodes[0]->leaf.items + path.slots[0];
169 ei = (struct extent_item *)(path.nodes[0]->leaf.data + 170 ei = (struct btrfs_extent_item *)(path.nodes[0]->leaf.data +
170 btrfs_item_offset(item)); 171 btrfs_item_offset(item));
171 BUG_ON(ei->refs == 0); 172 BUG_ON(ei->refs == 0);
172 refs = btrfs_extent_refs(ei) - 1; 173 refs = btrfs_extent_refs(ei) - 1;
@@ -180,14 +181,14 @@ int __free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks)
180 BUG_ON(err); 181 BUG_ON(err);
181 radix_tree_preload_end(); 182 radix_tree_preload_end();
182 } 183 }
183 ret = del_item(extent_root, &path); 184 ret = btrfs_del_item(extent_root, &path);
184 if (root != extent_root && 185 if (root != extent_root &&
185 extent_root->last_insert.objectid < blocknr) 186 extent_root->last_insert.objectid < blocknr)
186 extent_root->last_insert.objectid = blocknr; 187 extent_root->last_insert.objectid = blocknr;
187 if (ret) 188 if (ret)
188 BUG(); 189 BUG();
189 } 190 }
190 release_path(extent_root, &path); 191 btrfs_release_path(extent_root, &path);
191 finish_current_insert(extent_root); 192 finish_current_insert(extent_root);
192 return ret; 193 return ret;
193} 194}
@@ -196,10 +197,10 @@ int __free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks)
196 * find all the blocks marked as pending in the radix tree and remove 197 * find all the blocks marked as pending in the radix tree and remove
197 * them from the extent map 198 * them from the extent map
198 */ 199 */
199static int del_pending_extents(struct ctree_root *extent_root) 200static int del_pending_extents(struct btrfs_root *extent_root)
200{ 201{
201 int ret; 202 int ret;
202 struct tree_buffer *gang[4]; 203 struct btrfs_buffer *gang[4];
203 int i; 204 int i;
204 205
205 while(1) { 206 while(1) {
@@ -214,13 +215,13 @@ static int del_pending_extents(struct ctree_root *extent_root)
214 radix_tree_tag_clear(&extent_root->cache_radix, 215 radix_tree_tag_clear(&extent_root->cache_radix,
215 gang[i]->blocknr, 216 gang[i]->blocknr,
216 CTREE_EXTENT_PENDING_DEL); 217 CTREE_EXTENT_PENDING_DEL);
217 tree_block_release(extent_root, gang[i]); 218 btrfs_block_release(extent_root, gang[i]);
218 } 219 }
219 } 220 }
220 return 0; 221 return 0;
221} 222}
222 223
223static int run_pending(struct ctree_root *extent_root) 224static int run_pending(struct btrfs_root *extent_root)
224{ 225{
225 while(radix_tree_tagged(&extent_root->cache_radix, 226 while(radix_tree_tagged(&extent_root->cache_radix,
226 CTREE_EXTENT_PENDING_DEL)) 227 CTREE_EXTENT_PENDING_DEL))
@@ -232,11 +233,11 @@ static int run_pending(struct ctree_root *extent_root)
232/* 233/*
233 * remove an extent from the root, returns 0 on success 234 * remove an extent from the root, returns 0 on success
234 */ 235 */
235int free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks) 236int btrfs_free_extent(struct btrfs_root *root, u64 blocknr, u64 num_blocks)
236{ 237{
237 struct btrfs_key key; 238 struct btrfs_key key;
238 struct ctree_root *extent_root = root->extent_root; 239 struct btrfs_root *extent_root = root->extent_root;
239 struct tree_buffer *t; 240 struct btrfs_buffer *t;
240 int pending_ret; 241 int pending_ret;
241 int ret; 242 int ret;
242 243
@@ -262,11 +263,11 @@ int free_extent(struct ctree_root *root, u64 blocknr, u64 num_blocks)
262 * ins->offset == number of blocks 263 * ins->offset == number of blocks
263 * Any available blocks before search_start are skipped. 264 * Any available blocks before search_start are skipped.
264 */ 265 */
265static int find_free_extent(struct ctree_root *orig_root, u64 num_blocks, 266static int find_free_extent(struct btrfs_root *orig_root, u64 num_blocks,
266 u64 search_start, u64 search_end, 267 u64 search_start, u64 search_end,
267 struct btrfs_key *ins) 268 struct btrfs_key *ins)
268{ 269{
269 struct ctree_path path; 270 struct btrfs_path path;
270 struct btrfs_key key; 271 struct btrfs_key key;
271 int ret; 272 int ret;
272 u64 hole_size = 0; 273 u64 hole_size = 0;
@@ -274,20 +275,20 @@ static int find_free_extent(struct ctree_root *orig_root, u64 num_blocks,
274 u64 last_block; 275 u64 last_block;
275 u64 test_block; 276 u64 test_block;
276 int start_found; 277 int start_found;
277 struct leaf *l; 278 struct btrfs_leaf *l;
278 struct ctree_root * root = orig_root->extent_root; 279 struct btrfs_root * root = orig_root->extent_root;
279 int total_needed = num_blocks; 280 int total_needed = num_blocks;
280 281
281 total_needed += (btrfs_header_level(&root->node->node.header) + 1) * 3; 282 total_needed += (btrfs_header_level(&root->node->node.header) + 1) * 3;
282 if (root->last_insert.objectid > search_start) 283 if (root->last_insert.objectid > search_start)
283 search_start = root->last_insert.objectid; 284 search_start = root->last_insert.objectid;
284check_failed: 285check_failed:
285 init_path(&path); 286 btrfs_init_path(&path);
286 ins->objectid = search_start; 287 ins->objectid = search_start;
287 ins->offset = 0; 288 ins->offset = 0;
288 ins->flags = 0; 289 ins->flags = 0;
289 start_found = 0; 290 start_found = 0;
290 ret = search_slot(root, ins, &path, 0, 0); 291 ret = btrfs_search_slot(root, ins, &path, 0, 0);
291 if (ret < 0) 292 if (ret < 0)
292 goto error; 293 goto error;
293 294
@@ -298,7 +299,7 @@ check_failed:
298 l = &path.nodes[0]->leaf; 299 l = &path.nodes[0]->leaf;
299 slot = path.slots[0]; 300 slot = path.slots[0];
300 if (slot >= btrfs_header_nritems(&l->header)) { 301 if (slot >= btrfs_header_nritems(&l->header)) {
301 ret = next_leaf(root, &path); 302 ret = btrfs_next_leaf(root, &path);
302 if (ret == 0) 303 if (ret == 0)
303 continue; 304 continue;
304 if (ret < 0) 305 if (ret < 0)
@@ -336,7 +337,7 @@ check_pending:
336 /* we have to make sure we didn't find an extent that has already 337 /* we have to make sure we didn't find an extent that has already
337 * been allocated by the map tree or the original allocation 338 * been allocated by the map tree or the original allocation
338 */ 339 */
339 release_path(root, &path); 340 btrfs_release_path(root, &path);
340 BUG_ON(ins->objectid < search_start); 341 BUG_ON(ins->objectid < search_start);
341 for (test_block = ins->objectid; 342 for (test_block = ins->objectid;
342 test_block < ins->objectid + total_needed; test_block++) { 343 test_block < ins->objectid + total_needed; test_block++) {
@@ -353,7 +354,7 @@ check_pending:
353 ins->offset = num_blocks; 354 ins->offset = num_blocks;
354 return 0; 355 return 0;
355error: 356error:
356 release_path(root, &path); 357 btrfs_release_path(root, &path);
357 return ret; 358 return ret;
358} 359}
359 360
@@ -364,13 +365,13 @@ error:
364 * 365 *
365 * returns 0 if everything worked, non-zero otherwise. 366 * returns 0 if everything worked, non-zero otherwise.
366 */ 367 */
367int alloc_extent(struct ctree_root *root, u64 num_blocks, u64 search_start, 368int alloc_extent(struct btrfs_root *root, u64 num_blocks, u64 search_start,
368 u64 search_end, u64 owner, struct btrfs_key *ins) 369 u64 search_end, u64 owner, struct btrfs_key *ins)
369{ 370{
370 int ret; 371 int ret;
371 int pending_ret; 372 int pending_ret;
372 struct ctree_root *extent_root = root->extent_root; 373 struct btrfs_root *extent_root = root->extent_root;
373 struct extent_item extent_item; 374 struct btrfs_extent_item extent_item;
374 375
375 btrfs_set_extent_refs(&extent_item, 1); 376 btrfs_set_extent_refs(&extent_item, 1);
376 btrfs_set_extent_owner(&extent_item, owner); 377 btrfs_set_extent_owner(&extent_item, owner);
@@ -390,7 +391,7 @@ int alloc_extent(struct ctree_root *root, u64 num_blocks, u64 search_start,
390 if (ret) 391 if (ret)
391 return ret; 392 return ret;
392 393
393 ret = insert_item(extent_root, ins, &extent_item, 394 ret = btrfs_insert_item(extent_root, ins, &extent_item,
394 sizeof(extent_item)); 395 sizeof(extent_item));
395 396
396 finish_current_insert(extent_root); 397 finish_current_insert(extent_root);
@@ -406,11 +407,11 @@ int alloc_extent(struct ctree_root *root, u64 num_blocks, u64 search_start,
406 * helper function to allocate a block for a given tree 407 * helper function to allocate a block for a given tree
407 * returns the tree buffer or NULL. 408 * returns the tree buffer or NULL.
408 */ 409 */
409struct tree_buffer *alloc_free_block(struct ctree_root *root) 410struct btrfs_buffer *btrfs_alloc_free_block(struct btrfs_root *root)
410{ 411{
411 struct btrfs_key ins; 412 struct btrfs_key ins;
412 int ret; 413 int ret;
413 struct tree_buffer *buf; 414 struct btrfs_buffer *buf;
414 415
415 ret = alloc_extent(root, 1, 0, (unsigned long)-1, 416 ret = alloc_extent(root, 1, 0, (unsigned long)-1,
416 btrfs_header_parentid(&root->node->node.header), 417 btrfs_header_parentid(&root->node->node.header),
@@ -424,10 +425,10 @@ struct tree_buffer *alloc_free_block(struct ctree_root *root)
424 return buf; 425 return buf;
425} 426}
426 427
427int walk_down_tree(struct ctree_root *root, struct ctree_path *path, int *level) 428int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path, int *level)
428{ 429{
429 struct tree_buffer *next; 430 struct btrfs_buffer *next;
430 struct tree_buffer *cur; 431 struct btrfs_buffer *cur;
431 u64 blocknr; 432 u64 blocknr;
432 int ret; 433 int ret;
433 u32 refs; 434 u32 refs;
@@ -445,33 +446,33 @@ int walk_down_tree(struct ctree_root *root, struct ctree_path *path, int *level)
445 ret = lookup_block_ref(root, blocknr, &refs); 446 ret = lookup_block_ref(root, blocknr, &refs);
446 if (refs != 1 || *level == 1) { 447 if (refs != 1 || *level == 1) {
447 path->slots[*level]++; 448 path->slots[*level]++;
448 ret = free_extent(root, blocknr, 1); 449 ret = btrfs_free_extent(root, blocknr, 1);
449 BUG_ON(ret); 450 BUG_ON(ret);
450 continue; 451 continue;
451 } 452 }
452 BUG_ON(ret); 453 BUG_ON(ret);
453 next = read_tree_block(root, blocknr); 454 next = read_tree_block(root, blocknr);
454 if (path->nodes[*level-1]) 455 if (path->nodes[*level-1])
455 tree_block_release(root, path->nodes[*level-1]); 456 btrfs_block_release(root, path->nodes[*level-1]);
456 path->nodes[*level-1] = next; 457 path->nodes[*level-1] = next;
457 *level = btrfs_header_level(&next->node.header); 458 *level = btrfs_header_level(&next->node.header);
458 path->slots[*level] = 0; 459 path->slots[*level] = 0;
459 } 460 }
460out: 461out:
461 ret = free_extent(root, path->nodes[*level]->blocknr, 1); 462 ret = btrfs_free_extent(root, path->nodes[*level]->blocknr, 1);
462 tree_block_release(root, path->nodes[*level]); 463 btrfs_block_release(root, path->nodes[*level]);
463 path->nodes[*level] = NULL; 464 path->nodes[*level] = NULL;
464 *level += 1; 465 *level += 1;
465 BUG_ON(ret); 466 BUG_ON(ret);
466 return 0; 467 return 0;
467} 468}
468 469
469int walk_up_tree(struct ctree_root *root, struct ctree_path *path, int *level) 470int walk_up_tree(struct btrfs_root *root, struct btrfs_path *path, int *level)
470{ 471{
471 int i; 472 int i;
472 int slot; 473 int slot;
473 int ret; 474 int ret;
474 for(i = *level; i < MAX_LEVEL - 1 && path->nodes[i]; i++) { 475 for(i = *level; i < BTRFS_MAX_LEVEL - 1 && path->nodes[i]; i++) {
475 slot = path->slots[i]; 476 slot = path->slots[i];
476 if (slot < 477 if (slot <
477 btrfs_header_nritems(&path->nodes[i]->node.header)- 1) { 478 btrfs_header_nritems(&path->nodes[i]->node.header)- 1) {
@@ -479,9 +480,9 @@ int walk_up_tree(struct ctree_root *root, struct ctree_path *path, int *level)
479 *level = i; 480 *level = i;
480 return 0; 481 return 0;
481 } else { 482 } else {
482 ret = free_extent(root, 483 ret = btrfs_free_extent(root,
483 path->nodes[*level]->blocknr, 1); 484 path->nodes[*level]->blocknr, 1);
484 tree_block_release(root, path->nodes[*level]); 485 btrfs_block_release(root, path->nodes[*level]);
485 path->nodes[*level] = NULL; 486 path->nodes[*level] = NULL;
486 *level = i + 1; 487 *level = i + 1;
487 BUG_ON(ret); 488 BUG_ON(ret);
@@ -490,15 +491,15 @@ int walk_up_tree(struct ctree_root *root, struct ctree_path *path, int *level)
490 return 1; 491 return 1;
491} 492}
492 493
493int btrfs_drop_snapshot(struct ctree_root *root, struct tree_buffer *snap) 494int btrfs_drop_snapshot(struct btrfs_root *root, struct btrfs_buffer *snap)
494{ 495{
495 int ret; 496 int ret;
496 int level; 497 int level;
497 struct ctree_path path; 498 struct btrfs_path path;
498 int i; 499 int i;
499 int orig_level; 500 int orig_level;
500 501
501 init_path(&path); 502 btrfs_init_path(&path);
502 503
503 level = btrfs_header_level(&snap->node.header); 504 level = btrfs_header_level(&snap->node.header);
504 orig_level = level; 505 orig_level = level;
@@ -514,7 +515,7 @@ int btrfs_drop_snapshot(struct ctree_root *root, struct tree_buffer *snap)
514 } 515 }
515 for (i = 0; i <= orig_level; i++) { 516 for (i = 0; i <= orig_level; i++) {
516 if (path.nodes[i]) { 517 if (path.nodes[i]) {
517 tree_block_release(root, path.nodes[i]); 518 btrfs_block_release(root, path.nodes[i]);
518 } 519 }
519 } 520 }
520 521