Re: [PATCH 06/11] xfs: always use xfs_dquot_type when extracting type from a dquot

Dave Chinner
2020-07-16T23:57:21Z

On Wed, Jul 15, 2020 at 11:45:57PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Always use the xfs_dquot_type helper to extract the quota type from an
> incore dquot. This moves responsibility for filtering internal state
> information and whatnot to anybody passing around a dquot.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_dquot.c | 15 ++++++++-------
> fs/xfs/xfs_dquot.h | 2 +-
> 2 files changed, 9 insertions(+), 8 deletions(-)
>

looks ok, minor nit below

Reviewed-by: Dave Chinner <dchinner@redhat.com>

> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index ce946d53bb61..b46a9e63b286 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -273,14 +273,15 @@ xfs_dquot_disk_alloc(
> struct xfs_trans *tp = *tpp;
> struct xfs_mount *mp = tp->t_mountp;
> struct xfs_buf *bp;
> - struct xfs_inode *quotip = xfs_quota_inode(mp, dqp->dq_flags);
> + uint qtype = xfs_dquot_type(dqp);
> + struct xfs_inode *quotip = xfs_quota_inode(mp, qtype);
> int nmaps = 1;
> int error;
>
> trace_xfs_dqalloc(dqp);
>
> xfs_ilock(quotip, XFS_ILOCK_EXCL);
> - if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) {
> + if (!xfs_this_quota_on(dqp->q_mount, qtype)) {
> /*
> * Return if this type of quotas is turned off while we didn't
> * have an inode lock
> @@ -317,8 +318,7 @@ xfs_dquot_disk_alloc(
> * Make a chunk of dquots out of this buffer and log
> * the entire thing.
> */
> - xfs_qm_init_dquot_blk(tp, mp, dqp->q_id,
> - dqp->dq_flags & XFS_DQTYPE_REC_MASK, bp);
> + xfs_qm_init_dquot_blk(tp, mp, dqp->q_id, xfs_dquot_type(dqp), bp);

This should use 'qtype' rather than call xfs_dquot_type() again.

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com