All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] fs: btrfs: simplify close_ctree_fs_info()
@ 2020-12-25 12:45 ` Heinrich Schuchardt
  0 siblings, 0 replies; 6+ messages in thread
From: Heinrich Schuchardt @ 2020-12-25 12:45 UTC (permalink / raw)
  To: Marek Behun; +Cc: Qu Wenruo, linux-btrfs, u-boot, Heinrich Schuchardt

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")
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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 1/1] fs: btrfs: simplify close_ctree_fs_info()
@ 2020-12-25 12:45 ` Heinrich Schuchardt
  0 siblings, 0 replies; 6+ messages in thread
From: Heinrich Schuchardt @ 2020-12-25 12:45 UTC (permalink / raw)
  To: u-boot

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")
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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] fs: btrfs: simplify close_ctree_fs_info()
  2020-12-25 12:45 ` Heinrich Schuchardt
@ 2020-12-25 13:08   ` Qu Wenruo
  -1 siblings, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2020-12-25 13:08 UTC (permalink / raw)
  To: Heinrich Schuchardt, Marek Behun; +Cc: linux-btrfs, u-boot



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
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] fs: btrfs: simplify close_ctree_fs_info()
@ 2020-12-25 13:08   ` Qu Wenruo
  0 siblings, 0 replies; 6+ messages in thread
From: Qu Wenruo @ 2020-12-25 13:08 UTC (permalink / raw)
  To: u-boot



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
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] fs: btrfs: simplify close_ctree_fs_info()
  2020-12-25 12:45 ` Heinrich Schuchardt
@ 2021-01-20 21:46   ` Tom Rini
  -1 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2021-01-20 21:46 UTC (permalink / raw)
  To: Heinrich Schuchardt; +Cc: Marek Behun, Qu Wenruo, linux-btrfs, u-boot

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

On Fri, Dec 25, 2020 at 01:45:25PM +0100, 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")
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: Qu Wenruo <wqu@suse.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] fs: btrfs: simplify close_ctree_fs_info()
@ 2021-01-20 21:46   ` Tom Rini
  0 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2021-01-20 21:46 UTC (permalink / raw)
  To: u-boot

On Fri, Dec 25, 2020 at 01:45:25PM +0100, 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")
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Reviewed-by: Qu Wenruo <wqu@suse.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210120/8473fd7c/attachment.sig>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-21  0:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-25 12:45 [PATCH 1/1] fs: btrfs: simplify close_ctree_fs_info() Heinrich Schuchardt
2020-12-25 12:45 ` Heinrich Schuchardt
2020-12-25 13:08 ` Qu Wenruo
2020-12-25 13:08   ` Qu Wenruo
2021-01-20 21:46 ` Tom Rini
2021-01-20 21:46   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.