All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: cleanup: remove unnecessary check before btrfs_free_path is called
@ 2015-08-19  5:55 Tsutomu Itoh
  2015-08-19  7:34 ` Qu Wenruo
  0 siblings, 1 reply; 3+ messages in thread
From: Tsutomu Itoh @ 2015-08-19  5:55 UTC (permalink / raw)
  To: linux-btrfs

We need not check path before btrfs_free_path() is called because
path is checked in btrfs_free_path().

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
---
 fs/btrfs/dev-replace.c | 3 +--
 fs/btrfs/inode.c       | 3 +--
 fs/btrfs/tree-defrag.c | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 564a7de..e54dd59 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -183,8 +183,7 @@ no_valid_dev_replace_entry_found:
 	}
 
 out:
-	if (path)
-		btrfs_free_path(path);
+	btrfs_free_path(path);
 	return ret;
 }
 
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index e33dff3..21ba036 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6876,8 +6876,7 @@ out:
 
 	trace_btrfs_get_extent(root, em);
 
-	if (path)
-		btrfs_free_path(path);
+	btrfs_free_path(path);
 	if (trans) {
 		ret = btrfs_end_transaction(trans, root);
 		if (!err)
diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c
index a4b9c8b..f31db43 100644
--- a/fs/btrfs/tree-defrag.c
+++ b/fs/btrfs/tree-defrag.c
@@ -115,8 +115,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
 		ret = -EAGAIN;
 	}
 out:
-	if (path)
-		btrfs_free_path(path);
+	btrfs_free_path(path);
 	if (ret == -EAGAIN) {
 		if (root->defrag_max.objectid > root->defrag_progress.objectid)
 			goto done;
-- 
2.4.5




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

* Re: [PATCH] Btrfs: cleanup: remove unnecessary check before btrfs_free_path is called
  2015-08-19  5:55 [PATCH] Btrfs: cleanup: remove unnecessary check before btrfs_free_path is called Tsutomu Itoh
@ 2015-08-19  7:34 ` Qu Wenruo
  2015-08-19  8:20   ` Tsutomu Itoh
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2015-08-19  7:34 UTC (permalink / raw)
  To: Tsutomu Itoh, linux-btrfs



Tsutomu Itoh wrote on 2015/08/19 14:55 +0900:
> We need not check path before btrfs_free_path() is called because
> path is checked in btrfs_free_path().
>
> Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>

Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

BTW, did you check btrfs-progs for the such cleanup?

Thanks,
Qu

> ---
>   fs/btrfs/dev-replace.c | 3 +--
>   fs/btrfs/inode.c       | 3 +--
>   fs/btrfs/tree-defrag.c | 3 +--
>   3 files changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
> index 564a7de..e54dd59 100644
> --- a/fs/btrfs/dev-replace.c
> +++ b/fs/btrfs/dev-replace.c
> @@ -183,8 +183,7 @@ no_valid_dev_replace_entry_found:
>   	}
>
>   out:
> -	if (path)
> -		btrfs_free_path(path);
> +	btrfs_free_path(path);
>   	return ret;
>   }
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index e33dff3..21ba036 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -6876,8 +6876,7 @@ out:
>
>   	trace_btrfs_get_extent(root, em);
>
> -	if (path)
> -		btrfs_free_path(path);
> +	btrfs_free_path(path);
>   	if (trans) {
>   		ret = btrfs_end_transaction(trans, root);
>   		if (!err)
> diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c
> index a4b9c8b..f31db43 100644
> --- a/fs/btrfs/tree-defrag.c
> +++ b/fs/btrfs/tree-defrag.c
> @@ -115,8 +115,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
>   		ret = -EAGAIN;
>   	}
>   out:
> -	if (path)
> -		btrfs_free_path(path);
> +	btrfs_free_path(path);
>   	if (ret == -EAGAIN) {
>   		if (root->defrag_max.objectid > root->defrag_progress.objectid)
>   			goto done;
>

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

* Re: [PATCH] Btrfs: cleanup: remove unnecessary check before btrfs_free_path is called
  2015-08-19  7:34 ` Qu Wenruo
@ 2015-08-19  8:20   ` Tsutomu Itoh
  0 siblings, 0 replies; 3+ messages in thread
From: Tsutomu Itoh @ 2015-08-19  8:20 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs

On 2015/08/19 16:34, Qu Wenruo wrote:
> Tsutomu Itoh wrote on 2015/08/19 14:55 +0900:
>> We need not check path before btrfs_free_path() is called because
>> path is checked in btrfs_free_path().
>>
>> Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
>
> Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

Thanks for the review.

>
> BTW, did you check btrfs-progs for the such cleanup?

I will check btrfs-progs soon.

Thanks,
Tsutomu

>
> Thanks,
> Qu
>
>> ---
>>   fs/btrfs/dev-replace.c | 3 +--
>>   fs/btrfs/inode.c       | 3 +--
>>   fs/btrfs/tree-defrag.c | 3 +--
>>   3 files changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
>> index 564a7de..e54dd59 100644
>> --- a/fs/btrfs/dev-replace.c
>> +++ b/fs/btrfs/dev-replace.c
>> @@ -183,8 +183,7 @@ no_valid_dev_replace_entry_found:
>>       }
>>
>>   out:
>> -    if (path)
>> -        btrfs_free_path(path);
>> +    btrfs_free_path(path);
>>       return ret;
>>   }
>>
>> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
>> index e33dff3..21ba036 100644
>> --- a/fs/btrfs/inode.c
>> +++ b/fs/btrfs/inode.c
>> @@ -6876,8 +6876,7 @@ out:
>>
>>       trace_btrfs_get_extent(root, em);
>>
>> -    if (path)
>> -        btrfs_free_path(path);
>> +    btrfs_free_path(path);
>>       if (trans) {
>>           ret = btrfs_end_transaction(trans, root);
>>           if (!err)
>> diff --git a/fs/btrfs/tree-defrag.c b/fs/btrfs/tree-defrag.c
>> index a4b9c8b..f31db43 100644
>> --- a/fs/btrfs/tree-defrag.c
>> +++ b/fs/btrfs/tree-defrag.c
>> @@ -115,8 +115,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
>>           ret = -EAGAIN;
>>       }
>>   out:
>> -    if (path)
>> -        btrfs_free_path(path);
>> +    btrfs_free_path(path);
>>       if (ret == -EAGAIN) {
>>           if (root->defrag_max.objectid > root->defrag_progress.objectid)
>>               goto done;
>>



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

end of thread, other threads:[~2015-08-19  8:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-19  5:55 [PATCH] Btrfs: cleanup: remove unnecessary check before btrfs_free_path is called Tsutomu Itoh
2015-08-19  7:34 ` Qu Wenruo
2015-08-19  8:20   ` Tsutomu Itoh

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.