xfs
[Top] [All Lists]

[PATCH v10 03/11] xfs: Replace macro XFS_DQ_TO_QIP with a function

To: xfs@xxxxxxxxxxx
Subject: [PATCH v10 03/11] xfs: Replace macro XFS_DQ_TO_QIP with a function
From: Chandra Seetharaman <sekharan@xxxxxxxxxx>
Date: Thu, 27 Jun 2013 17:25:06 -0500
Cc: Chandra Seetharaman <sekharan@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1372371914-11370-1-git-send-email-sekharan@xxxxxxxxxx>
References: <1372371914-11370-1-git-send-email-sekharan@xxxxxxxxxx>
In preparation for combined pquota/gquota support, for the sake
of readability, change the macro to an inline function.

Signed-off-by: Chandra Seetharaman <sekharan@xxxxxxxxxx>
---
 fs/xfs/xfs_dquot.c |    2 +-
 fs/xfs/xfs_dquot.h |    4 ----
 fs/xfs/xfs_qm.h    |   16 ++++++++++++++++
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 09af322..7d184de 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -573,7 +573,7 @@ xfs_qm_dqtobp(
        xfs_bmbt_irec_t map;
        int             nmaps = 1, error;
        xfs_buf_t       *bp;
-       xfs_inode_t     *quotip = XFS_DQ_TO_QIP(dqp);
+       struct xfs_inode        *quotip = xfs_dq_to_quota_inode(dqp);
        xfs_mount_t     *mp = dqp->q_mount;
        xfs_dqid_t      id = be32_to_cpu(dqp->q_core.d_id);
        xfs_trans_t     *tp = (tpp ? *tpp : NULL);
diff --git a/fs/xfs/xfs_dquot.h b/fs/xfs/xfs_dquot.h
index 4f0ebfc..b596626 100644
--- a/fs/xfs/xfs_dquot.h
+++ b/fs/xfs/xfs_dquot.h
@@ -143,10 +143,6 @@ static inline xfs_dquot_t *xfs_inode_dquot(struct 
xfs_inode *ip, int type)
 #define XFS_QM_ISUDQ(dqp)      ((dqp)->dq_flags & XFS_DQ_USER)
 #define XFS_QM_ISPDQ(dqp)      ((dqp)->dq_flags & XFS_DQ_PROJ)
 #define XFS_QM_ISGDQ(dqp)      ((dqp)->dq_flags & XFS_DQ_GROUP)
-#define XFS_DQ_TO_QINF(dqp)    ((dqp)->q_mount->m_quotainfo)
-#define XFS_DQ_TO_QIP(dqp)     (XFS_QM_ISUDQ(dqp) ? \
-                                XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \
-                                XFS_DQ_TO_QINF(dqp)->qi_gquotaip)
 
 extern int             xfs_qm_dqread(struct xfs_mount *, xfs_dqid_t, uint,
                                        uint, struct xfs_dquot  **);
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
index 96568c2..051e43a 100644
--- a/fs/xfs/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
@@ -85,6 +85,22 @@ xfs_dquot_tree(
        }
        return NULL;
 }
+
+static inline struct xfs_inode *
+xfs_dq_to_quota_inode(struct xfs_dquot *dqp)
+{
+       switch (dqp->dq_flags & XFS_DQ_ALLTYPES) {
+       case XFS_DQ_USER:
+               return dqp->q_mount->m_quotainfo->qi_uquotaip;
+       case XFS_DQ_GROUP:
+       case XFS_DQ_PROJ:
+               return dqp->q_mount->m_quotainfo->qi_gquotaip;
+       default:
+               ASSERT(0);
+       }
+       return NULL;
+}
+
 extern int     xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp,
                                             unsigned int nbblks);
 extern void    xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long);
-- 
1.7.1

<Prev in Thread] Current Thread [Next in Thread>