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
757 * if insert is true and there are too many inline back refs, the path
760 * NOTE: inline back refs are ordered in the same way that back ref
1006 u64 refs; in setup_inline_extent_backref() local
1020 refs = btrfs_extent_refs(leaf, ei); in setup_inline_extent_backref()
1021 refs += refs_to_add; in setup_inline_extent_backref()
1022 btrfs_set_extent_refs(leaf, ei, refs); in setup_inline_extent_backref()
1100 u64 refs; in update_inline_extent_backref() local
1103 refs = btrfs_extent_refs(leaf, ei); in update_inline_extent_backref()
1104 if (unlikely(refs_to_mod < 0 && refs + refs_to_mod <= 0)) { in update_inline_extent_backref()
1116 key.objectid, extent_size, refs_to_mod, refs); in update_inline_extent_backref()
1119 refs += refs_to_mod; in update_inline_extent_backref()
1120 btrfs_set_extent_refs(leaf, ei, refs); in update_inline_extent_backref()
1134 refs = btrfs_extent_data_ref_count(leaf, dref); in update_inline_extent_backref()
1137 refs = btrfs_shared_data_ref_count(leaf, sref); in update_inline_extent_backref()
1139 refs = 1; in update_inline_extent_backref()
1142 * blocks should not have refs > 1. in update_inline_extent_backref()
1161 if (unlikely(refs_to_mod < 0 && refs < -refs_to_mod)) { in update_inline_extent_backref()
1174 refs_to_mod, refs); in update_inline_extent_backref()
1177 refs += refs_to_mod; in update_inline_extent_backref()
1179 if (refs > 0) { in update_inline_extent_backref()
1181 btrfs_set_extent_data_ref_count(leaf, dref, refs); in update_inline_extent_backref()
1183 btrfs_set_shared_data_ref_count(leaf, sref, refs); in update_inline_extent_backref()
1214 * We're adding refs to a tree block we already own, this in insert_inline_extent_backref()
1220 "adding refs to an existing tree ref, bytenr %llu num_bytes %llu root_objectid %llu slot %u", in insert_inline_extent_backref()
1498 u64 refs; in __btrfs_inc_extent_ref() local
1521 refs = btrfs_extent_refs(leaf, item); in __btrfs_inc_extent_ref()
1522 btrfs_set_extent_refs(leaf, item, refs + refs_to_add); in __btrfs_inc_extent_ref()
1838 * We had csum deletions accounted for in our delayed refs rsv, we need in btrfs_cleanup_ref_head_accounting()
2084 * Normally delayed refs get processed in ascending bytenr order. This
2238 refcount_inc(&head->refs); in check_delayed_ref()
2318 * locking to avoid races between the checks and flushing delayed refs,
2379 /* No inline refs; we need to bail before checking for owner ref. */ in check_committed_ref()
2383 /* Check for an owner ref; skip over it to the real inline refs. */ in check_committed_ref()
2944 /* We have inline refs, but not an owner ref. */ in btrfs_get_extent_owner_root()
2998 * Drop one or more refs of @node.
3000 * 1. Locate the extent refs.
3002 * Locate it, then reduce the refs number or remove the ref line completely.
3004 * 2. Update the refs count in EXTENT/METADATA_ITEM
3011 * refs 2 gen 6 flags DATA
3027 * refs 1 gen 6 flags DATA
3035 * refs 754 gen 6 flags DATA
3052 * refs 753 gen 6 flags DATA
3075 u64 refs; in __btrfs_free_extent() local
3094 "invalid refs_to_drop, dropping more than 1 refs for tree block %llu refs_to_drop %u", in __btrfs_free_extent()
3244 refs = btrfs_extent_refs(leaf, ei); in __btrfs_free_extent()
3245 if (refs < refs_to_drop) { in __btrfs_free_extent()
3247 "trying to drop %d refs but we only have %llu for bytenr %llu slot %u", in __btrfs_free_extent()
3248 refs_to_drop, refs, bytenr, path->slots[0]); in __btrfs_free_extent()
3252 refs -= refs_to_drop; in __btrfs_free_extent()
3254 if (refs > 0) { in __btrfs_free_extent()
3270 btrfs_set_extent_refs(leaf, ei, refs); in __btrfs_free_extent()
3289 /* In this branch refs == 1 */ in __btrfs_free_extent()
3294 "invalid refs_to_drop, current refs %u refs_to_drop %u slot %u", in __btrfs_free_extent()
3358 * a given extent, and if there are no other delayed refs to be processed, it
5203 u64 refs[BTRFS_MAX_LEVEL]; member
5242 * @refs: the number of refs for wc->level - 1
5263 ASSERT(wc->refs[level - 1] > 0); in visit_node_for_delete()
5277 * any refs it's pointing at. in visit_node_for_delete()
5279 if (wc->refs[level - 1] == 1) in visit_node_for_delete()
5317 u64 refs; in reada_walk_down() local
5354 wc->level - 1, 1, &refs, in reada_walk_down()
5362 * up with a bogus refs count, if that's the case just skip, if in reada_walk_down()
5366 if (refs == 0) in reada_walk_down()
5383 * back refs for pointers in the block.
5406 ((wc->stage == DROP_REFERENCE && wc->refs[level] != 1) || in walk_down_proc()
5411 &wc->refs[level], in walk_down_proc()
5416 if (unlikely(wc->refs[level] == 0)) { in walk_down_proc()
5424 if (wc->refs[level] > 1) in walk_down_proc()
5513 refcount_inc(&head->refs); in check_ref_exists()
5613 * If we had a drop_progress we need to verify the refs are set as in maybe_drop_reference()
5633 wc->refs[level - 1] > 1) { in maybe_drop_reference()
5663 * is shared and we need update back refs for the subtree
5688 * was created, we know there is no need to update back refs in do_walk_down()
5707 &wc->refs[level - 1], in do_walk_down()
5713 if (unlikely(wc->refs[level - 1] == 0)) { in do_walk_down()
5731 if (wc->stage == DROP_REFERENCE && wc->refs[level - 1] > 1) { in do_walk_down()
5758 wc->refs[level - 1] = 0; in do_walk_down()
5818 &wc->refs[level], in walk_up_proc()
5826 if (unlikely(wc->refs[level] == 0)) { in walk_up_proc()
5832 if (wc->refs[level] == 1) { in walk_up_proc()
5841 ASSERT(path->locks[level] || wc->refs[level] == 1); in walk_up_proc()
5843 if (wc->refs[level] == 1) { in walk_up_proc()
5884 wc->refs[level] == 1); in walk_up_proc()
5888 wc->refs[level] = 0; in walk_up_proc()
5961 * back to DROP_REFERENCE, lookup the current nodes refs and flags, and carry on.
5963 * DROP_REFERENCE. If our refs == 1 then we're going to free this tree block.
6115 level, 1, &wc->refs[level], in btrfs_drop_snapshot()
6120 BUG_ON(wc->refs[level] == 0); in btrfs_drop_snapshot()
6127 WARN_ON(wc->refs[level] != 1); in btrfs_drop_snapshot()
6316 atomic_inc(&parent->refs); in btrfs_drop_subtree()
6326 wc->refs[parent_level] = 1; in btrfs_drop_subtree()