• Home
  • Raw
  • Download

Lines Matching refs:node

92 	struct backref_node *node[2];  member
195 struct backref_node *node);
197 struct backref_node *node);
218 struct backref_node *node; in backref_cache_cleanup() local
222 node = list_entry(cache->detached.next, in backref_cache_cleanup()
224 remove_backref_node(cache, node); in backref_cache_cleanup()
228 node = list_entry(cache->leaves.next, in backref_cache_cleanup()
230 remove_backref_node(cache, node); in backref_cache_cleanup()
246 struct backref_node *node; in alloc_backref_node() local
248 node = kzalloc(sizeof(*node), GFP_NOFS); in alloc_backref_node()
249 if (node) { in alloc_backref_node()
250 INIT_LIST_HEAD(&node->list); in alloc_backref_node()
251 INIT_LIST_HEAD(&node->upper); in alloc_backref_node()
252 INIT_LIST_HEAD(&node->lower); in alloc_backref_node()
253 RB_CLEAR_NODE(&node->rb_node); in alloc_backref_node()
256 return node; in alloc_backref_node()
260 struct backref_node *node) in free_backref_node() argument
262 if (node) { in free_backref_node()
264 kfree(node); in free_backref_node()
288 struct rb_node *node) in tree_insert() argument
306 rb_link_node(node, parent, p); in tree_insert()
307 rb_insert_color(node, root); in tree_insert()
344 static struct backref_node *walk_up_backref(struct backref_node *node, in walk_up_backref() argument
351 while (!list_empty(&node->upper)) { in walk_up_backref()
352 edge = list_entry(node->upper.next, in walk_up_backref()
355 node = edge->node[UPPER]; in walk_up_backref()
357 BUG_ON(node->detached); in walk_up_backref()
359 return node; in walk_up_backref()
374 lower = edge->node[LOWER]; in walk_down_backref()
383 return edge->node[UPPER]; in walk_down_backref()
389 static void unlock_node_buffer(struct backref_node *node) in unlock_node_buffer() argument
391 if (node->locked) { in unlock_node_buffer()
392 btrfs_tree_unlock(node->eb); in unlock_node_buffer()
393 node->locked = 0; in unlock_node_buffer()
397 static void drop_node_buffer(struct backref_node *node) in drop_node_buffer() argument
399 if (node->eb) { in drop_node_buffer()
400 unlock_node_buffer(node); in drop_node_buffer()
401 free_extent_buffer(node->eb); in drop_node_buffer()
402 node->eb = NULL; in drop_node_buffer()
407 struct backref_node *node) in drop_backref_node() argument
409 BUG_ON(!list_empty(&node->upper)); in drop_backref_node()
411 drop_node_buffer(node); in drop_backref_node()
412 list_del(&node->list); in drop_backref_node()
413 list_del(&node->lower); in drop_backref_node()
414 if (!RB_EMPTY_NODE(&node->rb_node)) in drop_backref_node()
415 rb_erase(&node->rb_node, &tree->rb_root); in drop_backref_node()
416 free_backref_node(tree, node); in drop_backref_node()
423 struct backref_node *node) in remove_backref_node() argument
428 if (!node) in remove_backref_node()
431 BUG_ON(!node->lowest && !node->detached); in remove_backref_node()
432 while (!list_empty(&node->upper)) { in remove_backref_node()
433 edge = list_entry(node->upper.next, struct backref_edge, in remove_backref_node()
435 upper = edge->node[UPPER]; in remove_backref_node()
441 BUG_ON(!list_empty(&node->upper)); in remove_backref_node()
442 drop_backref_node(cache, node); in remove_backref_node()
443 node = upper; in remove_backref_node()
444 node->lowest = 1; in remove_backref_node()
457 drop_backref_node(cache, node); in remove_backref_node()
461 struct backref_node *node, u64 bytenr) in update_backref_node() argument
464 rb_erase(&node->rb_node, &cache->rb_root); in update_backref_node()
465 node->bytenr = bytenr; in update_backref_node()
466 rb_node = tree_insert(&cache->rb_root, node->bytenr, &node->rb_node); in update_backref_node()
477 struct backref_node *node; in update_backref_cache() local
494 node = list_entry(cache->detached.next, in update_backref_cache()
496 remove_backref_node(cache, node); in update_backref_cache()
500 node = list_entry(cache->changed.next, in update_backref_cache()
502 list_del_init(&node->list); in update_backref_cache()
503 BUG_ON(node->pending); in update_backref_cache()
504 update_backref_node(cache, node, node->new_bytenr); in update_backref_cache()
512 list_for_each_entry(node, &cache->pending[level], list) { in update_backref_cache()
513 BUG_ON(!node->pending); in update_backref_cache()
514 if (node->bytenr == node->new_bytenr) in update_backref_cache()
516 update_backref_node(cache, node, node->new_bytenr); in update_backref_cache()
554 struct mapping_node *node; in find_reloc_root() local
560 node = rb_entry(rb_node, struct mapping_node, rb_node); in find_reloc_root()
561 root = (struct btrfs_root *)node->data; in find_reloc_root()
682 struct backref_node *node = NULL; local
704 node = alloc_backref_node(cache);
705 if (!node) {
710 node->bytenr = bytenr;
711 node->level = level;
712 node->lowest = 1;
713 cur = node;
743 exist = edge->node[UPPER];
865 edge->node[LOWER] = cur;
866 edge->node[UPPER] = upper;
981 edge->node[LOWER] = lower;
982 edge->node[UPPER] = upper;
1011 cur = edge->node[UPPER];
1019 BUG_ON(!node->checked);
1020 cowonly = node->cowonly;
1022 rb_node = tree_insert(&cache->rb_root, node->bytenr,
1023 &node->rb_node);
1025 backref_tree_panic(rb_node, -EEXIST, node->bytenr);
1026 list_add_tail(&node->lower, &cache->leaves);
1029 list_for_each_entry(edge, &node->upper, list[LOWER])
1035 upper = edge->node[UPPER];
1038 lower = edge->node[LOWER];
1080 if (upper == node)
1081 node = NULL;
1091 lower = edge->node[LOWER];
1115 upper = node;
1129 upper = edge->node[UPPER];
1134 BUG_ON(node && node->detached);
1135 return node;
1150 struct backref_node *node = NULL; local
1161 node = rb_entry(rb_node, struct backref_node, rb_node);
1162 if (node->detached)
1163 node = NULL;
1165 BUG_ON(node->new_bytenr != reloc_root->node->start);
1168 if (!node) {
1172 node = rb_entry(rb_node, struct backref_node,
1174 BUG_ON(node->detached);
1178 if (!node)
1185 new_node->bytenr = dest->node->start;
1186 new_node->level = node->level;
1187 new_node->lowest = node->lowest;
1191 if (!node->lowest) {
1192 list_for_each_entry(edge, &node->lower, list[UPPER]) {
1197 new_edge->node[UPPER] = new_node;
1198 new_edge->node[LOWER] = edge->node[LOWER];
1214 &new_edge->node[LOWER]->upper);
1235 struct mapping_node *node; local
1238 node = kmalloc(sizeof(*node), GFP_NOFS);
1239 if (!node)
1242 node->bytenr = root->node->start;
1243 node->data = root;
1247 node->bytenr, &node->rb_node);
1252 "tree\n", node->bytenr);
1253 kfree(node);
1268 struct mapping_node *node = NULL; local
1275 node = rb_entry(rb_node, struct mapping_node, rb_node);
1276 rb_erase(&node->rb_node, &rc->reloc_root_tree.rb_root);
1280 if (!node)
1282 BUG_ON((struct btrfs_root *)node->data != root);
1286 node->bytenr = root->node->start;
1288 node->bytenr, &node->rb_node);
1291 backref_tree_panic(rb_node, -EEXIST, node->bytenr);
1296 kfree(node);
1333 ret = btrfs_copy_root(trans, root, root->node, &eb,
1426 if (reloc_root->commit_root != reloc_root->node) {
1427 btrfs_set_root_node(root_item, reloc_root->node);
1446 struct rb_node *node; local
1453 node = root->inode_tree.rb_node;
1455 while (node) {
1456 prev = node;
1457 entry = rb_entry(node, struct btrfs_inode, rb_node);
1460 node = node->rb_left;
1462 node = node->rb_right;
1466 if (!node) {
1470 node = prev;
1476 while (node) {
1477 entry = rb_entry(node, struct btrfs_inode, rb_node);
1488 node = rb_next(node);
2063 extent_buffer_get(reloc_root->node);
2064 path->nodes[level] = reloc_root->node;
2267 free_extent_buffer(reloc_root->node);
2364 struct backref_node *node, argument
2371 next = node;
2387 if (next->new_bytenr != root->node->start) {
2390 next->new_bytenr = root->node->start;
2401 if (!next || next->level <= node->level)
2408 next = node;
2414 next = edges[index]->node[UPPER];
2427 struct backref_node *node) argument
2435 next = node;
2449 if (next != node)
2453 if (!next || next->level <= node->level)
2464 struct backref_node *node, int reserve) argument
2466 struct backref_node *next = node;
2472 BUG_ON(reserve && node->processed);
2477 if (next->processed && (reserve || next != node))
2489 next = edge->node[UPPER];
2498 struct backref_node *node) argument
2504 num_bytes = calcu_metadata_size(rc, node, 1) * 2;
2519 struct backref_node *node) argument
2521 u64 num_bytes = calcu_metadata_size(rc, node, 0) * 2;
2534 struct backref_node *node, argument
2551 BUG_ON(lowest && node->eb);
2553 path->lowest_level = node->level + 1;
2554 rc->backref_cache.path[node->level] = node;
2555 list_for_each_entry(edge, &node->upper, list[LOWER]) {
2558 upper = edge->node[UPPER];
2568 if (node->eb->start == bytenr)
2602 BUG_ON(bytenr != node->bytenr);
2604 if (node->eb->start == bytenr)
2608 blocksize = btrfs_level_size(root, node->level);
2619 if (!node->eb) {
2628 BUG_ON(node->eb != eb);
2631 node->eb->start);
2637 node->eb->start, blocksize,
2640 node->level, 0, 1);
2655 if (!err && node->pending) {
2656 drop_node_buffer(node);
2657 list_move_tail(&node->list, &rc->backref_cache.changed);
2658 node->pending = 0;
2668 struct backref_node *node, argument
2673 btrfs_node_key_to_cpu(node->eb, &key, 0);
2674 return do_relocation(trans, rc, node, &key, path, 0);
2683 struct backref_node *node; local
2689 node = list_entry(cache->pending[level].next,
2691 list_move_tail(&node->list, &list);
2692 BUG_ON(!node->pending);
2695 ret = link_to_upper(trans, rc, node, path);
2713 struct backref_node *node) argument
2716 if (node->level == 0 ||
2717 in_block_group(node->bytenr, rc->block_group)) {
2718 blocksize = btrfs_level_size(rc->extent_root, node->level);
2719 mark_block_processed(rc, node->bytenr, blocksize);
2721 node->processed = 1;
2729 struct backref_node *node) argument
2731 struct backref_node *next = node;
2750 next = edge->node[UPPER];
2806 struct backref_node *node, argument
2814 if (!node)
2817 BUG_ON(node->processed);
2818 root = select_one_root(trans, node);
2820 update_processed_blocks(rc, node);
2825 ret = reserve_metadata_space(trans, rc, node);
2833 BUG_ON(node->new_bytenr);
2834 BUG_ON(!list_empty(&node->list));
2837 node->new_bytenr = root->node->start;
2838 node->root = root;
2839 list_add_tail(&node->list, &rc->backref_cache.changed);
2841 path->lowest_level = node->level;
2848 update_processed_blocks(rc, node);
2850 ret = do_relocation(trans, rc, node, key, path, 1);
2853 if (ret || node->level == 0 || node->cowonly) {
2855 release_metadata_space(rc, node);
2856 remove_backref_node(&rc->backref_cache, node);
2868 struct backref_node *node; local
2904 node = build_backref_tree(rc, &block->key,
2906 if (IS_ERR(node)) {
2907 err = PTR_ERR(node);
2911 ret = relocate_tree_block(trans, rc, node, &block->key,
4442 struct backref_node *node; local
4463 node = rc->backref_cache.path[level];
4464 BUG_ON(node->bytenr != buf->start &&
4465 node->new_bytenr != buf->start);
4467 drop_node_buffer(node);
4469 node->eb = cow;
4470 node->new_bytenr = cow->start;
4472 if (!node->pending) {
4473 list_move_tail(&node->list,
4475 node->pending = 1;
4479 __mark_block_processed(rc, node);