Lines Matching refs:leaf
49 struct extent_buffer *leaf,
125 struct extent_buffer *leaf; in btrfs_lookup_extent_info() local
176 leaf = path->nodes[0]; in btrfs_lookup_extent_info()
177 item_size = btrfs_item_size(leaf, path->slots[0]); in btrfs_lookup_extent_info()
179 ei = btrfs_item_ptr(leaf, path->slots[0], in btrfs_lookup_extent_info()
181 num_refs = btrfs_extent_refs(leaf, ei); in btrfs_lookup_extent_info()
182 extent_flags = btrfs_extent_flags(leaf, ei); in btrfs_lookup_extent_info()
424 static u64 hash_extent_data_ref_item(struct extent_buffer *leaf, in hash_extent_data_ref_item() argument
427 return hash_extent_data_ref(btrfs_extent_data_ref_root(leaf, ref), in hash_extent_data_ref_item()
428 btrfs_extent_data_ref_objectid(leaf, ref), in hash_extent_data_ref_item()
429 btrfs_extent_data_ref_offset(leaf, ref)); in hash_extent_data_ref_item()
432 static int match_extent_data_ref(struct extent_buffer *leaf, in match_extent_data_ref() argument
436 if (btrfs_extent_data_ref_root(leaf, ref) != root_objectid || in match_extent_data_ref()
437 btrfs_extent_data_ref_objectid(leaf, ref) != owner || in match_extent_data_ref()
438 btrfs_extent_data_ref_offset(leaf, ref) != offset) in match_extent_data_ref()
452 struct extent_buffer *leaf; in lookup_extent_data_ref() local
481 leaf = path->nodes[0]; in lookup_extent_data_ref()
482 nritems = btrfs_header_nritems(leaf); in lookup_extent_data_ref()
491 leaf = path->nodes[0]; in lookup_extent_data_ref()
492 nritems = btrfs_header_nritems(leaf); in lookup_extent_data_ref()
496 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in lookup_extent_data_ref()
501 ref = btrfs_item_ptr(leaf, path->slots[0], in lookup_extent_data_ref()
504 if (match_extent_data_ref(leaf, ref, root_objectid, in lookup_extent_data_ref()
527 struct extent_buffer *leaf; in insert_extent_data_ref() local
548 leaf = path->nodes[0]; in insert_extent_data_ref()
551 ref = btrfs_item_ptr(leaf, path->slots[0], in insert_extent_data_ref()
554 btrfs_set_shared_data_ref_count(leaf, ref, refs_to_add); in insert_extent_data_ref()
556 num_refs = btrfs_shared_data_ref_count(leaf, ref); in insert_extent_data_ref()
558 btrfs_set_shared_data_ref_count(leaf, ref, num_refs); in insert_extent_data_ref()
563 ref = btrfs_item_ptr(leaf, path->slots[0], in insert_extent_data_ref()
565 if (match_extent_data_ref(leaf, ref, root_objectid, in insert_extent_data_ref()
575 leaf = path->nodes[0]; in insert_extent_data_ref()
577 ref = btrfs_item_ptr(leaf, path->slots[0], in insert_extent_data_ref()
580 btrfs_set_extent_data_ref_root(leaf, ref, in insert_extent_data_ref()
582 btrfs_set_extent_data_ref_objectid(leaf, ref, owner); in insert_extent_data_ref()
583 btrfs_set_extent_data_ref_offset(leaf, ref, offset); in insert_extent_data_ref()
584 btrfs_set_extent_data_ref_count(leaf, ref, refs_to_add); in insert_extent_data_ref()
586 num_refs = btrfs_extent_data_ref_count(leaf, ref); in insert_extent_data_ref()
588 btrfs_set_extent_data_ref_count(leaf, ref, num_refs); in insert_extent_data_ref()
591 btrfs_mark_buffer_dirty(leaf); in insert_extent_data_ref()
606 struct extent_buffer *leaf; in remove_extent_data_ref() local
610 leaf = path->nodes[0]; in remove_extent_data_ref()
611 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in remove_extent_data_ref()
614 ref1 = btrfs_item_ptr(leaf, path->slots[0], in remove_extent_data_ref()
616 num_refs = btrfs_extent_data_ref_count(leaf, ref1); in remove_extent_data_ref()
618 ref2 = btrfs_item_ptr(leaf, path->slots[0], in remove_extent_data_ref()
620 num_refs = btrfs_shared_data_ref_count(leaf, ref2); in remove_extent_data_ref()
636 btrfs_set_extent_data_ref_count(leaf, ref1, num_refs); in remove_extent_data_ref()
638 btrfs_set_shared_data_ref_count(leaf, ref2, num_refs); in remove_extent_data_ref()
639 btrfs_mark_buffer_dirty(leaf); in remove_extent_data_ref()
648 struct extent_buffer *leaf; in extent_data_ref_count() local
654 leaf = path->nodes[0]; in extent_data_ref_count()
655 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in extent_data_ref_count()
663 type = btrfs_get_extent_inline_ref_type(leaf, iref, BTRFS_REF_TYPE_DATA); in extent_data_ref_count()
667 num_refs = btrfs_extent_data_ref_count(leaf, ref1); in extent_data_ref_count()
670 num_refs = btrfs_shared_data_ref_count(leaf, ref2); in extent_data_ref_count()
673 ref1 = btrfs_item_ptr(leaf, path->slots[0], in extent_data_ref_count()
675 num_refs = btrfs_extent_data_ref_count(leaf, ref1); in extent_data_ref_count()
677 ref2 = btrfs_item_ptr(leaf, path->slots[0], in extent_data_ref_count()
679 num_refs = btrfs_shared_data_ref_count(leaf, ref2); in extent_data_ref_count()
795 struct extent_buffer *leaf; in lookup_inline_extent_backref() local
875 leaf = path->nodes[0]; in lookup_inline_extent_backref()
876 item_size = btrfs_item_size(leaf, path->slots[0]); in lookup_inline_extent_backref()
884 ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); in lookup_inline_extent_backref()
885 flags = btrfs_extent_flags(leaf, ei); in lookup_inline_extent_backref()
913 type = btrfs_get_extent_inline_ref_type(leaf, iref, needed); in lookup_inline_extent_backref()
929 if (match_extent_data_ref(leaf, dref, root_objectid, in lookup_inline_extent_backref()
934 if (hash_extent_data_ref_item(leaf, dref) < in lookup_inline_extent_backref()
939 ref_offset = btrfs_extent_inline_ref_offset(leaf, iref); in lookup_inline_extent_backref()
998 struct extent_buffer *leaf; in setup_inline_extent_backref() local
1007 leaf = path->nodes[0]; in setup_inline_extent_backref()
1008 ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); in setup_inline_extent_backref()
1016 ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); in setup_inline_extent_backref()
1017 refs = btrfs_extent_refs(leaf, ei); in setup_inline_extent_backref()
1019 btrfs_set_extent_refs(leaf, ei, refs); in setup_inline_extent_backref()
1021 __run_delayed_extent_op(extent_op, leaf, ei); in setup_inline_extent_backref()
1024 end = (unsigned long)ei + btrfs_item_size(leaf, path->slots[0]); in setup_inline_extent_backref()
1026 memmove_extent_buffer(leaf, ptr + size, ptr, in setup_inline_extent_backref()
1030 btrfs_set_extent_inline_ref_type(leaf, iref, type); in setup_inline_extent_backref()
1034 btrfs_set_extent_data_ref_root(leaf, dref, root_objectid); in setup_inline_extent_backref()
1035 btrfs_set_extent_data_ref_objectid(leaf, dref, owner); in setup_inline_extent_backref()
1036 btrfs_set_extent_data_ref_offset(leaf, dref, offset); in setup_inline_extent_backref()
1037 btrfs_set_extent_data_ref_count(leaf, dref, refs_to_add); in setup_inline_extent_backref()
1041 btrfs_set_shared_data_ref_count(leaf, sref, refs_to_add); in setup_inline_extent_backref()
1042 btrfs_set_extent_inline_ref_offset(leaf, iref, parent); in setup_inline_extent_backref()
1044 btrfs_set_extent_inline_ref_offset(leaf, iref, parent); in setup_inline_extent_backref()
1046 btrfs_set_extent_inline_ref_offset(leaf, iref, root_objectid); in setup_inline_extent_backref()
1048 btrfs_mark_buffer_dirty(leaf); in setup_inline_extent_backref()
1087 struct extent_buffer *leaf = path->nodes[0]; in update_inline_extent_backref() local
1098 ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); in update_inline_extent_backref()
1099 refs = btrfs_extent_refs(leaf, ei); in update_inline_extent_backref()
1102 btrfs_set_extent_refs(leaf, ei, refs); in update_inline_extent_backref()
1104 __run_delayed_extent_op(extent_op, leaf, ei); in update_inline_extent_backref()
1110 type = btrfs_get_extent_inline_ref_type(leaf, iref, BTRFS_REF_TYPE_ANY); in update_inline_extent_backref()
1115 refs = btrfs_extent_data_ref_count(leaf, dref); in update_inline_extent_backref()
1118 refs = btrfs_shared_data_ref_count(leaf, sref); in update_inline_extent_backref()
1129 btrfs_set_extent_data_ref_count(leaf, dref, refs); in update_inline_extent_backref()
1131 btrfs_set_shared_data_ref_count(leaf, sref, refs); in update_inline_extent_backref()
1134 item_size = btrfs_item_size(leaf, path->slots[0]); in update_inline_extent_backref()
1138 memmove_extent_buffer(leaf, ptr, ptr + size, in update_inline_extent_backref()
1143 btrfs_mark_buffer_dirty(leaf); in update_inline_extent_backref()
1448 struct extent_buffer *leaf; in __btrfs_inc_extent_ref() local
1472 leaf = path->nodes[0]; in __btrfs_inc_extent_ref()
1473 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in __btrfs_inc_extent_ref()
1474 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); in __btrfs_inc_extent_ref()
1475 refs = btrfs_extent_refs(leaf, item); in __btrfs_inc_extent_ref()
1476 btrfs_set_extent_refs(leaf, item, refs + refs_to_add); in __btrfs_inc_extent_ref()
1478 __run_delayed_extent_op(extent_op, leaf, item); in __btrfs_inc_extent_ref()
1480 btrfs_mark_buffer_dirty(leaf); in __btrfs_inc_extent_ref()
1546 struct extent_buffer *leaf, in __run_delayed_extent_op() argument
1549 u64 flags = btrfs_extent_flags(leaf, ei); in __run_delayed_extent_op()
1552 btrfs_set_extent_flags(leaf, ei, flags); in __run_delayed_extent_op()
1559 btrfs_set_tree_block_key(leaf, bi, &extent_op->key); in __run_delayed_extent_op()
1572 struct extent_buffer *leaf; in run_delayed_extent_op() local
1631 leaf = path->nodes[0]; in run_delayed_extent_op()
1632 item_size = btrfs_item_size(leaf, path->slots[0]); in run_delayed_extent_op()
1641 ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); in run_delayed_extent_op()
1642 __run_delayed_extent_op(extent_op, leaf, ei); in run_delayed_extent_op()
1644 btrfs_mark_buffer_dirty(leaf); in run_delayed_extent_op()
2295 struct extent_buffer *leaf; in check_committed_ref() local
2318 leaf = path->nodes[0]; in check_committed_ref()
2319 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in check_committed_ref()
2325 item_size = btrfs_item_size(leaf, path->slots[0]); in check_committed_ref()
2326 ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); in check_committed_ref()
2338 (btrfs_extent_generation(leaf, ei) <= in check_committed_ref()
2345 type = btrfs_get_extent_inline_ref_type(leaf, iref, BTRFS_REF_TYPE_DATA); in check_committed_ref()
2350 if (btrfs_extent_refs(leaf, ei) != in check_committed_ref()
2351 btrfs_extent_data_ref_count(leaf, ref) || in check_committed_ref()
2352 btrfs_extent_data_ref_root(leaf, ref) != in check_committed_ref()
2354 btrfs_extent_data_ref_objectid(leaf, ref) != objectid || in check_committed_ref()
2355 btrfs_extent_data_ref_offset(leaf, ref) != offset) in check_committed_ref()
2933 struct extent_buffer *leaf; in __btrfs_free_extent() local
3080 leaf = path->nodes[0]; in __btrfs_free_extent()
3081 item_size = btrfs_item_size(leaf, extent_slot); in __btrfs_free_extent()
3088 ei = btrfs_item_ptr(leaf, extent_slot, in __btrfs_free_extent()
3103 WARN_ON(owner_objectid != btrfs_tree_block_level(leaf, bi)); in __btrfs_free_extent()
3106 refs = btrfs_extent_refs(leaf, ei); in __btrfs_free_extent()
3118 __run_delayed_extent_op(extent_op, leaf, ei); in __btrfs_free_extent()
3131 btrfs_set_extent_refs(leaf, ei, refs); in __btrfs_free_extent()
3132 btrfs_mark_buffer_dirty(leaf); in __btrfs_free_extent()
4703 struct extent_buffer *leaf; in alloc_reserved_file_extent() local
4725 leaf = path->nodes[0]; in alloc_reserved_file_extent()
4726 extent_item = btrfs_item_ptr(leaf, path->slots[0], in alloc_reserved_file_extent()
4728 btrfs_set_extent_refs(leaf, extent_item, ref_mod); in alloc_reserved_file_extent()
4729 btrfs_set_extent_generation(leaf, extent_item, trans->transid); in alloc_reserved_file_extent()
4730 btrfs_set_extent_flags(leaf, extent_item, in alloc_reserved_file_extent()
4734 btrfs_set_extent_inline_ref_type(leaf, iref, type); in alloc_reserved_file_extent()
4738 btrfs_set_extent_inline_ref_offset(leaf, iref, parent); in alloc_reserved_file_extent()
4739 btrfs_set_shared_data_ref_count(leaf, ref, ref_mod); in alloc_reserved_file_extent()
4743 btrfs_set_extent_data_ref_root(leaf, ref, root_objectid); in alloc_reserved_file_extent()
4744 btrfs_set_extent_data_ref_objectid(leaf, ref, owner); in alloc_reserved_file_extent()
4745 btrfs_set_extent_data_ref_offset(leaf, ref, offset); in alloc_reserved_file_extent()
4746 btrfs_set_extent_data_ref_count(leaf, ref, ref_mod); in alloc_reserved_file_extent()
4767 struct extent_buffer *leaf; in alloc_reserved_tree_block() local
4797 leaf = path->nodes[0]; in alloc_reserved_tree_block()
4798 extent_item = btrfs_item_ptr(leaf, path->slots[0], in alloc_reserved_tree_block()
4800 btrfs_set_extent_refs(leaf, extent_item, 1); in alloc_reserved_tree_block()
4801 btrfs_set_extent_generation(leaf, extent_item, trans->transid); in alloc_reserved_tree_block()
4802 btrfs_set_extent_flags(leaf, extent_item, in alloc_reserved_tree_block()
4809 btrfs_set_tree_block_key(leaf, block_info, &extent_op->key); in alloc_reserved_tree_block()
4810 btrfs_set_tree_block_level(leaf, block_info, ref->level); in alloc_reserved_tree_block()
4815 btrfs_set_extent_inline_ref_type(leaf, iref, in alloc_reserved_tree_block()
4817 btrfs_set_extent_inline_ref_offset(leaf, iref, ref->parent); in alloc_reserved_tree_block()
4819 btrfs_set_extent_inline_ref_type(leaf, iref, in alloc_reserved_tree_block()
4821 btrfs_set_extent_inline_ref_offset(leaf, iref, ref->root); in alloc_reserved_tree_block()
4824 btrfs_mark_buffer_dirty(leaf); in alloc_reserved_tree_block()