Btrfs: use next_state in find_first_extent_bit
PATCH 1/1 Btrfs: use next_state in find_first_extent_bit
As next_state() is already defined to get the next state, update us to use the helper.
No functional changes.
Signed-off-by Liu Bo <[email protected]>
--- fs/btrfs/extent_io.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
fs/btrfs/extent_io.c +1 -6
@@ -1424,20 +1424,15 @@ int find_first_extent_bit(struct extent_io_tree *tree, u64 start, struct extent_state **cached_state) {struct extent_state *state; -struct rb_node *n;int ret =1 ;spin_lock (&tree->lock);if (cached_state && *cached_state) { state = *cached_state;if (state->end == start -1 &&extent_state_in_tree (state)) { - n =rb_next (&state->rb_node); -while (n) { - state = rb_entry(n, struct extent_state, - rb_node); +while ((state =next_state (state)) !=NULL ) {if (state->state & bits) goto got_it; - n =rb_next (n); }free_extent_state (*cached_state); *cached_state =NULL ;
Signature · 1 line
1.8.3.1
Quoted 6 lines · Liu Bo
As
next_state()is already defined to get the next state, update us to use the helper.No functional changes.
Signed-off-by Liu Bo <[email protected]>
Reviewed-by Qu Wenruo <[email protected]>
Thanks,
Qu
Quoted 31 lines
--- fs/btrfs/extent_io.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)fs/btrfs/extent_io.c +1
-6@@ -1424,20 +1424,15 @@ int find_first_extent_bit(struct extent_io_tree *tree, u64 start, struct extent_state **cached_state) {struct extent_state *state; -struct rb_node *n;int ret =1 ;spin_lock (&tree->lock);if (cached_state && *cached_state) { state = *cached_state;if (state->end == start -1 &&extent_state_in_tree (state)) { - n =rb_next (&state->rb_node); -while (n) { - state = rb_entry(n, struct extent_state, - rb_node); +while ((state =next_state (state)) !=NULL ) {if (state->state & bits) goto got_it; - n =rb_next (n); }free_extent_state (*cached_state); *cached_state =NULL ;
Quoted 6 lines · Liu Bo
As
next_state()is already defined to get the next state, update us to use the helper.No functional changes.
Signed-off-by Liu Bo <[email protected]>
Added to misc-next, thanks.