[06/26] xfs: refactor quotacheck flags usage
diff mbox series

Message ID 159477787448.3263162.11425861807454204294.stgit@magnolia
State Accepted
Headers show
Series
  • xfs: remove xfs_disk_quot from incore dquot
Related show

Commit Message

Darrick J. Wong July 15, 2020, 1:51 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

We only use the XFS_QMOPT flags in quotacheck to signal the quota type,
so rip out all the flags handling and just pass the type all the way
through.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_qm.c |   18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

Comments

Chandan Babu R July 16, 2020, 6:59 a.m. UTC | #1
On Wednesday 15 July 2020 7:21:14 AM IST Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> We only use the XFS_QMOPT flags in quotacheck to signal the quota type,
> so rip out all the flags handling and just pass the type all the way
> through.
>

The changes look good to me.

Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>

> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_qm.c |   18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)
> 
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index 9c455ebd20cb..939ee728d9af 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -902,17 +902,13 @@ xfs_qm_reset_dqcounts_all(
>  	xfs_dqid_t		firstid,
>  	xfs_fsblock_t		bno,
>  	xfs_filblks_t		blkcnt,
> -	uint			flags,
> +	xfs_dqtype_t		type,
>  	struct list_head	*buffer_list)
>  {
>  	struct xfs_buf		*bp;
> -	int			error;
> -	xfs_dqtype_t		type;
> +	int			error = 0;
>  
>  	ASSERT(blkcnt > 0);
> -	type = flags & XFS_QMOPT_UQUOTA ? XFS_DQTYPE_USER :
> -		(flags & XFS_QMOPT_PQUOTA ? XFS_DQTYPE_PROJ : XFS_DQTYPE_GROUP);
> -	error = 0;
>  
>  	/*
>  	 * Blkcnt arg can be a very big number, and might even be
> @@ -972,7 +968,7 @@ STATIC int
>  xfs_qm_reset_dqcounts_buf(
>  	struct xfs_mount	*mp,
>  	struct xfs_inode	*qip,
> -	uint			flags,
> +	xfs_dqtype_t		type,
>  	struct list_head	*buffer_list)
>  {
>  	struct xfs_bmbt_irec	*map;
> @@ -1048,7 +1044,7 @@ xfs_qm_reset_dqcounts_buf(
>  			error = xfs_qm_reset_dqcounts_all(mp, firstid,
>  						   map[i].br_startblock,
>  						   map[i].br_blockcount,
> -						   flags, buffer_list);
> +						   type, buffer_list);
>  			if (error)
>  				goto out;
>  		}
> @@ -1292,7 +1288,7 @@ xfs_qm_quotacheck(
>  	 * We don't log our changes till later.
>  	 */
>  	if (uip) {
> -		error = xfs_qm_reset_dqcounts_buf(mp, uip, XFS_QMOPT_UQUOTA,
> +		error = xfs_qm_reset_dqcounts_buf(mp, uip, XFS_DQTYPE_USER,
>  					 &buffer_list);
>  		if (error)
>  			goto error_return;
> @@ -1300,7 +1296,7 @@ xfs_qm_quotacheck(
>  	}
>  
>  	if (gip) {
> -		error = xfs_qm_reset_dqcounts_buf(mp, gip, XFS_QMOPT_GQUOTA,
> +		error = xfs_qm_reset_dqcounts_buf(mp, gip, XFS_DQTYPE_GROUP,
>  					 &buffer_list);
>  		if (error)
>  			goto error_return;
> @@ -1308,7 +1304,7 @@ xfs_qm_quotacheck(
>  	}
>  
>  	if (pip) {
> -		error = xfs_qm_reset_dqcounts_buf(mp, pip, XFS_QMOPT_PQUOTA,
> +		error = xfs_qm_reset_dqcounts_buf(mp, pip, XFS_DQTYPE_PROJ,
>  					 &buffer_list);
>  		if (error)
>  			goto error_return;
> 
>

Patch
diff mbox series

diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 9c455ebd20cb..939ee728d9af 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -902,17 +902,13 @@  xfs_qm_reset_dqcounts_all(
 	xfs_dqid_t		firstid,
 	xfs_fsblock_t		bno,
 	xfs_filblks_t		blkcnt,
-	uint			flags,
+	xfs_dqtype_t		type,
 	struct list_head	*buffer_list)
 {
 	struct xfs_buf		*bp;
-	int			error;
-	xfs_dqtype_t		type;
+	int			error = 0;
 
 	ASSERT(blkcnt > 0);
-	type = flags & XFS_QMOPT_UQUOTA ? XFS_DQTYPE_USER :
-		(flags & XFS_QMOPT_PQUOTA ? XFS_DQTYPE_PROJ : XFS_DQTYPE_GROUP);
-	error = 0;
 
 	/*
 	 * Blkcnt arg can be a very big number, and might even be
@@ -972,7 +968,7 @@  STATIC int
 xfs_qm_reset_dqcounts_buf(
 	struct xfs_mount	*mp,
 	struct xfs_inode	*qip,
-	uint			flags,
+	xfs_dqtype_t		type,
 	struct list_head	*buffer_list)
 {
 	struct xfs_bmbt_irec	*map;
@@ -1048,7 +1044,7 @@  xfs_qm_reset_dqcounts_buf(
 			error = xfs_qm_reset_dqcounts_all(mp, firstid,
 						   map[i].br_startblock,
 						   map[i].br_blockcount,
-						   flags, buffer_list);
+						   type, buffer_list);
 			if (error)
 				goto out;
 		}
@@ -1292,7 +1288,7 @@  xfs_qm_quotacheck(
 	 * We don't log our changes till later.
 	 */
 	if (uip) {
-		error = xfs_qm_reset_dqcounts_buf(mp, uip, XFS_QMOPT_UQUOTA,
+		error = xfs_qm_reset_dqcounts_buf(mp, uip, XFS_DQTYPE_USER,
 					 &buffer_list);
 		if (error)
 			goto error_return;
@@ -1300,7 +1296,7 @@  xfs_qm_quotacheck(
 	}
 
 	if (gip) {
-		error = xfs_qm_reset_dqcounts_buf(mp, gip, XFS_QMOPT_GQUOTA,
+		error = xfs_qm_reset_dqcounts_buf(mp, gip, XFS_DQTYPE_GROUP,
 					 &buffer_list);
 		if (error)
 			goto error_return;
@@ -1308,7 +1304,7 @@  xfs_qm_quotacheck(
 	}
 
 	if (pip) {
-		error = xfs_qm_reset_dqcounts_buf(mp, pip, XFS_QMOPT_PQUOTA,
+		error = xfs_qm_reset_dqcounts_buf(mp, pip, XFS_DQTYPE_PROJ,
 					 &buffer_list);
 		if (error)
 			goto error_return;