Skip to content

Commit

Permalink
btrfs: use btrfs_next_item() at scrub.c:find_first_extent_item()
Browse files Browse the repository at this point in the history
There's no reason to open code what btrfs_next_item() does when searching
for extent items at scrub.c:scrub.c:find_first_extent_item(), so remove
the logic to find the next item and use btrfs_next_item() instead, making
the code shorter and less nested code blocks. While at it also fix the
comment to the plural "items" instead of "item" and end it with proper
punctuation.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Filipe Manana authored and David Sterba committed Dec 15, 2023
1 parent 2ecec0d commit ebb0bec
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions fs/btrfs/scrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1408,14 +1408,11 @@ static int find_first_extent_item(struct btrfs_root *extent_root,
if (ret > 0)
break;
next:
path->slots[0]++;
if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) {
ret = btrfs_next_leaf(extent_root, path);
if (ret) {
/* Either no more item or fatal error */
btrfs_release_path(path);
return ret;
}
ret = btrfs_next_item(extent_root, path);
if (ret) {
/* Either no more items or a fatal error. */
btrfs_release_path(path);
return ret;
}
}
btrfs_release_path(path);
Expand Down

0 comments on commit ebb0bec

Please sign in to comment.