linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Make btrfs_finish_extent_commit() return void
@ 2019-04-16  5:16 Qu Wenruo
  2019-04-16  5:19 ` Nikolay Borisov
  2019-04-24 16:34 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2019-04-16  5:16 UTC (permalink / raw)
  To: linux-btrfs

This function always return 0, and the only use case of @ret is to
output warning message for discard failure, which doesn't cause anything
wrong to the fs even discarding failed.

There is no need to make it return int.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/ctree.h       | 2 +-
 fs/btrfs/extent-tree.c | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b3642367a595..129f7520dc5f 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2758,7 +2758,7 @@ int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
 int btrfs_free_and_pin_reserved_extent(struct btrfs_fs_info *fs_info,
 				       u64 start, u64 len);
 void btrfs_prepare_extent_commit(struct btrfs_fs_info *fs_info);
-int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans);
+void btrfs_finish_extent_commit(struct btrfs_trans_handle *trans);
 int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
 			 struct btrfs_root *root,
 			 u64 bytenr, u64 num_bytes, u64 parent,
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index c5880329ae37..87a963d819c3 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6907,7 +6907,7 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,
 	return 0;
 }
 
-int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans)
+void btrfs_finish_extent_commit(struct btrfs_trans_handle *trans)
 {
 	struct btrfs_fs_info *fs_info = trans->fs_info;
 	struct btrfs_block_group_cache *block_group, *tmp;
@@ -6971,8 +6971,6 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans)
 				   ret, errstr);
 		}
 	}
-
-	return 0;
 }
 
 static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
-- 
2.21.0


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

* Re: [PATCH] btrfs: Make btrfs_finish_extent_commit() return void
  2019-04-16  5:16 [PATCH] btrfs: Make btrfs_finish_extent_commit() return void Qu Wenruo
@ 2019-04-16  5:19 ` Nikolay Borisov
  2019-04-24 16:34 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Borisov @ 2019-04-16  5:19 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs



On 16.04.19 г. 8:16 ч., Qu Wenruo wrote:
> This function always return 0, and the only use case of @ret is to
> output warning message for discard failure, which doesn't cause anything
> wrong to the fs even discarding failed.
> 
> There is no need to make it return int.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  fs/btrfs/ctree.h       | 2 +-
>  fs/btrfs/extent-tree.c | 4 +---
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index b3642367a595..129f7520dc5f 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -2758,7 +2758,7 @@ int btrfs_free_reserved_extent(struct btrfs_fs_info *fs_info,
>  int btrfs_free_and_pin_reserved_extent(struct btrfs_fs_info *fs_info,
>  				       u64 start, u64 len);
>  void btrfs_prepare_extent_commit(struct btrfs_fs_info *fs_info);
> -int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans);
> +void btrfs_finish_extent_commit(struct btrfs_trans_handle *trans);
>  int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
>  			 struct btrfs_root *root,
>  			 u64 bytenr, u64 num_bytes, u64 parent,
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index c5880329ae37..87a963d819c3 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -6907,7 +6907,7 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,
>  	return 0;
>  }
>  
> -int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans)
> +void btrfs_finish_extent_commit(struct btrfs_trans_handle *trans)
>  {
>  	struct btrfs_fs_info *fs_info = trans->fs_info;
>  	struct btrfs_block_group_cache *block_group, *tmp;
> @@ -6971,8 +6971,6 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans)
>  				   ret, errstr);
>  		}
>  	}
> -
> -	return 0;
>  }
>  
>  static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
> 

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

* Re: [PATCH] btrfs: Make btrfs_finish_extent_commit() return void
  2019-04-16  5:16 [PATCH] btrfs: Make btrfs_finish_extent_commit() return void Qu Wenruo
  2019-04-16  5:19 ` Nikolay Borisov
@ 2019-04-24 16:34 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2019-04-24 16:34 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Tue, Apr 16, 2019 at 01:16:37PM +0800, Qu Wenruo wrote:
> This function always return 0, and the only use case of @ret is to
> output warning message for discard failure, which doesn't cause anything
> wrong to the fs even discarding failed.
> 
> There is no need to make it return int.

Same comment as https://patchwork.kernel.org/patch/10901977/ , check the
whole callgraph of the function before making it return void.

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

end of thread, other threads:[~2019-04-24 16:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-16  5:16 [PATCH] btrfs: Make btrfs_finish_extent_commit() return void Qu Wenruo
2019-04-16  5:19 ` Nikolay Borisov
2019-04-24 16:34 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).