diff mbox series

[v2] btrfs/extent_map: Remove unneeded variable "ret"

Message ID 1533474287-15049-1-git-send-email-zhongjiang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [v2] btrfs/extent_map: Remove unneeded variable "ret" | expand

Commit Message

zhong jiang Aug. 5, 2018, 1:04 p.m. UTC
The ret is not used after initalization, and we do not care about
the return value. So make it void function.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
 fs/btrfs/extent_map.c | 10 ++--------
 fs/btrfs/extent_map.h |  4 ++--
 2 files changed, 4 insertions(+), 10 deletions(-)

Comments

zhong jiang Aug. 23, 2018, 11:31 a.m. UTC | #1
Hi,  dsterba

Can you pick up the patch? Thanks

Best wishes,
zhong jiang
 
On 2018/8/5 21:04, zhong jiang wrote:
> The ret is not used after initalization, and we do not care about
> the return value. So make it void function.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
>  fs/btrfs/extent_map.c | 10 ++--------
>  fs/btrfs/extent_map.h |  4 ++--
>  2 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
> index 6648d55..da4e4f3 100644
> --- a/fs/btrfs/extent_map.c
> +++ b/fs/btrfs/extent_map.c
> @@ -273,10 +273,9 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em)
>   * to the generation that actually added the file item to the inode so we know
>   * we need to sync this extent when we call fsync().
>   */
> -int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
> +void unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
>  		       u64 gen)
>  {
> -	int ret = 0;
>  	struct extent_map *em;
>  	bool prealloc = false;
>  
> @@ -308,8 +307,6 @@ int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
>  	free_extent_map(em);
>  out:
>  	write_unlock(&tree->lock);
> -	return ret;
> -
>  }
>  
>  void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em)
> @@ -428,16 +425,13 @@ struct extent_map *search_extent_mapping(struct extent_map_tree *tree,
>   * Removes @em from @tree.  No reference counts are dropped, and no checks
>   * are done to see if the range is in use
>   */
> -int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em)
> +void remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em)
>  {
> -	int ret = 0;
> -
>  	WARN_ON(test_bit(EXTENT_FLAG_PINNED, &em->flags));
>  	rb_erase(&em->rb_node, &tree->map);
>  	if (!test_bit(EXTENT_FLAG_LOGGING, &em->flags))
>  		list_del_init(&em->list);
>  	RB_CLEAR_NODE(&em->rb_node);
> -	return ret;
>  }
>  
>  void replace_extent_mapping(struct extent_map_tree *tree,
> diff --git a/fs/btrfs/extent_map.h b/fs/btrfs/extent_map.h
> index 25d985e..c80649b 100644
> --- a/fs/btrfs/extent_map.h
> +++ b/fs/btrfs/extent_map.h
> @@ -78,7 +78,7 @@ struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree,
>  					 u64 start, u64 len);
>  int add_extent_mapping(struct extent_map_tree *tree,
>  		       struct extent_map *em, int modified);
> -int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em);
> +void remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em);
>  void replace_extent_mapping(struct extent_map_tree *tree,
>  			    struct extent_map *cur,
>  			    struct extent_map *new,
> @@ -88,7 +88,7 @@ void replace_extent_mapping(struct extent_map_tree *tree,
>  void free_extent_map(struct extent_map *em);
>  int __init extent_map_init(void);
>  void __cold extent_map_exit(void);
> -int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, u64 gen);
> +void unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, u64 gen);
>  void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em);
>  struct extent_map *search_extent_mapping(struct extent_map_tree *tree,
>  					 u64 start, u64 len);
David Sterba Sept. 11, 2018, 3:44 p.m. UTC | #2
On Thu, Aug 23, 2018 at 07:31:40PM +0800, zhong jiang wrote:
> Hi,  dsterba
> 
> Can you pick up the patch? Thanks

Please send one patch per changed function with relevant changelog that
the return value is not used and that no callees could potentially
return an error that would need to be passed.
zhong jiang Sept. 11, 2018, 3:56 p.m. UTC | #3
On 2018/9/11 23:44, David Sterba wrote:
> On Thu, Aug 23, 2018 at 07:31:40PM +0800, zhong jiang wrote:
>> Hi,  dsterba
>>
>> Can you pick up the patch? Thanks
> Please send one patch per changed function with relevant changelog that
> the return value is not used and that no callees could potentially
> return an error that would need to be passed.
Will do in v3

Thanks,
zhong jiang
diff mbox series

Patch

diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 6648d55..da4e4f3 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -273,10 +273,9 @@  static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em)
  * to the generation that actually added the file item to the inode so we know
  * we need to sync this extent when we call fsync().
  */
-int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
+void unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
 		       u64 gen)
 {
-	int ret = 0;
 	struct extent_map *em;
 	bool prealloc = false;
 
@@ -308,8 +307,6 @@  int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len,
 	free_extent_map(em);
 out:
 	write_unlock(&tree->lock);
-	return ret;
-
 }
 
 void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em)
@@ -428,16 +425,13 @@  struct extent_map *search_extent_mapping(struct extent_map_tree *tree,
  * Removes @em from @tree.  No reference counts are dropped, and no checks
  * are done to see if the range is in use
  */
-int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em)
+void remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em)
 {
-	int ret = 0;
-
 	WARN_ON(test_bit(EXTENT_FLAG_PINNED, &em->flags));
 	rb_erase(&em->rb_node, &tree->map);
 	if (!test_bit(EXTENT_FLAG_LOGGING, &em->flags))
 		list_del_init(&em->list);
 	RB_CLEAR_NODE(&em->rb_node);
-	return ret;
 }
 
 void replace_extent_mapping(struct extent_map_tree *tree,
diff --git a/fs/btrfs/extent_map.h b/fs/btrfs/extent_map.h
index 25d985e..c80649b 100644
--- a/fs/btrfs/extent_map.h
+++ b/fs/btrfs/extent_map.h
@@ -78,7 +78,7 @@  struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree,
 					 u64 start, u64 len);
 int add_extent_mapping(struct extent_map_tree *tree,
 		       struct extent_map *em, int modified);
-int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em);
+void remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em);
 void replace_extent_mapping(struct extent_map_tree *tree,
 			    struct extent_map *cur,
 			    struct extent_map *new,
@@ -88,7 +88,7 @@  void replace_extent_mapping(struct extent_map_tree *tree,
 void free_extent_map(struct extent_map *em);
 int __init extent_map_init(void);
 void __cold extent_map_exit(void);
-int unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, u64 gen);
+void unpin_extent_cache(struct extent_map_tree *tree, u64 start, u64 len, u64 gen);
 void clear_em_logging(struct extent_map_tree *tree, struct extent_map *em);
 struct extent_map *search_extent_mapping(struct extent_map_tree *tree,
 					 u64 start, u64 len);