Lines Matching full:refs
96 * the delayed refs are not processed.
100 u64 offset, int metadata, u64 *refs, u64 *flags, in btrfs_lookup_extent_info() argument
188 refcount_inc(&head->refs); in btrfs_lookup_extent_info()
213 if (refs) in btrfs_lookup_extent_info()
214 *refs = num_refs; in btrfs_lookup_extent_info()
225 * Back reference rules. Back refs have three main goals:
238 * There are two kinds of back refs. The implicit back refs is optimized
240 * back refs of this kind provide information about the block's owner tree
242 * b-tree searching. The full back refs is for pointers in tree blocks not
244 * in the back refs. Actually the full back refs is generic, and can be
245 * used in all cases the implicit back refs is used. The major shortcoming
246 * of the full back refs is its overhead. Every time a tree block gets
247 * COWed, we have to update back refs entry for all pointers in it.
249 * For a newly allocated tree block, we use implicit back refs for
251 * implicit back refs. For a tree block created in old transaction, the
254 * back refs conversion.
262 * block's owner tree. In this case, full back refs is used for pointers
263 * in the block. Remove these full back refs, add implicit back refs for
267 * the block's owner tree. In this case, implicit back refs is used for
268 * pointers in the block. Add full back refs for every pointers in the
270 * implicit back refs are entailed to the new block.
273 * not the block's owner tree. Add implicit back refs for every pointer in
279 * The key type is used to differentiate between types of back refs.
281 * of back refs.
289 * The extent ref structure for the implicit back refs has fields for:
296 * The key offset for the implicit back refs is hash of the first
299 * The extent ref structure for the full back refs has field for:
303 * The key offset for the implicit back refs is the first byte of
306 * When a file extent is allocated, The implicit back refs is used.
312 * corresponding implicit back refs and check the following fields:
320 * Both the implicit back refs and the full back refs for tree blocks
321 * only consist of key. The key offset for the implicit back refs is
322 * objectid of block's owner tree. The key offset for the full back refs
325 * When implicit back refs is used, information about the lowest key and
759 * if insert is true and there are too many inline back refs, the path
762 * NOTE: inline back refs are ordered in the same way that back ref
988 u64 refs; in setup_inline_extent_backref() local
1002 refs = btrfs_extent_refs(leaf, ei); in setup_inline_extent_backref()
1003 refs += refs_to_add; in setup_inline_extent_backref()
1004 btrfs_set_extent_refs(leaf, ei, refs); in setup_inline_extent_backref()
1083 u64 refs; in update_inline_extent_backref() local
1086 refs = btrfs_extent_refs(leaf, ei); in update_inline_extent_backref()
1087 if (unlikely(refs_to_mod < 0 && refs + refs_to_mod <= 0)) { in update_inline_extent_backref()
1099 key.objectid, extent_size, refs_to_mod, refs); in update_inline_extent_backref()
1102 refs += refs_to_mod; in update_inline_extent_backref()
1103 btrfs_set_extent_refs(leaf, ei, refs); in update_inline_extent_backref()
1117 refs = btrfs_extent_data_ref_count(leaf, dref); in update_inline_extent_backref()
1120 refs = btrfs_shared_data_ref_count(leaf, sref); in update_inline_extent_backref()
1122 refs = 1; in update_inline_extent_backref()
1125 * blocks should not have refs > 1. in update_inline_extent_backref()
1144 if (unlikely(refs_to_mod < 0 && refs < -refs_to_mod)) { in update_inline_extent_backref()
1157 refs_to_mod, refs); in update_inline_extent_backref()
1160 refs += refs_to_mod; in update_inline_extent_backref()
1162 if (refs > 0) { in update_inline_extent_backref()
1164 btrfs_set_extent_data_ref_count(leaf, dref, refs); in update_inline_extent_backref()
1166 btrfs_set_shared_data_ref_count(leaf, sref, refs); in update_inline_extent_backref()
1198 * We're adding refs to a tree block we already own, this in insert_inline_extent_backref()
1204 "adding refs to an existing tree ref, bytenr %llu num_bytes %llu root_objectid %llu slot %u", in insert_inline_extent_backref()
1482 u64 refs; in __btrfs_inc_extent_ref() local
1505 refs = btrfs_extent_refs(leaf, item); in __btrfs_inc_extent_ref()
1506 btrfs_set_extent_refs(leaf, item, refs + refs_to_add); in __btrfs_inc_extent_ref()
1859 * We had csum deletions accounted for in our delayed refs rsv, we need in btrfs_cleanup_ref_head_accounting()
1952 * Grab the lock that says we are going to process all the refs for in btrfs_obtain_ref_head()
2139 * Normally delayed refs get processed in ascending bytenr order. This
2292 refcount_inc(&head->refs); in check_delayed_ref()
2394 /* No inline refs; we need to bail before checking for owner ref. */ in check_committed_ref()
2398 /* Check for an owner ref; skip over it to the real inline refs. */ in check_committed_ref()
2959 /* We have inline refs, but not an owner ref. */ in btrfs_get_extent_owner_root()
3013 * Drop one or more refs of @node.
3015 * 1. Locate the extent refs.
3017 * Locate it, then reduce the refs number or remove the ref line completely.
3019 * 2. Update the refs count in EXTENT/METADATA_ITEM
3026 * refs 2 gen 6 flags DATA
3042 * refs 1 gen 6 flags DATA
3050 * refs 754 gen 6 flags DATA
3067 * refs 753 gen 6 flags DATA
3090 u64 refs; in __btrfs_free_extent() local
3109 "invalid refs_to_drop, dropping more than 1 refs for tree block %llu refs_to_drop %u", in __btrfs_free_extent()
3259 refs = btrfs_extent_refs(leaf, ei); in __btrfs_free_extent()
3260 if (refs < refs_to_drop) { in __btrfs_free_extent()
3262 "trying to drop %d refs but we only have %llu for bytenr %llu slot %u", in __btrfs_free_extent()
3263 refs_to_drop, refs, bytenr, path->slots[0]); in __btrfs_free_extent()
3267 refs -= refs_to_drop; in __btrfs_free_extent()
3269 if (refs > 0) { in __btrfs_free_extent()
3285 btrfs_set_extent_refs(leaf, ei, refs); in __btrfs_free_extent()
3305 /* In this branch refs == 1 */ in __btrfs_free_extent()
3310 "invalid refs_to_drop, current refs %u refs_to_drop %u slot %u", in __btrfs_free_extent()
3374 * a given extent, and if there are no other delayed refs to be processed, it
5220 u64 refs[BTRFS_MAX_LEVEL]; member
5259 * @refs: the number of refs for wc->level - 1
5273 struct extent_buffer *eb, u64 refs, u64 flags, int slot) in visit_node_for_delete() argument
5280 ASSERT(wc->refs[level - 1] > 0); in visit_node_for_delete()
5294 * any refs it's pointing at. in visit_node_for_delete()
5296 if (wc->refs[level - 1] == 1) in visit_node_for_delete()
5334 u64 refs; in reada_walk_down() local
5371 wc->level - 1, 1, &refs, in reada_walk_down()
5379 * up with a bogus refs count, if that's the case just skip, if in reada_walk_down()
5383 if (refs == 0) in reada_walk_down()
5387 if (!visit_node_for_delete(root, wc, eb, refs, flags, slot)) in reada_walk_down()
5400 * back refs for pointers in the block.
5423 ((wc->stage == DROP_REFERENCE && wc->refs[level] != 1) || in walk_down_proc()
5428 &wc->refs[level], in walk_down_proc()
5433 if (unlikely(wc->refs[level] == 0)) { in walk_down_proc()
5441 if (wc->refs[level] > 1) in walk_down_proc()
5530 refcount_inc(&head->refs); in check_ref_exists()
5630 * If we had a drop_progress we need to verify the refs are set as in maybe_drop_reference()
5650 wc->refs[level - 1] > 1) { in maybe_drop_reference()
5680 * is shared and we need update back refs for the subtree
5705 * was created, we know there is no need to update back refs in do_walk_down()
5724 &wc->refs[level - 1], in do_walk_down()
5730 if (unlikely(wc->refs[level - 1] == 0)) { in do_walk_down()
5740 wc->refs[level - 1], wc->flags[level - 1], in do_walk_down()
5749 if (wc->stage == DROP_REFERENCE && wc->refs[level - 1] > 1) { in do_walk_down()
5776 wc->refs[level - 1] = 0; in do_walk_down()
5836 &wc->refs[level], in walk_up_proc()
5844 if (unlikely(wc->refs[level] == 0)) { in walk_up_proc()
5850 if (wc->refs[level] == 1) { in walk_up_proc()
5859 ASSERT(path->locks[level] || wc->refs[level] == 1); in walk_up_proc()
5861 if (wc->refs[level] == 1) { in walk_up_proc()
5902 wc->refs[level] == 1); in walk_up_proc()
5906 wc->refs[level] = 0; in walk_up_proc()
5979 * back to DROP_REFERENCE, lookup the current nodes refs and flags, and carry on.
5981 * DROP_REFERENCE. If our refs == 1 then we're going to free this tree block.
6133 level, 1, &wc->refs[level], in btrfs_drop_snapshot()
6138 BUG_ON(wc->refs[level] == 0); in btrfs_drop_snapshot()
6145 WARN_ON(wc->refs[level] != 1); in btrfs_drop_snapshot()
6334 atomic_inc(&parent->refs); in btrfs_drop_subtree()
6344 wc->refs[parent_level] = 1; in btrfs_drop_subtree()