Lines Matching full:upper
3044 INIT_LIST_HEAD(&node->upper); in btrfs_backref_alloc_node()
3114 ASSERT(list_empty(&node->upper)); in btrfs_backref_drop_node()
3126 * upper edges and any uncached nodes in the path.
3134 struct btrfs_backref_node *upper; in btrfs_backref_cleanup_node() local
3141 while (!list_empty(&node->upper)) { in btrfs_backref_cleanup_node()
3142 edge = list_entry(node->upper.next, struct btrfs_backref_edge, in btrfs_backref_cleanup_node()
3144 upper = edge->node[UPPER]; in btrfs_backref_cleanup_node()
3146 list_del(&edge->list[UPPER]); in btrfs_backref_cleanup_node()
3153 if (list_empty(&upper->lower)) { in btrfs_backref_cleanup_node()
3154 list_add_tail(&upper->lower, &cache->leaves); in btrfs_backref_cleanup_node()
3155 upper->lowest = 1; in btrfs_backref_cleanup_node()
3201 struct btrfs_backref_node *upper, in btrfs_backref_link_edge() argument
3204 ASSERT(upper && lower && upper->level == lower->level + 1); in btrfs_backref_link_edge()
3206 edge->node[UPPER] = upper; in btrfs_backref_link_edge()
3208 list_add_tail(&edge->list[LOWER], &lower->upper); in btrfs_backref_link_edge()
3210 list_add_tail(&edge->list[UPPER], &upper->lower); in btrfs_backref_link_edge()
3229 struct btrfs_backref_node *upper; in handle_direct_tree_backref() local
3262 upper = btrfs_backref_alloc_node(cache, ref_key->offset, in handle_direct_tree_backref()
3264 if (!upper) { in handle_direct_tree_backref()
3270 * Backrefs for the upper level block isn't cached, add the in handle_direct_tree_backref()
3273 list_add_tail(&edge->list[UPPER], &cache->pending_edge); in handle_direct_tree_backref()
3276 upper = rb_entry(rb_node, struct btrfs_backref_node, rb_node); in handle_direct_tree_backref()
3277 ASSERT(upper->checked); in handle_direct_tree_backref()
3278 INIT_LIST_HEAD(&edge->list[UPPER]); in handle_direct_tree_backref()
3280 btrfs_backref_link_edge(edge, cur, upper, LINK_LOWER); in handle_direct_tree_backref()
3305 struct btrfs_backref_node *upper; in handle_indirect_tree_backref() local
3396 upper = btrfs_backref_alloc_node(cache, eb->start, in handle_indirect_tree_backref()
3398 if (!upper) { in handle_indirect_tree_backref()
3404 upper->owner = btrfs_header_owner(eb); in handle_indirect_tree_backref()
3406 upper->cowonly = 1; in handle_indirect_tree_backref()
3413 upper->checked = 0; in handle_indirect_tree_backref()
3415 upper->checked = 1; in handle_indirect_tree_backref()
3422 if (!upper->checked && need_check) { in handle_indirect_tree_backref()
3424 list_add_tail(&edge->list[UPPER], in handle_indirect_tree_backref()
3427 if (upper->checked) in handle_indirect_tree_backref()
3429 INIT_LIST_HEAD(&edge->list[UPPER]); in handle_indirect_tree_backref()
3432 upper = rb_entry(rb_node, struct btrfs_backref_node, in handle_indirect_tree_backref()
3434 ASSERT(upper->checked); in handle_indirect_tree_backref()
3435 INIT_LIST_HEAD(&edge->list[UPPER]); in handle_indirect_tree_backref()
3436 if (!upper->owner) in handle_indirect_tree_backref()
3437 upper->owner = btrfs_header_owner(eb); in handle_indirect_tree_backref()
3439 btrfs_backref_link_edge(edge, lower, upper, LINK_LOWER); in handle_indirect_tree_backref()
3445 lower = upper; in handle_indirect_tree_backref()
3446 upper = NULL; in handle_indirect_tree_backref()
3456 * NOTE: Even if the function returned 0, @cur is not yet cached as its upper
3494 if (!list_empty(&cur->upper)) { in btrfs_backref_add_tree_node()
3499 ASSERT(list_is_singular(&cur->upper)); in btrfs_backref_add_tree_node()
3500 edge = list_entry(cur->upper.next, struct btrfs_backref_edge, in btrfs_backref_add_tree_node()
3502 ASSERT(list_empty(&edge->list[UPPER])); in btrfs_backref_add_tree_node()
3503 exist = edge->node[UPPER]; in btrfs_backref_add_tree_node()
3505 * Add the upper level block to pending list if we need check in btrfs_backref_add_tree_node()
3509 list_add_tail(&edge->list[UPPER], &cache->pending_edge); in btrfs_backref_add_tree_node()
3612 list_for_each_entry(edge, &start->upper, list[LOWER]) in btrfs_backref_finish_upper_links()
3613 list_add_tail(&edge->list[UPPER], &pending_edge); in btrfs_backref_finish_upper_links()
3616 struct btrfs_backref_node *upper; in btrfs_backref_finish_upper_links() local
3620 struct btrfs_backref_edge, list[UPPER]); in btrfs_backref_finish_upper_links()
3621 list_del_init(&edge->list[UPPER]); in btrfs_backref_finish_upper_links()
3622 upper = edge->node[UPPER]; in btrfs_backref_finish_upper_links()
3626 if (upper->detached) { in btrfs_backref_finish_upper_links()
3631 if (list_empty(&lower->upper)) in btrfs_backref_finish_upper_links()
3639 * So if we have upper->rb_node populated, this means a cache in btrfs_backref_finish_upper_links()
3640 * hit. We only need to link the edge, as @upper and all its in btrfs_backref_finish_upper_links()
3643 if (!RB_EMPTY_NODE(&upper->rb_node)) { in btrfs_backref_finish_upper_links()
3644 if (upper->lowest) { in btrfs_backref_finish_upper_links()
3645 list_del_init(&upper->lower); in btrfs_backref_finish_upper_links()
3646 upper->lowest = 0; in btrfs_backref_finish_upper_links()
3649 list_add_tail(&edge->list[UPPER], &upper->lower); in btrfs_backref_finish_upper_links()
3654 if (!upper->checked) { in btrfs_backref_finish_upper_links()
3660 if (start->cowonly != upper->cowonly) { in btrfs_backref_finish_upper_links()
3666 if (!upper->cowonly) { in btrfs_backref_finish_upper_links()
3667 rb_node = rb_simple_insert(&cache->rb_root, upper->bytenr, in btrfs_backref_finish_upper_links()
3668 &upper->rb_node); in btrfs_backref_finish_upper_links()
3671 upper->bytenr, -EEXIST); in btrfs_backref_finish_upper_links()
3676 list_add_tail(&edge->list[UPPER], &upper->lower); in btrfs_backref_finish_upper_links()
3680 * to finish the upper linkage in btrfs_backref_finish_upper_links()
3682 list_for_each_entry(edge, &upper->upper, list[LOWER]) in btrfs_backref_finish_upper_links()
3683 list_add_tail(&edge->list[UPPER], &pending_edge); in btrfs_backref_finish_upper_links()
3692 struct btrfs_backref_node *upper; in btrfs_backref_error_cleanup() local
3702 struct btrfs_backref_edge, list[UPPER]); in btrfs_backref_error_cleanup()
3703 list_del(&edge->list[UPPER]); in btrfs_backref_error_cleanup()
3706 upper = edge->node[UPPER]; in btrfs_backref_error_cleanup()
3710 * Lower is no longer linked to any upper backref nodes and in btrfs_backref_error_cleanup()
3713 if (list_empty(&lower->upper) && in btrfs_backref_error_cleanup()
3717 if (!RB_EMPTY_NODE(&upper->rb_node)) in btrfs_backref_error_cleanup()
3720 /* Add this guy's upper edges to the list to process */ in btrfs_backref_error_cleanup()
3721 list_for_each_entry(edge, &upper->upper, list[LOWER]) in btrfs_backref_error_cleanup()
3722 list_add_tail(&edge->list[UPPER], in btrfs_backref_error_cleanup()
3724 if (list_empty(&upper->upper)) in btrfs_backref_error_cleanup()
3725 list_add(&upper->list, &cache->useless_node); in btrfs_backref_error_cleanup()