xfs: remove a few macro indirections in the quota code
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
8a7b8a89a3
commit
191f8488f9
4 changed files with 25 additions and 31 deletions
|
@ -956,16 +956,17 @@ xfs_qm_dqget(
|
|||
*/
|
||||
if (ip) {
|
||||
xfs_ilock(ip, XFS_ILOCK_EXCL);
|
||||
if (! XFS_IS_DQTYPE_ON(mp, type)) {
|
||||
/* inode stays locked on return */
|
||||
xfs_qm_dqdestroy(dqp);
|
||||
return XFS_ERROR(ESRCH);
|
||||
}
|
||||
|
||||
/*
|
||||
* A dquot could be attached to this inode by now, since
|
||||
* we had dropped the ilock.
|
||||
*/
|
||||
if (type == XFS_DQ_USER) {
|
||||
if (!XFS_IS_UQUOTA_ON(mp)) {
|
||||
/* inode stays locked on return */
|
||||
xfs_qm_dqdestroy(dqp);
|
||||
return XFS_ERROR(ESRCH);
|
||||
}
|
||||
if (ip->i_udquot) {
|
||||
xfs_qm_dqdestroy(dqp);
|
||||
dqp = ip->i_udquot;
|
||||
|
@ -973,6 +974,11 @@ xfs_qm_dqget(
|
|||
goto dqret;
|
||||
}
|
||||
} else {
|
||||
if (!XFS_IS_OQUOTA_ON(mp)) {
|
||||
/* inode stays locked on return */
|
||||
xfs_qm_dqdestroy(dqp);
|
||||
return XFS_ERROR(ESRCH);
|
||||
}
|
||||
if (ip->i_gdquot) {
|
||||
xfs_qm_dqdestroy(dqp);
|
||||
dqp = ip->i_gdquot;
|
||||
|
|
|
@ -1591,8 +1591,10 @@ xfs_qm_quotacheck_dqadjust(
|
|||
|
||||
/*
|
||||
* Set default limits, adjust timers (since we changed usages)
|
||||
*
|
||||
* There are no timers for the default values set in the root dquot.
|
||||
*/
|
||||
if (! XFS_IS_SUSER_DQUOT(dqp)) {
|
||||
if (dqp->q_core.d_id) {
|
||||
xfs_qm_adjust_dqlimits(dqp->q_mount, &dqp->q_core);
|
||||
xfs_qm_adjust_dqtimers(dqp->q_mount, &dqp->q_core);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
*/
|
||||
#define XFS_DQITER_MAP_SIZE 10
|
||||
|
||||
#define XFS_DQ_IS_ADDEDTO_TRX(t, d) ((d)->q_transp == (t))
|
||||
|
||||
/*
|
||||
* Hash into a bucket in the dquot hash table, based on <mp, id>.
|
||||
*/
|
||||
|
@ -37,9 +35,6 @@
|
|||
XFS_DQ_HASHVAL(mp, id)) : \
|
||||
(xfs_Gqm->qm_grp_dqhtable + \
|
||||
XFS_DQ_HASHVAL(mp, id)))
|
||||
#define XFS_IS_DQTYPE_ON(mp, type) (type == XFS_DQ_USER ? \
|
||||
XFS_IS_UQUOTA_ON(mp) : \
|
||||
XFS_IS_OQUOTA_ON(mp))
|
||||
#define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \
|
||||
!dqp->q_core.d_blk_hardlimit && \
|
||||
!dqp->q_core.d_blk_softlimit && \
|
||||
|
@ -51,14 +46,6 @@
|
|||
!dqp->q_core.d_rtbcount && \
|
||||
!dqp->q_core.d_icount)
|
||||
|
||||
#define XFS_DQ_IS_LOGITEM_INITD(dqp) ((dqp)->q_logitem.qli_dquot == (dqp))
|
||||
|
||||
#define XFS_QM_DQP_TO_DQACCT(tp, dqp) (XFS_QM_ISUDQ(dqp) ? \
|
||||
(tp)->t_dqinfo->dqa_usrdquots : \
|
||||
(tp)->t_dqinfo->dqa_grpdquots)
|
||||
#define XFS_IS_SUSER_DQUOT(dqp) \
|
||||
(!((dqp)->q_core.d_id))
|
||||
|
||||
#define DQFLAGTO_TYPESTR(d) (((d)->dq_flags & XFS_DQ_USER) ? "USR" : \
|
||||
(((d)->dq_flags & XFS_DQ_GROUP) ? "GRP" : \
|
||||
(((d)->dq_flags & XFS_DQ_PROJ) ? "PRJ":"???")))
|
||||
|
|
|
@ -59,12 +59,11 @@ xfs_trans_dqjoin(
|
|||
xfs_trans_t *tp,
|
||||
xfs_dquot_t *dqp)
|
||||
{
|
||||
xfs_dq_logitem_t *lp;
|
||||
xfs_dq_logitem_t *lp = &dqp->q_logitem;
|
||||
|
||||
ASSERT(! XFS_DQ_IS_ADDEDTO_TRX(tp, dqp));
|
||||
ASSERT(dqp->q_transp != tp);
|
||||
ASSERT(XFS_DQ_IS_LOCKED(dqp));
|
||||
ASSERT(XFS_DQ_IS_LOGITEM_INITD(dqp));
|
||||
lp = &dqp->q_logitem;
|
||||
ASSERT(lp->qli_dquot == dqp);
|
||||
|
||||
/*
|
||||
* Get a log_item_desc to point at the new item.
|
||||
|
@ -96,7 +95,7 @@ xfs_trans_log_dquot(
|
|||
{
|
||||
xfs_log_item_desc_t *lidp;
|
||||
|
||||
ASSERT(XFS_DQ_IS_ADDEDTO_TRX(tp, dqp));
|
||||
ASSERT(dqp->q_transp == tp);
|
||||
ASSERT(XFS_DQ_IS_LOCKED(dqp));
|
||||
|
||||
lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)(&dqp->q_logitem));
|
||||
|
@ -198,16 +197,16 @@ xfs_trans_get_dqtrx(
|
|||
int i;
|
||||
xfs_dqtrx_t *qa;
|
||||
|
||||
for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
|
||||
qa = XFS_QM_DQP_TO_DQACCT(tp, dqp);
|
||||
qa = XFS_QM_ISUDQ(dqp) ?
|
||||
tp->t_dqinfo->dqa_usrdquots : tp->t_dqinfo->dqa_grpdquots;
|
||||
|
||||
for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) {
|
||||
if (qa[i].qt_dquot == NULL ||
|
||||
qa[i].qt_dquot == dqp) {
|
||||
return (&qa[i]);
|
||||
}
|
||||
qa[i].qt_dquot == dqp)
|
||||
return &qa[i];
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -381,7 +380,7 @@ xfs_trans_apply_dquot_deltas(
|
|||
break;
|
||||
|
||||
ASSERT(XFS_DQ_IS_LOCKED(dqp));
|
||||
ASSERT(XFS_DQ_IS_ADDEDTO_TRX(tp, dqp));
|
||||
ASSERT(dqp->q_transp == tp);
|
||||
|
||||
/*
|
||||
* adjust the actual number of blocks used
|
||||
|
|
Loading…
Reference in a new issue