Skip to content

Commit ebb0bec

Browse files
fdmananakdave
authored andcommitted
btrfs: use btrfs_next_item() at scrub.c:find_first_extent_item()
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 <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 2ecec0d commit ebb0bec

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

fs/btrfs/scrub.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,14 +1408,11 @@ static int find_first_extent_item(struct btrfs_root *extent_root,
14081408
if (ret > 0)
14091409
break;
14101410
next:
1411-
path->slots[0]++;
1412-
if (path->slots[0] >= btrfs_header_nritems(path->nodes[0])) {
1413-
ret = btrfs_next_leaf(extent_root, path);
1414-
if (ret) {
1415-
/* Either no more item or fatal error */
1416-
btrfs_release_path(path);
1417-
return ret;
1418-
}
1411+
ret = btrfs_next_item(extent_root, path);
1412+
if (ret) {
1413+
/* Either no more items or a fatal error. */
1414+
btrfs_release_path(path);
1415+
return ret;
14191416
}
14201417
}
14211418
btrfs_release_path(path);

0 commit comments

Comments
 (0)