Lines Matching refs: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;
62 * to it as well as all of the ref actions that have occurred to it. We never
165 struct ref_entry *ref)
175 cmp = comp_refs(entry, ref);
184 rb_link_node(&ref->node, parent_node, p);
185 rb_insert_color(&ref->node, root);
218 btrfs_err(fs_info, " ref-verify: no stacktrace");
231 btrfs_err(fs_info, " ref-verify: no stacktrace support");
238 struct ref_entry *ref;
249 ref = rb_entry(n, struct ref_entry, node);
250 rb_erase(&ref->node, &be->refs);
251 kfree(ref);
317 struct ref_entry *ref = NULL, *exist;
319 ref = kmalloc(sizeof(struct ref_entry), GFP_NOFS);
320 if (!ref)
324 ref->root_objectid = 0;
326 ref->root_objectid = ref_root;
327 ref->parent = parent;
328 ref->owner = level;
329 ref->offset = 0;
330 ref->num_refs = 1;
334 kfree(ref);
347 exist = insert_ref_entry(&be->refs, ref);
350 kfree(ref);
362 struct ref_entry *ref;
364 ref = kzalloc(sizeof(struct ref_entry), GFP_NOFS);
365 if (!ref)
369 kfree(ref);
374 ref->parent = parent;
375 ref->num_refs = num_refs;
376 if (insert_ref_entry(&be->refs, ref)) {
378 btrfs_err(fs_info, "existing shared ref when reading from disk?");
379 kfree(ref);
392 struct ref_entry *ref;
399 ref = kzalloc(sizeof(struct ref_entry), GFP_NOFS);
400 if (!ref)
404 kfree(ref);
409 ref->parent = 0;
410 ref->owner = owner;
411 ref->root_objectid = ref_root;
412 ref->offset = offset;
413 ref->num_refs = num_refs;
414 if (insert_ref_entry(&be->refs, ref)) {
416 btrfs_err(fs_info, "existing ref when reading from disk?");
417 kfree(ref);
614 ra->action, ra->root, ra->ref.root_objectid, ra->ref.parent,
615 ra->ref.owner, ra->ref.offset, ra->ref.num_refs);
626 struct ref_entry *ref;
637 ref = rb_entry(n, struct ref_entry, node);
639 " ref root %llu, parent %llu, owner %llu, offset %llu, num_refs %llu",
640 ref->root_objectid, ref->parent, ref->owner,
641 ref->offset, ref->num_refs);
655 * btrfs_ref_tree_mod: called when we modify a ref for a bytenr
665 struct ref_entry *ref = NULL, *exist;
693 ref = kzalloc(sizeof(struct ref_entry), GFP_NOFS);
695 if (!ra || !ref) {
696 kfree(ref);
702 ref->parent = parent;
703 ref->owner = owner;
704 ref->root_objectid = ref_root;
705 ref->offset = offset;
706 ref->num_refs = (action == BTRFS_DROP_DELAYED_REF) ? -1 : 1;
708 memcpy(&ra->ref, ref, sizeof(struct ref_entry));
710 * Save the extra info from the delayed ref in the ref action to make it
711 * easier to figure out what is happening. The real ref's we add to the
712 * ref tree need to reflect what we save on disk so it matches any
715 ra->ref.owner = owner;
716 ra->ref.offset = offset;
717 ra->ref.root_objectid = ref_root;
733 * in root as if it really has a ref for this bytenr.
737 kfree(ref);
751 kfree(ref);
770 kfree(ref);
792 kfree(ref);
802 kfree(ref);
817 exist = insert_ref_entry(&be->refs, ref);
822 "dropping a ref for a existing root that doesn't have a ref on the block");
825 kfree(ref);
838 "attempting to add another ref for an existing ref on a tree block");
841 kfree(ref);
845 kfree(ref);
849 "dropping a ref for a root that doesn't have a ref on the block");
852 kfree(ref);
896 /* Free up the ref cache */
979 /* Walk down all roots and build the ref tree, meant to be called at mount */
1006 * because we could have run out of space for an inline ref, and
1007 * would have had to added a ref key item which may appear on a