diff mbox series

[08/11] xfs: replace a few open-coded XFS_DQTYPE_REC_MASK uses

Message ID 159488197022.3813063.2727213433560259185.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series xfs: separate dquot type from flags | expand

Commit Message

Darrick J. Wong July 16, 2020, 6:46 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Fix a few places where we open-coded this mask constant.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_dquot_item_recover.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Dave Chinner July 17, 2020, 12:02 a.m. UTC | #1
On Wed, Jul 15, 2020 at 11:46:10PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Fix a few places where we open-coded this mask constant.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  fs/xfs/xfs_dquot_item_recover.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/fs/xfs/xfs_dquot_item_recover.c b/fs/xfs/xfs_dquot_item_recover.c
> index d7eb85c7d394..93178341569a 100644
> --- a/fs/xfs/xfs_dquot_item_recover.c
> +++ b/fs/xfs/xfs_dquot_item_recover.c
> @@ -39,7 +39,7 @@ xlog_recover_dquot_ra_pass2(
>  	if (item->ri_buf[1].i_len < sizeof(struct xfs_disk_dquot))
>  		return;
>  
> -	type = recddq->d_flags & (XFS_DQTYPE_USER | XFS_DQTYPE_PROJ | XFS_DQTYPE_GROUP);
> +	type = recddq->d_flags & XFS_DQTYPE_REC_MASK;
>  	ASSERT(type);
>  	if (log->l_quotaoffs_flag & type)
>  		return;
> @@ -91,7 +91,7 @@ xlog_recover_dquot_commit_pass2(
>  	/*
>  	 * This type of quotas was turned off, so ignore this record.
>  	 */
> -	type = recddq->d_flags & (XFS_DQTYPE_USER | XFS_DQTYPE_PROJ | XFS_DQTYPE_GROUP);
> +	type = recddq->d_flags & XFS_DQTYPE_REC_MASK;

Couldn't these both be converted to xfs_dquot_type(recddq)?

Cheers,

Dave.
Darrick J. Wong July 17, 2020, 1:07 a.m. UTC | #2
On Fri, Jul 17, 2020 at 10:02:42AM +1000, Dave Chinner wrote:
> On Wed, Jul 15, 2020 at 11:46:10PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Fix a few places where we open-coded this mask constant.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  fs/xfs/xfs_dquot_item_recover.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > 
> > diff --git a/fs/xfs/xfs_dquot_item_recover.c b/fs/xfs/xfs_dquot_item_recover.c
> > index d7eb85c7d394..93178341569a 100644
> > --- a/fs/xfs/xfs_dquot_item_recover.c
> > +++ b/fs/xfs/xfs_dquot_item_recover.c
> > @@ -39,7 +39,7 @@ xlog_recover_dquot_ra_pass2(
> >  	if (item->ri_buf[1].i_len < sizeof(struct xfs_disk_dquot))
> >  		return;
> >  
> > -	type = recddq->d_flags & (XFS_DQTYPE_USER | XFS_DQTYPE_PROJ | XFS_DQTYPE_GROUP);
> > +	type = recddq->d_flags & XFS_DQTYPE_REC_MASK;
> >  	ASSERT(type);
> >  	if (log->l_quotaoffs_flag & type)
> >  		return;
> > @@ -91,7 +91,7 @@ xlog_recover_dquot_commit_pass2(
> >  	/*
> >  	 * This type of quotas was turned off, so ignore this record.
> >  	 */
> > -	type = recddq->d_flags & (XFS_DQTYPE_USER | XFS_DQTYPE_PROJ | XFS_DQTYPE_GROUP);
> > +	type = recddq->d_flags & XFS_DQTYPE_REC_MASK;
> 
> Couldn't these both be converted to xfs_dquot_type(recddq)?

xfs_dquot_type takes a pointer to a incore dquot, not a struct
xfs_disk_dquot, so no.

--D

> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
Dave Chinner July 17, 2020, 1:18 a.m. UTC | #3
On Thu, Jul 16, 2020 at 06:07:15PM -0700, Darrick J. Wong wrote:
> On Fri, Jul 17, 2020 at 10:02:42AM +1000, Dave Chinner wrote:
> > On Wed, Jul 15, 2020 at 11:46:10PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <darrick.wong@oracle.com>
> > > 
> > > Fix a few places where we open-coded this mask constant.
> > > 
> > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > > ---
> > >  fs/xfs/xfs_dquot_item_recover.c |    4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > 
> > > diff --git a/fs/xfs/xfs_dquot_item_recover.c b/fs/xfs/xfs_dquot_item_recover.c
> > > index d7eb85c7d394..93178341569a 100644
> > > --- a/fs/xfs/xfs_dquot_item_recover.c
> > > +++ b/fs/xfs/xfs_dquot_item_recover.c
> > > @@ -39,7 +39,7 @@ xlog_recover_dquot_ra_pass2(
> > >  	if (item->ri_buf[1].i_len < sizeof(struct xfs_disk_dquot))
> > >  		return;
> > >  
> > > -	type = recddq->d_flags & (XFS_DQTYPE_USER | XFS_DQTYPE_PROJ | XFS_DQTYPE_GROUP);
> > > +	type = recddq->d_flags & XFS_DQTYPE_REC_MASK;
> > >  	ASSERT(type);
> > >  	if (log->l_quotaoffs_flag & type)
> > >  		return;
> > > @@ -91,7 +91,7 @@ xlog_recover_dquot_commit_pass2(
> > >  	/*
> > >  	 * This type of quotas was turned off, so ignore this record.
> > >  	 */
> > > -	type = recddq->d_flags & (XFS_DQTYPE_USER | XFS_DQTYPE_PROJ | XFS_DQTYPE_GROUP);
> > > +	type = recddq->d_flags & XFS_DQTYPE_REC_MASK;
> > 
> > Couldn't these both be converted to xfs_dquot_type(recddq)?
> 
> xfs_dquot_type takes a pointer to a incore dquot, not a struct
> xfs_disk_dquot, so no.

Ah, right, I didn't notice the recddq type mismatch there. Ok, code
is fine.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Christoph Hellwig July 21, 2020, 2:57 p.m. UTC | #4
On Wed, Jul 15, 2020 at 11:46:10PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Fix a few places where we open-coded this mask constant.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks good,

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

Patch

diff --git a/fs/xfs/xfs_dquot_item_recover.c b/fs/xfs/xfs_dquot_item_recover.c
index d7eb85c7d394..93178341569a 100644
--- a/fs/xfs/xfs_dquot_item_recover.c
+++ b/fs/xfs/xfs_dquot_item_recover.c
@@ -39,7 +39,7 @@  xlog_recover_dquot_ra_pass2(
 	if (item->ri_buf[1].i_len < sizeof(struct xfs_disk_dquot))
 		return;
 
-	type = recddq->d_flags & (XFS_DQTYPE_USER | XFS_DQTYPE_PROJ | XFS_DQTYPE_GROUP);
+	type = recddq->d_flags & XFS_DQTYPE_REC_MASK;
 	ASSERT(type);
 	if (log->l_quotaoffs_flag & type)
 		return;
@@ -91,7 +91,7 @@  xlog_recover_dquot_commit_pass2(
 	/*
 	 * This type of quotas was turned off, so ignore this record.
 	 */
-	type = recddq->d_flags & (XFS_DQTYPE_USER | XFS_DQTYPE_PROJ | XFS_DQTYPE_GROUP);
+	type = recddq->d_flags & XFS_DQTYPE_REC_MASK;
 	ASSERT(type);
 	if (log->l_quotaoffs_flag & type)
 		return 0;