]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
xfs: Replace macro XFS_DQUOT_TREE with a function
authorChandra Seetharaman <sekharan@us.ibm.com>
Thu, 27 Jun 2013 22:25:05 +0000 (17:25 -0500)
committerBen Myers <bpm@sgi.com>
Fri, 28 Jun 2013 18:05:07 +0000 (13:05 -0500)
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@us.ibm.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_dquot.c
fs/xfs/xfs_qm.c
fs/xfs/xfs_qm.h

index 044e97a33c8d0a155f1ea026a20881f95dd95274..09af322653a2f2dadd5e11e1b04b4071d1e8f9ba 100644 (file)
@@ -804,7 +804,7 @@ xfs_qm_dqget(
        xfs_dquot_t     **O_dqpp) /* OUT : locked incore dquot */
 {
        struct xfs_quotainfo    *qi = mp->m_quotainfo;
-       struct radix_tree_root *tree = XFS_DQUOT_TREE(qi, type);
+       struct radix_tree_root *tree = xfs_dquot_tree(qi, type);
        struct xfs_dquot        *dqp;
        int                     error;
 
index 28a5e8ae3829dfb2918edb057bf2406211f9568f..8e707d33e1064bc63600e07eeffeb550cdd85ef4 100644 (file)
@@ -70,7 +70,7 @@ xfs_qm_dquot_walk(
        void                    *data)
 {
        struct xfs_quotainfo    *qi = mp->m_quotainfo;
-       struct radix_tree_root  *tree = XFS_DQUOT_TREE(qi, type);
+       struct radix_tree_root  *tree = xfs_dquot_tree(qi, type);
        uint32_t                next_index;
        int                     last_error = 0;
        int                     skipped;
@@ -189,7 +189,7 @@ xfs_qm_dqpurge(
        xfs_dqfunlock(dqp);
        xfs_dqunlock(dqp);
 
-       radix_tree_delete(XFS_DQUOT_TREE(qi, dqp->q_core.d_flags),
+       radix_tree_delete(xfs_dquot_tree(qi, dqp->q_core.d_flags),
                          be32_to_cpu(dqp->q_core.d_id));
        qi->qi_dquots--;
 
@@ -1471,7 +1471,7 @@ xfs_qm_dqfree_one(
        struct xfs_quotainfo    *qi = mp->m_quotainfo;
 
        mutex_lock(&qi->qi_tree_lock);
-       radix_tree_delete(XFS_DQUOT_TREE(qi, dqp->q_core.d_flags),
+       radix_tree_delete(xfs_dquot_tree(qi, dqp->q_core.d_flags),
                          be32_to_cpu(dqp->q_core.d_id));
 
        qi->qi_dquots--;
index 5d16a6e6900f8756051877bac7ef18f2d666668a..96568c2706702565df721f87b95441fea102b970 100644 (file)
@@ -69,12 +69,22 @@ typedef struct xfs_quotainfo {
        struct shrinker  qi_shrinker;
 } xfs_quotainfo_t;
 
-#define XFS_DQUOT_TREE(qi, type) \
-       ((type & XFS_DQ_USER) ? \
-        &((qi)->qi_uquota_tree) : \
-        &((qi)->qi_gquota_tree))
-
-
+static inline struct radix_tree_root *
+xfs_dquot_tree(
+       struct xfs_quotainfo    *qi,
+       int                     type)
+{
+       switch (type) {
+       case XFS_DQ_USER:
+               return &qi->qi_uquota_tree;
+       case XFS_DQ_GROUP:
+       case XFS_DQ_PROJ:
+               return &qi->qi_gquota_tree;
+       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);