xfs: remove unnecessary judgment from xfs_create
diff mbox series

Message ID 1585287956-2808-1-git-send-email-kaixuxia@tencent.com
State New
Headers show
Series
  • xfs: remove unnecessary judgment from xfs_create
Related show

Commit Message

kaixuxia March 27, 2020, 5:45 a.m. UTC
From: Kaixu Xia <kaixuxia@tencent.com>

Since the "no-allocation" reservations for file creations has
been removed, the resblks value should be larger than zero, so
remove unnecessary judgment.

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

Comments

Christoph Hellwig March 27, 2020, 9:04 a.m. UTC | #1
On Fri, Mar 27, 2020 at 01:45:56PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> Since the "no-allocation" reservations for file creations has
> been removed, the resblks value should be larger than zero, so
> remove unnecessary judgment.

The patch looks good:

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

Although I would replace "judgement" with "condition" in the commit
log.
Darrick J. Wong March 27, 2020, 3:45 p.m. UTC | #2
On Fri, Mar 27, 2020 at 01:45:56PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> Since the "no-allocation" reservations for file creations has
> been removed, the resblks value should be larger than zero, so
> remove unnecessary judgment.
> 
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

Seems reasonable, will test all this...

Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_inode.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index c5077e6..e41bddf 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -1219,8 +1219,7 @@
>  	unlock_dp_on_error = false;
>  
>  	error = xfs_dir_createname(tp, dp, name, ip->i_ino,
> -				   resblks ?
> -					resblks - XFS_IALLOC_SPACE_RES(mp) : 0);
> +					resblks - XFS_IALLOC_SPACE_RES(mp));
>  	if (error) {
>  		ASSERT(error != -ENOSPC);
>  		goto out_trans_cancel;
> -- 
> 1.8.3.1
>

Patch
diff mbox series

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index c5077e6..e41bddf 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1219,8 +1219,7 @@ 
 	unlock_dp_on_error = false;
 
 	error = xfs_dir_createname(tp, dp, name, ip->i_ino,
-				   resblks ?
-					resblks - XFS_IALLOC_SPACE_RES(mp) : 0);
+					resblks - XFS_IALLOC_SPACE_RES(mp));
 	if (error) {
 		ASSERT(error != -ENOSPC);
 		goto out_trans_cancel;