diff options
author | Liu Bo <bo.liu@linux.alibaba.com> | 2018-08-22 21:14:53 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-10-15 17:23:28 +0200 |
commit | 9688e9a99e4b2d60d78fbaa270e7e0c70d90f6c2 (patch) | |
tree | 4082424f35e9fd3c96f67fc8d7d2450fe0f92ac7 /fs/btrfs/extent_io.c | |
parent | btrfs: locking: Add extra check in btrfs_init_new_buffer() to avoid deadlock (diff) | |
download | linux-9688e9a99e4b2d60d78fbaa270e7e0c70d90f6c2.tar.xz linux-9688e9a99e4b2d60d78fbaa270e7e0c70d90f6c2.zip |
Btrfs: use next_state in find_first_extent_bit
As next_state() is already defined to get the next state, use it in
find_first_extent_bit. No functional changes.
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r-- | fs/btrfs/extent_io.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 4dd6faab02bb..43bf4ec891c6 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -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; |