{
tree->fs_info = fs_info;
tree->state = RB_ROOT;
- tree->dirty_bytes = 0;
spin_lock_init(&tree->lock);
tree->private_data = private_data;
tree->owner = owner;
if (tree->private_data && is_data_inode(tree->private_data))
btrfs_set_delalloc_extent(tree->private_data, state, bits);
- if ((bits_to_set & EXTENT_DIRTY) && !(state->state & EXTENT_DIRTY)) {
- u64 range = state->end - state->start + 1;
- tree->dirty_bytes += range;
- }
ret = add_extent_changeset(state, bits_to_set, changeset, 1);
BUG_ON(ret < 0);
state->state |= bits_to_set;
u32 bits_to_clear = bits & ~EXTENT_CTLBITS;
int ret;
- if ((bits_to_clear & EXTENT_DIRTY) && (state->state & EXTENT_DIRTY)) {
- u64 range = state->end - state->start + 1;
- WARN_ON(range > tree->dirty_bytes);
- tree->dirty_bytes -= range;
- }
-
if (tree->private_data && is_data_inode(tree->private_data))
btrfs_clear_delalloc_extent(tree->private_data, state, bits);
return 0;
spin_lock(&tree->lock);
- if (cur_start == 0 && bits == EXTENT_DIRTY) {
- total_bytes = tree->dirty_bytes;
- goto out;
- }
+
/*
* This search will find all the extents that end after our range
* starts.
}
state = next_state(state);
}
-out:
spin_unlock(&tree->lock);
return total_bytes;
}