Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Marek Behun <marek.behun@nic.cz>
Cc: linux-btrfs@vger.kernel.org, u-boot@lists.denx.de
Subject: Re: [PATCH 1/1] fs: btrfs: simplify close_ctree_fs_info()
Date: Fri, 25 Dec 2020 21:08:58 +0800	[thread overview]
Message-ID: <14307445-59dd-d2b8-1549-cac821c76555@suse.com> (raw)
In-Reply-To: <20201225124525.17707-1-xypron.glpk@gmx.de>



On 2020/12/25 下午8:45, Heinrich Schuchardt wrote:
> At the beginning of close_ctree_fs_info() the value 0 is assigned to err
> and never changed before testing it.
> 
> Let's get rid of the superfluous variable.
> 
> Fixes: f06bfcf54d0e ("fs: btrfs: Crossport open_ctree_fs_info() from btrfs-progs")

This is because current btrfs implementation of U-boot only support RO 
mount.

In btrfs-progs, since we support RW support, we will try to commit 
transaction and we can hit error during transaction commit.
Thus we use @ret to record current error and @error to record the final 
return value.

I don't believe U-boot would support btrfs read-write any time soon, 
thus the cleanup should be OK.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>   fs/btrfs/disk-io.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 01e7cee520..b332ecb796 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -1030,7 +1030,6 @@ out:
>   int close_ctree_fs_info(struct btrfs_fs_info *fs_info)
>   {
>   	int ret;
> -	int err = 0;
> 
>   	free_fs_roots_tree(&fs_info->fs_root_tree);
> 
> @@ -1038,9 +1037,7 @@ int close_ctree_fs_info(struct btrfs_fs_info *fs_info)
>   	ret = btrfs_close_devices(fs_info->fs_devices);
>   	btrfs_cleanup_all_caches(fs_info);
>   	btrfs_free_fs_info(fs_info);
> -	if (!err)
> -		err = ret;
> -	return err;
> +	return ret;
>   }
> 
>   int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid)
> --
> 2.29.2
> 


  reply	other threads:[~2020-12-25 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25 12:45 [PATCH 1/1] fs: btrfs: simplify close_ctree_fs_info() Heinrich Schuchardt
2020-12-25 13:08 ` Qu Wenruo [this message]
2021-01-20 21:46 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14307445-59dd-d2b8-1549-cac821c76555@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox