Lines Matching full:ref

11 #include "delayed-ref.h"
12 #include "ref-verify.h"
43 * back to the delayed ref action. We hold the ref we are changing in the
51 struct ref_entry ref; member
59 * to it as well as all of the ref actions that have occurred to it. We never
162 struct ref_entry *ref) in insert_ref_entry() argument
172 cmp = comp_refs(entry, ref); in insert_ref_entry()
181 rb_link_node(&ref->node, parent_node, p); in insert_ref_entry()
182 rb_insert_color(&ref->node, root); in insert_ref_entry()
215 btrfs_err(fs_info, " ref-verify: no stacktrace"); in __print_stack_trace()
228 btrfs_err(fs_info, " ref-verify: no stacktrace support"); in __print_stack_trace()
235 struct ref_entry *ref; in free_block_entry() local
246 ref = rb_entry(n, struct ref_entry, node); in free_block_entry()
247 rb_erase(&ref->node, &be->refs); in free_block_entry()
248 kfree(ref); in free_block_entry()
314 struct ref_entry *ref = NULL, *exist; in add_tree_block() local
316 ref = kmalloc(sizeof(struct ref_entry), GFP_NOFS); in add_tree_block()
317 if (!ref) in add_tree_block()
321 ref->root_objectid = 0; in add_tree_block()
323 ref->root_objectid = ref_root; in add_tree_block()
324 ref->parent = parent; in add_tree_block()
325 ref->owner = level; in add_tree_block()
326 ref->offset = 0; in add_tree_block()
327 ref->num_refs = 1; in add_tree_block()
331 kfree(ref); in add_tree_block()
344 exist = insert_ref_entry(&be->refs, ref); in add_tree_block()
347 kfree(ref); in add_tree_block()
359 struct ref_entry *ref; in add_shared_data_ref() local
361 ref = kzalloc(sizeof(struct ref_entry), GFP_NOFS); in add_shared_data_ref()
362 if (!ref) in add_shared_data_ref()
366 kfree(ref); in add_shared_data_ref()
371 ref->parent = parent; in add_shared_data_ref()
372 ref->num_refs = num_refs; in add_shared_data_ref()
373 if (insert_ref_entry(&be->refs, ref)) { in add_shared_data_ref()
375 btrfs_err(fs_info, "existing shared ref when reading from disk?"); in add_shared_data_ref()
376 kfree(ref); in add_shared_data_ref()
389 struct ref_entry *ref; in add_extent_data_ref() local
396 ref = kzalloc(sizeof(struct ref_entry), GFP_NOFS); in add_extent_data_ref()
397 if (!ref) in add_extent_data_ref()
401 kfree(ref); in add_extent_data_ref()
406 ref->parent = 0; in add_extent_data_ref()
407 ref->owner = owner; in add_extent_data_ref()
408 ref->root_objectid = ref_root; in add_extent_data_ref()
409 ref->offset = offset; in add_extent_data_ref()
410 ref->num_refs = num_refs; in add_extent_data_ref()
411 if (insert_ref_entry(&be->refs, ref)) { in add_extent_data_ref()
413 btrfs_err(fs_info, "existing ref when reading from disk?"); in add_extent_data_ref()
414 kfree(ref); in add_extent_data_ref()
610 " Ref action %d, root %llu, ref_root %llu, parent %llu, owner %llu, offset %llu, num_refs %llu", in dump_ref_action()
611 ra->action, ra->root, ra->ref.root_objectid, ra->ref.parent, in dump_ref_action()
612 ra->ref.owner, ra->ref.offset, ra->ref.num_refs); in dump_ref_action()
623 struct ref_entry *ref; in dump_block_entry() local
634 ref = rb_entry(n, struct ref_entry, node); in dump_block_entry()
636 " ref root %llu, parent %llu, owner %llu, offset %llu, num_refs %llu", in dump_block_entry()
637 ref->root_objectid, ref->parent, ref->owner, in dump_block_entry()
638 ref->offset, ref->num_refs); in dump_block_entry()
652 * btrfs_ref_tree_mod: called when we modify a ref for a bytenr
662 struct ref_entry *ref = NULL, *exist; in btrfs_ref_tree_mod() local
690 ref = kzalloc(sizeof(struct ref_entry), GFP_NOFS); in btrfs_ref_tree_mod()
692 if (!ra || !ref) { in btrfs_ref_tree_mod()
693 kfree(ref); in btrfs_ref_tree_mod()
699 ref->parent = parent; in btrfs_ref_tree_mod()
700 ref->owner = owner; in btrfs_ref_tree_mod()
701 ref->root_objectid = ref_root; in btrfs_ref_tree_mod()
702 ref->offset = offset; in btrfs_ref_tree_mod()
703 ref->num_refs = (action == BTRFS_DROP_DELAYED_REF) ? -1 : 1; in btrfs_ref_tree_mod()
705 memcpy(&ra->ref, ref, sizeof(struct ref_entry)); in btrfs_ref_tree_mod()
707 * Save the extra info from the delayed ref in the ref action to make it in btrfs_ref_tree_mod()
708 * easier to figure out what is happening. The real ref's we add to the in btrfs_ref_tree_mod()
709 * ref tree need to reflect what we save on disk so it matches any in btrfs_ref_tree_mod()
712 ra->ref.owner = owner; in btrfs_ref_tree_mod()
713 ra->ref.offset = offset; in btrfs_ref_tree_mod()
714 ra->ref.root_objectid = ref_root; in btrfs_ref_tree_mod()
730 * in root as if it really has a ref for this bytenr. in btrfs_ref_tree_mod()
734 kfree(ref); in btrfs_ref_tree_mod()
748 kfree(ref); in btrfs_ref_tree_mod()
767 kfree(ref); in btrfs_ref_tree_mod()
789 kfree(ref); in btrfs_ref_tree_mod()
798 kfree(ref); in btrfs_ref_tree_mod()
812 exist = insert_ref_entry(&be->refs, ref); in btrfs_ref_tree_mod()
817 "dropping a ref for a existing root that doesn't have a ref on the block"); in btrfs_ref_tree_mod()
820 kfree(ref); in btrfs_ref_tree_mod()
833 "attempting to add another ref for an existing ref on a tree block"); in btrfs_ref_tree_mod()
836 kfree(ref); in btrfs_ref_tree_mod()
840 kfree(ref); in btrfs_ref_tree_mod()
844 "dropping a ref for a root that doesn't have a ref on the block"); in btrfs_ref_tree_mod()
847 kfree(ref); in btrfs_ref_tree_mod()
889 /* Free up the ref cache */
972 /* Walk down all roots and build the ref tree, meant to be called at mount */
999 * because we could have run out of space for an inline ref, and in btrfs_build_ref_tree()
1000 * would have had to added a ref key item which may appear on a in btrfs_build_ref_tree()