if (!state)
return;
if (atomic_dec_and_test(&state->refs)) {
+ ASSERT(!waitqueue_active(&state->wq));
WARN_ON(extent_state_in_tree(state));
btrfs_leak_debug_del(&state->leak_list);
trace_free_extent_state(state, _RET_IP_);
state->start = other->start;
rb_erase(&other->rb_node, &tree->state);
RB_CLEAR_NODE(&other->rb_node);
+ ASSERT(!waitqueue_active(&other->wq));
free_extent_state(other);
}
}
state->end = other->end;
rb_erase(&other->rb_node, &tree->state);
RB_CLEAR_NODE(&other->rb_node);
+ ASSERT(!waitqueue_active(&other->wq));
free_extent_state(other);
}
}
}
clear_state_cb(tree, state, bits);
state->state &= ~bits_to_clear;
+ smp_mb();
+ BUG_ON((bits_to_clear & EXTENT_LOCKED) && !wake && waitqueue_active(&state->wq));
if (wake)
wake_up(&state->wq);
if (state->state == 0) {
if (extent_state_in_tree(state)) {
rb_erase(&state->rb_node, &tree->state);
RB_CLEAR_NODE(&state->rb_node);
+ ASSERT(!waitqueue_active(&state->wq));
free_extent_state(state);
} else {
WARN_ON(1);
while (!RB_EMPTY_ROOT(&io_tree->state)) {
struct extent_state *state;
struct extent_state *cached_state = NULL;
+ int locked;
node = rb_first(&io_tree->state);
state = rb_entry(node, struct extent_state, rb_node);
atomic_inc(&state->refs);
spin_unlock(&io_tree->lock);
+ locked = state->state & EXTENT_LOCKED;
+ if (locked)
+ printk(KERN_ERR "AQUI3 evict inode %llu root %llu range [%llu %llu], state %u, refs %d, before lock, in tree %d\n",
+ btrfs_ino(inode), BTRFS_I(inode)->root->root_key.objectid, state->start, state->end, state->state,
+ atomic_read(&state->refs), !RB_EMPTY_NODE(&state->rb_node));
lock_extent_bits(io_tree, state->start, state->end,
0, &cached_state);
+ if (locked)
+ printk(KERN_ERR "AQUI3 evict inode %llu root %llu range [%llu %llu], state %u, refs %d, after lock, in tree %d\n",
+ btrfs_ino(inode), BTRFS_I(inode)->root->root_key.objectid, state->start, state->end, state->state,
+ atomic_read(&state->refs), !RB_EMPTY_NODE(&state->rb_node));
clear_extent_bit(io_tree, state->start, state->end,
EXTENT_LOCKED | EXTENT_DIRTY |
EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING |