Commit 329e0875 authored by Chandra Seetharaman's avatar Chandra Seetharaman Committed by Ben Myers

xfs: Replace macro XFS_DQUOT_TREE with a function

In preparation for combined pquota/gquota support, for the sake
of readability, change the macro to an inline function.
Signed-off-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
Reviewed-by: default avatarBen Myers <bpm@sgi.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 9cad19d2
...@@ -804,7 +804,7 @@ xfs_qm_dqget( ...@@ -804,7 +804,7 @@ xfs_qm_dqget(
xfs_dquot_t **O_dqpp) /* OUT : locked incore dquot */ xfs_dquot_t **O_dqpp) /* OUT : locked incore dquot */
{ {
struct xfs_quotainfo *qi = mp->m_quotainfo; 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; struct xfs_dquot *dqp;
int error; int error;
......
...@@ -70,7 +70,7 @@ xfs_qm_dquot_walk( ...@@ -70,7 +70,7 @@ xfs_qm_dquot_walk(
void *data) void *data)
{ {
struct xfs_quotainfo *qi = mp->m_quotainfo; 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; uint32_t next_index;
int last_error = 0; int last_error = 0;
int skipped; int skipped;
...@@ -189,7 +189,7 @@ xfs_qm_dqpurge( ...@@ -189,7 +189,7 @@ xfs_qm_dqpurge(
xfs_dqfunlock(dqp); xfs_dqfunlock(dqp);
xfs_dqunlock(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)); be32_to_cpu(dqp->q_core.d_id));
qi->qi_dquots--; qi->qi_dquots--;
...@@ -1471,7 +1471,7 @@ xfs_qm_dqfree_one( ...@@ -1471,7 +1471,7 @@ xfs_qm_dqfree_one(
struct xfs_quotainfo *qi = mp->m_quotainfo; struct xfs_quotainfo *qi = mp->m_quotainfo;
mutex_lock(&qi->qi_tree_lock); 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)); be32_to_cpu(dqp->q_core.d_id));
qi->qi_dquots--; qi->qi_dquots--;
......
...@@ -69,12 +69,22 @@ typedef struct xfs_quotainfo { ...@@ -69,12 +69,22 @@ typedef struct xfs_quotainfo {
struct shrinker qi_shrinker; struct shrinker qi_shrinker;
} xfs_quotainfo_t; } xfs_quotainfo_t;
#define XFS_DQUOT_TREE(qi, type) \ static inline struct radix_tree_root *
((type & XFS_DQ_USER) ? \ xfs_dquot_tree(
&((qi)->qi_uquota_tree) : \ struct xfs_quotainfo *qi,
&((qi)->qi_gquota_tree)) 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, extern int xfs_qm_calc_dquots_per_chunk(struct xfs_mount *mp,
unsigned int nbblks); unsigned int nbblks);
extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long); extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment