struct extent_buffer *next;
int level = wc->level;
int ret = 0;
- bool need_account = false;
generation = btrfs_node_ptr_generation(path->nodes[level],
path->slots[level]);
if (wc->stage == DROP_REFERENCE) {
if (wc->refs[level - 1] > 1) {
- need_account = true;
if (level == 1 &&
(wc->flags[0] & BTRFS_BLOCK_FLAG_FULL_BACKREF))
goto skip;
wc->reada_slot = 0;
return 0;
skip:
- wc->refs[level - 1] = 0;
- wc->flags[level - 1] = 0;
if (wc->stage == DROP_REFERENCE) {
struct btrfs_ref ref = {
.action = BTRFS_DROP_DELAYED_REF,
* already accounted them at merge time (replace_path),
* thus we could skip expensive subtree trace here.
*/
- if (btrfs_root_id(root) != BTRFS_TREE_RELOC_OBJECTID && need_account) {
+ if (btrfs_root_id(root) != BTRFS_TREE_RELOC_OBJECTID &&
+ wc->refs[level - 1] > 1) {
ret = btrfs_qgroup_trace_subtree(trans, next,
generation, level - 1);
if (ret) {
goto out_unlock;
}
no_delete:
+ wc->refs[level - 1] = 0;
+ wc->flags[level - 1] = 0;
wc->lookup_info = 1;
ret = 1;