Lines Matching full:ref
12 #include "delayed-ref.h"
13 #include "ref-verify.h"
46 * back to the delayed ref action. We hold the ref we are changing in the
54 struct ref_entry ref; member
62 * to it as well as all of the ref actions that have occurred to it. We never
165 struct ref_entry *ref) in insert_ref_entry() argument
175 cmp = comp_refs(entry, ref); in insert_ref_entry()
184 rb_link_node(&ref->node, parent_node, p); in insert_ref_entry()
185 rb_insert_color(&ref->node, root); in insert_ref_entry()
218 btrfs_err(fs_info, " ref-verify: no stacktrace"); in __print_stack_trace()
231 btrfs_err(fs_info, " ref-verify: no stacktrace support"); in __print_stack_trace()
238 struct ref_entry *ref; in free_block_entry() local
249 ref = rb_entry(n, struct ref_entry, node); in free_block_entry()
250 rb_erase(&ref->node, &be->refs); in free_block_entry()
251 kfree(ref); in free_block_entry()
317 struct ref_entry *ref = NULL, *exist; in add_tree_block() local
319 ref = kmalloc(sizeof(struct ref_entry), GFP_NOFS); in add_tree_block()
320 if (!ref) in add_tree_block()
324 ref->root_objectid = 0; in add_tree_block()
326 ref->root_objectid = ref_root; in add_tree_block()
327 ref->parent = parent; in add_tree_block()
328 ref->owner = level; in add_tree_block()
329 ref->offset = 0; in add_tree_block()
330 ref->num_refs = 1; in add_tree_block()
334 kfree(ref); in add_tree_block()
347 exist = insert_ref_entry(&be->refs, ref); in add_tree_block()
350 kfree(ref); in add_tree_block()
362 struct ref_entry *ref; in add_shared_data_ref() local
364 ref = kzalloc(sizeof(struct ref_entry), GFP_NOFS); in add_shared_data_ref()
365 if (!ref) in add_shared_data_ref()
369 kfree(ref); in add_shared_data_ref()
374 ref->parent = parent; in add_shared_data_ref()
375 ref->num_refs = num_refs; in add_shared_data_ref()
376 if (insert_ref_entry(&be->refs, ref)) { in add_shared_data_ref()
378 btrfs_err(fs_info, "existing shared ref when reading from disk?"); in add_shared_data_ref()
379 kfree(ref); in add_shared_data_ref()
392 struct ref_entry *ref; in add_extent_data_ref() local
399 ref = kzalloc(sizeof(struct ref_entry), GFP_NOFS); in add_extent_data_ref()
400 if (!ref) in add_extent_data_ref()
404 kfree(ref); in add_extent_data_ref()
409 ref->parent = 0; in add_extent_data_ref()
410 ref->owner = owner; in add_extent_data_ref()
411 ref->root_objectid = ref_root; in add_extent_data_ref()
412 ref->offset = offset; in add_extent_data_ref()
413 ref->num_refs = num_refs; in add_extent_data_ref()
414 if (insert_ref_entry(&be->refs, ref)) { in add_extent_data_ref()
416 btrfs_err(fs_info, "existing ref when reading from disk?"); in add_extent_data_ref()
417 kfree(ref); in add_extent_data_ref()
492 "found extent owner ref without simple quotas enabled"); in process_extent_item()
621 " Ref action %d, root %llu, ref_root %llu, parent %llu, owner %llu, offset %llu, num_refs %llu", in dump_ref_action()
622 ra->action, ra->root, ra->ref.root_objectid, ra->ref.parent, in dump_ref_action()
623 ra->ref.owner, ra->ref.offset, ra->ref.num_refs); in dump_ref_action()
634 struct ref_entry *ref; in dump_block_entry() local
645 ref = rb_entry(n, struct ref_entry, node); in dump_block_entry()
647 " ref root %llu, parent %llu, owner %llu, offset %llu, num_refs %llu", in dump_block_entry()
648 ref->root_objectid, ref->parent, ref->owner, in dump_block_entry()
649 ref->offset, ref->num_refs); in dump_block_entry()
663 * Called when we modify a ref for a bytenr.
673 struct ref_entry *ref = NULL, *exist; in btrfs_ref_tree_mod() local
701 ref = kzalloc(sizeof(struct ref_entry), GFP_NOFS); in btrfs_ref_tree_mod()
703 if (!ra || !ref) { in btrfs_ref_tree_mod()
704 kfree(ref); in btrfs_ref_tree_mod()
710 ref->parent = parent; in btrfs_ref_tree_mod()
711 ref->owner = owner; in btrfs_ref_tree_mod()
712 ref->root_objectid = ref_root; in btrfs_ref_tree_mod()
713 ref->offset = offset; in btrfs_ref_tree_mod()
714 ref->num_refs = (action == BTRFS_DROP_DELAYED_REF) ? -1 : 1; in btrfs_ref_tree_mod()
716 memcpy(&ra->ref, ref, sizeof(struct ref_entry)); in btrfs_ref_tree_mod()
718 * Save the extra info from the delayed ref in the ref action to make it in btrfs_ref_tree_mod()
719 * easier to figure out what is happening. The real ref's we add to the in btrfs_ref_tree_mod()
720 * ref tree need to reflect what we save on disk so it matches any in btrfs_ref_tree_mod()
723 ra->ref.owner = owner; in btrfs_ref_tree_mod()
724 ra->ref.offset = offset; in btrfs_ref_tree_mod()
725 ra->ref.root_objectid = ref_root; in btrfs_ref_tree_mod()
741 * in root as if it really has a ref for this bytenr. in btrfs_ref_tree_mod()
745 kfree(ref); in btrfs_ref_tree_mod()
759 kfree(ref); in btrfs_ref_tree_mod()
778 kfree(ref); in btrfs_ref_tree_mod()
800 kfree(ref); in btrfs_ref_tree_mod()
810 kfree(ref); in btrfs_ref_tree_mod()
825 exist = insert_ref_entry(&be->refs, ref); in btrfs_ref_tree_mod()
830 "dropping a ref for a existing root that doesn't have a ref on the block"); in btrfs_ref_tree_mod()
833 kfree(ref); in btrfs_ref_tree_mod()
846 "attempting to add another ref for an existing ref on a tree block"); in btrfs_ref_tree_mod()
849 kfree(ref); in btrfs_ref_tree_mod()
853 kfree(ref); in btrfs_ref_tree_mod()
857 "dropping a ref for a root that doesn't have a ref on the block"); in btrfs_ref_tree_mod()
860 kfree(ref); in btrfs_ref_tree_mod()
904 /* Free up the ref cache */
987 /* Walk down all roots and build the ref tree, meant to be called at mount */
1014 * because we could have run out of space for an inline ref, and in btrfs_build_ref_tree()
1015 * would have had to added a ref key item which may appear on a in btrfs_build_ref_tree()