Commit df2a8e70 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: collapse wait_on_state() to its caller wait_extent_bit()

The wait_on_state() function is very short and has a single caller, which
is wait_extent_bit(), so remove the function and put its code into the
caller.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 28967c76
......@@ -127,7 +127,7 @@ void extent_io_tree_release(struct extent_io_tree *tree)
/*
* No need for a memory barrier here, as we are holding the tree
* lock and we only change the waitqueue while holding that lock
* (see wait_on_state()).
* (see wait_extent_bit()).
*/
ASSERT(!waitqueue_active(&state->wq));
free_extent_state(state);
......@@ -748,19 +748,6 @@ int __clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
}
static void wait_on_state(struct extent_io_tree *tree,
struct extent_state *state)
__releases(tree->lock)
__acquires(tree->lock)
{
DEFINE_WAIT(wait);
prepare_to_wait(&state->wq, &wait, TASK_UNINTERRUPTIBLE);
spin_unlock(&tree->lock);
schedule();
spin_lock(&tree->lock);
finish_wait(&state->wq, &wait);
}
/*
* Wait for one or more bits to clear on a range in the state tree.
* The range [start, end] is inclusive.
......@@ -798,9 +785,15 @@ static void wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
goto out;
if (state->state & bits) {
DEFINE_WAIT(wait);
start = state->start;
refcount_inc(&state->refs);
wait_on_state(tree, state);
prepare_to_wait(&state->wq, &wait, TASK_UNINTERRUPTIBLE);
spin_unlock(&tree->lock);
schedule();
spin_lock(&tree->lock);
finish_wait(&state->wq, &wait);
free_extent_state(state);
goto again;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment