Lines Matching full:upper

2730 	INIT_LIST_HEAD(&node->upper);  in btrfs_backref_alloc_node()
2753 * upper edges and any uncached nodes in the path.
2761 struct btrfs_backref_node *upper; in btrfs_backref_cleanup_node() local
2768 while (!list_empty(&node->upper)) { in btrfs_backref_cleanup_node()
2769 edge = list_entry(node->upper.next, struct btrfs_backref_edge, in btrfs_backref_cleanup_node()
2771 upper = edge->node[UPPER]; in btrfs_backref_cleanup_node()
2773 list_del(&edge->list[UPPER]); in btrfs_backref_cleanup_node()
2780 if (list_empty(&upper->lower)) { in btrfs_backref_cleanup_node()
2781 list_add_tail(&upper->lower, &cache->leaves); in btrfs_backref_cleanup_node()
2782 upper->lowest = 1; in btrfs_backref_cleanup_node()
2839 struct btrfs_backref_node *upper; in handle_direct_tree_backref() local
2872 upper = btrfs_backref_alloc_node(cache, ref_key->offset, in handle_direct_tree_backref()
2874 if (!upper) { in handle_direct_tree_backref()
2880 * Backrefs for the upper level block isn't cached, add the in handle_direct_tree_backref()
2883 list_add_tail(&edge->list[UPPER], &cache->pending_edge); in handle_direct_tree_backref()
2886 upper = rb_entry(rb_node, struct btrfs_backref_node, rb_node); in handle_direct_tree_backref()
2887 ASSERT(upper->checked); in handle_direct_tree_backref()
2888 INIT_LIST_HEAD(&edge->list[UPPER]); in handle_direct_tree_backref()
2890 btrfs_backref_link_edge(edge, cur, upper, LINK_LOWER); in handle_direct_tree_backref()
2913 struct btrfs_backref_node *upper; in handle_indirect_tree_backref() local
3004 upper = btrfs_backref_alloc_node(cache, eb->start, in handle_indirect_tree_backref()
3006 if (!upper) { in handle_indirect_tree_backref()
3012 upper->owner = btrfs_header_owner(eb); in handle_indirect_tree_backref()
3014 upper->cowonly = 1; in handle_indirect_tree_backref()
3021 upper->checked = 0; in handle_indirect_tree_backref()
3023 upper->checked = 1; in handle_indirect_tree_backref()
3030 if (!upper->checked && need_check) { in handle_indirect_tree_backref()
3032 list_add_tail(&edge->list[UPPER], in handle_indirect_tree_backref()
3035 if (upper->checked) in handle_indirect_tree_backref()
3037 INIT_LIST_HEAD(&edge->list[UPPER]); in handle_indirect_tree_backref()
3040 upper = rb_entry(rb_node, struct btrfs_backref_node, in handle_indirect_tree_backref()
3042 ASSERT(upper->checked); in handle_indirect_tree_backref()
3043 INIT_LIST_HEAD(&edge->list[UPPER]); in handle_indirect_tree_backref()
3044 if (!upper->owner) in handle_indirect_tree_backref()
3045 upper->owner = btrfs_header_owner(eb); in handle_indirect_tree_backref()
3047 btrfs_backref_link_edge(edge, lower, upper, LINK_LOWER); in handle_indirect_tree_backref()
3053 lower = upper; in handle_indirect_tree_backref()
3054 upper = NULL; in handle_indirect_tree_backref()
3064 * NOTE: Even if the function returned 0, @cur is not yet cached as its upper
3101 if (!list_empty(&cur->upper)) { in btrfs_backref_add_tree_node()
3106 ASSERT(list_is_singular(&cur->upper)); in btrfs_backref_add_tree_node()
3107 edge = list_entry(cur->upper.next, struct btrfs_backref_edge, in btrfs_backref_add_tree_node()
3109 ASSERT(list_empty(&edge->list[UPPER])); in btrfs_backref_add_tree_node()
3110 exist = edge->node[UPPER]; in btrfs_backref_add_tree_node()
3112 * Add the upper level block to pending list if we need check in btrfs_backref_add_tree_node()
3116 list_add_tail(&edge->list[UPPER], &cache->pending_edge); in btrfs_backref_add_tree_node()
3223 list_for_each_entry(edge, &start->upper, list[LOWER]) in btrfs_backref_finish_upper_links()
3224 list_add_tail(&edge->list[UPPER], &pending_edge); in btrfs_backref_finish_upper_links()
3227 struct btrfs_backref_node *upper; in btrfs_backref_finish_upper_links() local
3231 struct btrfs_backref_edge, list[UPPER]); in btrfs_backref_finish_upper_links()
3232 list_del_init(&edge->list[UPPER]); in btrfs_backref_finish_upper_links()
3233 upper = edge->node[UPPER]; in btrfs_backref_finish_upper_links()
3237 if (upper->detached) { in btrfs_backref_finish_upper_links()
3242 if (list_empty(&lower->upper)) in btrfs_backref_finish_upper_links()
3250 * So if we have upper->rb_node populated, this means a cache in btrfs_backref_finish_upper_links()
3251 * hit. We only need to link the edge, as @upper and all its in btrfs_backref_finish_upper_links()
3254 if (!RB_EMPTY_NODE(&upper->rb_node)) { in btrfs_backref_finish_upper_links()
3255 if (upper->lowest) { in btrfs_backref_finish_upper_links()
3256 list_del_init(&upper->lower); in btrfs_backref_finish_upper_links()
3257 upper->lowest = 0; in btrfs_backref_finish_upper_links()
3260 list_add_tail(&edge->list[UPPER], &upper->lower); in btrfs_backref_finish_upper_links()
3265 if (!upper->checked) { in btrfs_backref_finish_upper_links()
3271 if (start->cowonly != upper->cowonly) { in btrfs_backref_finish_upper_links()
3277 if (!upper->cowonly) { in btrfs_backref_finish_upper_links()
3278 rb_node = rb_simple_insert(&cache->rb_root, upper->bytenr, in btrfs_backref_finish_upper_links()
3279 &upper->rb_node); in btrfs_backref_finish_upper_links()
3282 upper->bytenr, -EEXIST); in btrfs_backref_finish_upper_links()
3287 list_add_tail(&edge->list[UPPER], &upper->lower); in btrfs_backref_finish_upper_links()
3291 * to finish the upper linkage in btrfs_backref_finish_upper_links()
3293 list_for_each_entry(edge, &upper->upper, list[LOWER]) in btrfs_backref_finish_upper_links()
3294 list_add_tail(&edge->list[UPPER], &pending_edge); in btrfs_backref_finish_upper_links()
3303 struct btrfs_backref_node *upper; in btrfs_backref_error_cleanup() local
3313 struct btrfs_backref_edge, list[UPPER]); in btrfs_backref_error_cleanup()
3314 list_del(&edge->list[UPPER]); in btrfs_backref_error_cleanup()
3317 upper = edge->node[UPPER]; in btrfs_backref_error_cleanup()
3321 * Lower is no longer linked to any upper backref nodes and in btrfs_backref_error_cleanup()
3324 if (list_empty(&lower->upper) && in btrfs_backref_error_cleanup()
3328 if (!RB_EMPTY_NODE(&upper->rb_node)) in btrfs_backref_error_cleanup()
3331 /* Add this guy's upper edges to the list to process */ in btrfs_backref_error_cleanup()
3332 list_for_each_entry(edge, &upper->upper, list[LOWER]) in btrfs_backref_error_cleanup()
3333 list_add_tail(&edge->list[UPPER], in btrfs_backref_error_cleanup()
3335 if (list_empty(&upper->upper)) in btrfs_backref_error_cleanup()
3336 list_add(&upper->list, &cache->useless_node); in btrfs_backref_error_cleanup()