From: Josef Bacik Date: Mon, 12 Feb 2024 21:27:15 +0000 (-0500) Subject: btrfs: adjust while loop condition in run_delalloc_nocow X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=0ed30c17f699d5df73c445999b0114c5859d1145;p=linux.git btrfs: adjust while loop condition in run_delalloc_nocow We have the following pattern while (1) { if (cur_offset > end) break; } Which is just while (cur_offset <= end) { ... } so adjust the code to be more clear. Reviewed-by: Goldwyn Rodrigues Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d8037775ab751..2fe82614521c6 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1988,7 +1988,7 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode, nocow_args.end = end; nocow_args.writeback_path = true; - while (1) { + while (cur_offset <= end) { struct btrfs_block_group *nocow_bg = NULL; struct btrfs_ordered_extent *ordered; struct btrfs_key found_key; @@ -2192,8 +2192,6 @@ must_cow: */ if (ret) goto error; - if (cur_offset > end) - break; } btrfs_release_path(path);