public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: combine two if statements with same condition
@ 2020-04-02  2:26 xiakaixu1987
  2020-04-02  4:42 ` Chaitanya Kulkarni
  2020-04-02  7:49 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: xiakaixu1987 @ 2020-04-02  2:26 UTC (permalink / raw)
  To: linux-xfs; +Cc: darrick.wong, Kaixu Xia

From: Kaixu Xia <kaixuxia@tencent.com>

The two if statements have same condition, and the mask value
does not change in xfs_setattr_nonsize(), so combine them.

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

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index f7a99b3..e348145 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -738,12 +738,7 @@
 			if (error)	/* out of quota */
 				goto out_cancel;
 		}
-	}
 
-	/*
-	 * Change file ownership.  Must be the owner or privileged.
-	 */
-	if (mask & (ATTR_UID|ATTR_GID)) {
 		/*
 		 * CAP_FSETID overrides the following restrictions:
 		 *
-- 
1.8.3.1


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

* Re: [PATCH] xfs: combine two if statements with same condition
  2020-04-02  2:26 [PATCH] xfs: combine two if statements with same condition xiakaixu1987
@ 2020-04-02  4:42 ` Chaitanya Kulkarni
  2020-04-02  7:49 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Chaitanya Kulkarni @ 2020-04-02  4:42 UTC (permalink / raw)
  To: xiakaixu1987@gmail.com, linux-xfs@vger.kernel.org
  Cc: darrick.wong@oracle.com, Kaixu Xia

On 4/1/20 7:26 PM, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
>
> The two if statements have same condition, and the mask value
> does not change in xfs_setattr_nonsize(), so combine them.
>
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

Prior to the commit c4ed4243c40f ("xfs: split xfs_setattr")
xfs_setattr() had truncate

handling in between two identical changing file ownership ifs.  Since
then truncate code is moved

out of xfs_setattr() and mask value stays the same in the first if, it
make sense to combine these

two ifs. Looks good to me.


Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>



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

* Re: [PATCH] xfs: combine two if statements with same condition
  2020-04-02  2:26 [PATCH] xfs: combine two if statements with same condition xiakaixu1987
  2020-04-02  4:42 ` Chaitanya Kulkarni
@ 2020-04-02  7:49 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-04-02  7:49 UTC (permalink / raw)
  To: xiakaixu1987; +Cc: linux-xfs, darrick.wong, Kaixu Xia

On Thu, Apr 02, 2020 at 10:26:34AM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> The two if statements have same condition, and the mask value
> does not change in xfs_setattr_nonsize(), so combine them.
> 
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

Looks good,

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

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

end of thread, other threads:[~2020-04-02  7:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-02  2:26 [PATCH] xfs: combine two if statements with same condition xiakaixu1987
2020-04-02  4:42 ` Chaitanya Kulkarni
2020-04-02  7:49 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox