Re: [PATCH 13/29] btrfs: __btrfs_wait_marked_extents rename werr to ret err to ret2

Josef Bacik
2024-03-19T17:54:42Z

On Tue, Mar 19, 2024 at 08:25:21PM +0530, Anand Jain wrote:
> Rename the function's local variable werr to ret, and err to ret2.
> Also, align these two variable declarations with the other declarations in
> the function for better function space alignment.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
> fs/btrfs/transaction.c | 26 +++++++++++++-------------
> 1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index 167893457b58..f344f97a6035 100644
> --- a/fs/btrfs/transaction.c
> +++ b/fs/btrfs/transaction.c
> @@ -1173,12 +1173,12 @@ int btrfs_write_marked_extents(struct btrfs_fs_info *fs_info,
> static int __btrfs_wait_marked_extents(struct btrfs_fs_info *fs_info,
> struct extent_io_tree *dirty_pages)
> {
> - int err = 0;
> - int werr = 0;
> struct address_space *mapping = fs_info->btree_inode->i_mapping;
> struct extent_state *cached_state = NULL;
> u64 start = 0;
> u64 end;
> + int ret = 0;
> + int ret2 = 0;
>
> while (find_first_extent_bit(dirty_pages, start, &start, &end,
> EXTENT_NEED_WAIT, &cached_state)) {
> @@ -1190,22 +1190,22 @@ static int __btrfs_wait_marked_extents(struct btrfs_fs_info *fs_info,
> * concurrently - we do it only at transaction commit time when
> * it's safe to do it (through extent_io_tree_release()).
> */
> - err = clear_extent_bit(dirty_pages, start, end,
> - EXTENT_NEED_WAIT, &cached_state);
> - if (err == -ENOMEM)
> - err = 0;
> - if (!err)
> - err = filemap_fdatawait_range(mapping, start, end);
> - if (err)
> - werr = err;
> + ret2 = clear_extent_bit(dirty_pages, start, end,
> + EXTENT_NEED_WAIT, &cached_state);
> + if (ret2 == -ENOMEM)
> + ret2 = 0;
> + if (!ret2)
> + ret2 = filemap_fdatawait_range(mapping, start, end);
> + if (ret2)
> + ret = ret2;

Same comment here as the previous one. In fact now that I think about it I'd
rather you fix this problem first, and then do the cleanup, so we can easily
backport the fix to stable kernels.

Then once you clean everything up you can change this to just use one ret
variable. Thanks,

Josef