From: Filipe Manana Date: Tue, 21 Nov 2023 13:38:37 +0000 (+0000) Subject: btrfs: use btrfs_next_item() at scrub.c:find_first_extent_item() X-Git-Tag: v6.8-rc1~155^2~72 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ebb0beca6c6a2d33f809a74bad63261651237833;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 00826644bca8e..2b04cdb3c4e98 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1408,14 +1408,11 @@ search_forward: 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);