linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create
@ 2020-10-09  8:29 xiakaixu1987
  2020-10-09 15:45 ` Darrick J. Wong
  2020-10-15  8:29 ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: xiakaixu1987 @ 2020-10-09  8:29 UTC (permalink / raw)
  To: linux-xfs; +Cc: darrick.wong, Kaixu Xia

From: Kaixu Xia <kaixuxia@tencent.com>

The function posix_acl_release() test the passed-in argument and
move on only when it is non-null, so maybe the null check in
xfs_generic_create is unnecessary.

Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
 fs/xfs/xfs_iops.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 5e165456da68..5907e999642c 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -206,10 +206,8 @@ xfs_generic_create(
 	xfs_finish_inode_setup(ip);
 
  out_free_acl:
-	if (default_acl)
-		posix_acl_release(default_acl);
-	if (acl)
-		posix_acl_release(acl);
+	posix_acl_release(default_acl);
+	posix_acl_release(acl);
 	return error;
 
  out_cleanup_inode:
-- 
2.20.0


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

* Re: [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create
  2020-10-09  8:29 [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create xiakaixu1987
@ 2020-10-09 15:45 ` Darrick J. Wong
  2020-11-12  2:32   ` kaixuxia
  2020-10-15  8:29 ` Christoph Hellwig
  1 sibling, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2020-10-09 15:45 UTC (permalink / raw)
  To: xiakaixu1987; +Cc: linux-xfs, Kaixu Xia

On Fri, Oct 09, 2020 at 04:29:10PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> The function posix_acl_release() test the passed-in argument and
> move on only when it is non-null, so maybe the null check in
> xfs_generic_create is unnecessary.
> 
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

Heh, yep.  Nice cleanup.
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_iops.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 5e165456da68..5907e999642c 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -206,10 +206,8 @@ xfs_generic_create(
>  	xfs_finish_inode_setup(ip);
>  
>   out_free_acl:
> -	if (default_acl)
> -		posix_acl_release(default_acl);
> -	if (acl)
> -		posix_acl_release(acl);
> +	posix_acl_release(default_acl);
> +	posix_acl_release(acl);
>  	return error;
>  
>   out_cleanup_inode:
> -- 
> 2.20.0
> 

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

* Re: [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create
  2020-10-09  8:29 [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create xiakaixu1987
  2020-10-09 15:45 ` Darrick J. Wong
@ 2020-10-15  8:29 ` Christoph Hellwig
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2020-10-15  8:29 UTC (permalink / raw)
  To: xiakaixu1987; +Cc: linux-xfs, darrick.wong, Kaixu Xia

On Fri, Oct 09, 2020 at 04:29:10PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> The function posix_acl_release() test the passed-in argument and
> move on only when it is non-null, so maybe the null check in
> xfs_generic_create is unnecessary.
> 
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create
  2020-10-09 15:45 ` Darrick J. Wong
@ 2020-11-12  2:32   ` kaixuxia
  0 siblings, 0 replies; 4+ messages in thread
From: kaixuxia @ 2020-11-12  2:32 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs, Kaixu Xia



On 2020/10/9 23:45, Darrick J. Wong wrote:
> On Fri, Oct 09, 2020 at 04:29:10PM +0800, xiakaixu1987@gmail.com wrote:
>> From: Kaixu Xia <kaixuxia@tencent.com>
>>
>> The function posix_acl_release() test the passed-in argument and
>> move on only when it is non-null, so maybe the null check in
>> xfs_generic_create is unnecessary.
>>
>> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
> 
> Heh, yep.  Nice cleanup.
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

Hi Darrick,

There are some patches that have been reviewed but not been merged
into xfs for-next branch, I will reply to them.
Sorry for the noise:)

Thanks,
Kaixu
> 
> --D
> 
>> ---
>>  fs/xfs/xfs_iops.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
>> index 5e165456da68..5907e999642c 100644
>> --- a/fs/xfs/xfs_iops.c
>> +++ b/fs/xfs/xfs_iops.c
>> @@ -206,10 +206,8 @@ xfs_generic_create(
>>  	xfs_finish_inode_setup(ip);
>>  
>>   out_free_acl:
>> -	if (default_acl)
>> -		posix_acl_release(default_acl);
>> -	if (acl)
>> -		posix_acl_release(acl);
>> +	posix_acl_release(default_acl);
>> +	posix_acl_release(acl);
>>  	return error;
>>  
>>   out_cleanup_inode:
>> -- 
>> 2.20.0
>>

-- 
kaixuxia

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

end of thread, other threads:[~2020-11-12  5:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09  8:29 [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create xiakaixu1987
2020-10-09 15:45 ` Darrick J. Wong
2020-11-12  2:32   ` kaixuxia
2020-10-15  8:29 ` Christoph Hellwig

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