diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-04-20 03:01:53 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-05-19 10:58:15 -0400 |
commit | 191f8488f9f7600a96e1500ee2ee74a407e2eb1c (patch) | |
tree | 23dbc84d31563e64ff60d99a2974727ca3bf8e42 /fs/xfs/quota | |
parent | 8a7b8a89a3ae5b510396cdcc821698d4aa20afcf (diff) |
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>
Diffstat (limited to 'fs/xfs/quota')
-rw-r--r-- | fs/xfs/quota/xfs_dquot.c | 16 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 4 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_quota_priv.h | 13 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_trans_dquot.c | 23 |
4 files changed, 25 insertions, 31 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c index 9b1e8be98820..b89ec5df0129 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/quota/xfs_dquot.c | |||
@@ -956,16 +956,17 @@ xfs_qm_dqget( | |||
956 | */ | 956 | */ |
957 | if (ip) { | 957 | if (ip) { |
958 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 958 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
959 | if (! XFS_IS_DQTYPE_ON(mp, type)) { | 959 | |
960 | /* inode stays locked on return */ | ||
961 | xfs_qm_dqdestroy(dqp); | ||
962 | return XFS_ERROR(ESRCH); | ||
963 | } | ||
964 | /* | 960 | /* |
965 | * A dquot could be attached to this inode by now, since | 961 | * A dquot could be attached to this inode by now, since |
966 | * we had dropped the ilock. | 962 | * we had dropped the ilock. |
967 | */ | 963 | */ |
968 | if (type == XFS_DQ_USER) { | 964 | if (type == XFS_DQ_USER) { |
965 | if (!XFS_IS_UQUOTA_ON(mp)) { | ||
966 | /* inode stays locked on return */ | ||
967 | xfs_qm_dqdestroy(dqp); | ||
968 | return XFS_ERROR(ESRCH); | ||
969 | } | ||
969 | if (ip->i_udquot) { | 970 | if (ip->i_udquot) { |
970 | xfs_qm_dqdestroy(dqp); | 971 | xfs_qm_dqdestroy(dqp); |
971 | dqp = ip->i_udquot; | 972 | dqp = ip->i_udquot; |
@@ -973,6 +974,11 @@ xfs_qm_dqget( | |||
973 | goto dqret; | 974 | goto dqret; |
974 | } | 975 | } |
975 | } else { | 976 | } else { |
977 | if (!XFS_IS_OQUOTA_ON(mp)) { | ||
978 | /* inode stays locked on return */ | ||
979 | xfs_qm_dqdestroy(dqp); | ||
980 | return XFS_ERROR(ESRCH); | ||
981 | } | ||
976 | if (ip->i_gdquot) { | 982 | if (ip->i_gdquot) { |
977 | xfs_qm_dqdestroy(dqp); | 983 | xfs_qm_dqdestroy(dqp); |
978 | dqp = ip->i_gdquot; | 984 | dqp = ip->i_gdquot; |
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 6ef2809b3166..0abbdd721349 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -1591,8 +1591,10 @@ xfs_qm_quotacheck_dqadjust( | |||
1591 | 1591 | ||
1592 | /* | 1592 | /* |
1593 | * Set default limits, adjust timers (since we changed usages) | 1593 | * Set default limits, adjust timers (since we changed usages) |
1594 | * | ||
1595 | * There are no timers for the default values set in the root dquot. | ||
1594 | */ | 1596 | */ |
1595 | if (! XFS_IS_SUSER_DQUOT(dqp)) { | 1597 | if (dqp->q_core.d_id) { |
1596 | xfs_qm_adjust_dqlimits(dqp->q_mount, &dqp->q_core); | 1598 | xfs_qm_adjust_dqlimits(dqp->q_mount, &dqp->q_core); |
1597 | xfs_qm_adjust_dqtimers(dqp->q_mount, &dqp->q_core); | 1599 | xfs_qm_adjust_dqtimers(dqp->q_mount, &dqp->q_core); |
1598 | } | 1600 | } |
diff --git a/fs/xfs/quota/xfs_quota_priv.h b/fs/xfs/quota/xfs_quota_priv.h index f1179ffa5e93..94a3d927d716 100644 --- a/fs/xfs/quota/xfs_quota_priv.h +++ b/fs/xfs/quota/xfs_quota_priv.h | |||
@@ -24,8 +24,6 @@ | |||
24 | */ | 24 | */ |
25 | #define XFS_DQITER_MAP_SIZE 10 | 25 | #define XFS_DQITER_MAP_SIZE 10 |
26 | 26 | ||
27 | #define XFS_DQ_IS_ADDEDTO_TRX(t, d) ((d)->q_transp == (t)) | ||
28 | |||
29 | /* | 27 | /* |
30 | * Hash into a bucket in the dquot hash table, based on <mp, id>. | 28 | * Hash into a bucket in the dquot hash table, based on <mp, id>. |
31 | */ | 29 | */ |
@@ -37,9 +35,6 @@ | |||
37 | XFS_DQ_HASHVAL(mp, id)) : \ | 35 | XFS_DQ_HASHVAL(mp, id)) : \ |
38 | (xfs_Gqm->qm_grp_dqhtable + \ | 36 | (xfs_Gqm->qm_grp_dqhtable + \ |
39 | XFS_DQ_HASHVAL(mp, id))) | 37 | XFS_DQ_HASHVAL(mp, id))) |
40 | #define XFS_IS_DQTYPE_ON(mp, type) (type == XFS_DQ_USER ? \ | ||
41 | XFS_IS_UQUOTA_ON(mp) : \ | ||
42 | XFS_IS_OQUOTA_ON(mp)) | ||
43 | #define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \ | 38 | #define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \ |
44 | !dqp->q_core.d_blk_hardlimit && \ | 39 | !dqp->q_core.d_blk_hardlimit && \ |
45 | !dqp->q_core.d_blk_softlimit && \ | 40 | !dqp->q_core.d_blk_softlimit && \ |
@@ -51,14 +46,6 @@ | |||
51 | !dqp->q_core.d_rtbcount && \ | 46 | !dqp->q_core.d_rtbcount && \ |
52 | !dqp->q_core.d_icount) | 47 | !dqp->q_core.d_icount) |
53 | 48 | ||
54 | #define XFS_DQ_IS_LOGITEM_INITD(dqp) ((dqp)->q_logitem.qli_dquot == (dqp)) | ||
55 | |||
56 | #define XFS_QM_DQP_TO_DQACCT(tp, dqp) (XFS_QM_ISUDQ(dqp) ? \ | ||
57 | (tp)->t_dqinfo->dqa_usrdquots : \ | ||
58 | (tp)->t_dqinfo->dqa_grpdquots) | ||
59 | #define XFS_IS_SUSER_DQUOT(dqp) \ | ||
60 | (!((dqp)->q_core.d_id)) | ||
61 | |||
62 | #define DQFLAGTO_TYPESTR(d) (((d)->dq_flags & XFS_DQ_USER) ? "USR" : \ | 49 | #define DQFLAGTO_TYPESTR(d) (((d)->dq_flags & XFS_DQ_USER) ? "USR" : \ |
63 | (((d)->dq_flags & XFS_DQ_GROUP) ? "GRP" : \ | 50 | (((d)->dq_flags & XFS_DQ_GROUP) ? "GRP" : \ |
64 | (((d)->dq_flags & XFS_DQ_PROJ) ? "PRJ":"???"))) | 51 | (((d)->dq_flags & XFS_DQ_PROJ) ? "PRJ":"???"))) |
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c index 5ae2e32ae7b7..061d827da33c 100644 --- a/fs/xfs/quota/xfs_trans_dquot.c +++ b/fs/xfs/quota/xfs_trans_dquot.c | |||
@@ -59,12 +59,11 @@ xfs_trans_dqjoin( | |||
59 | xfs_trans_t *tp, | 59 | xfs_trans_t *tp, |
60 | xfs_dquot_t *dqp) | 60 | xfs_dquot_t *dqp) |
61 | { | 61 | { |
62 | xfs_dq_logitem_t *lp; | 62 | xfs_dq_logitem_t *lp = &dqp->q_logitem; |
63 | 63 | ||
64 | ASSERT(! XFS_DQ_IS_ADDEDTO_TRX(tp, dqp)); | 64 | ASSERT(dqp->q_transp != tp); |
65 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 65 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
66 | ASSERT(XFS_DQ_IS_LOGITEM_INITD(dqp)); | 66 | ASSERT(lp->qli_dquot == dqp); |
67 | lp = &dqp->q_logitem; | ||
68 | 67 | ||
69 | /* | 68 | /* |
70 | * Get a log_item_desc to point at the new item. | 69 | * Get a log_item_desc to point at the new item. |
@@ -96,7 +95,7 @@ xfs_trans_log_dquot( | |||
96 | { | 95 | { |
97 | xfs_log_item_desc_t *lidp; | 96 | xfs_log_item_desc_t *lidp; |
98 | 97 | ||
99 | ASSERT(XFS_DQ_IS_ADDEDTO_TRX(tp, dqp)); | 98 | ASSERT(dqp->q_transp == tp); |
100 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 99 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
101 | 100 | ||
102 | lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)(&dqp->q_logitem)); | 101 | lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)(&dqp->q_logitem)); |
@@ -198,16 +197,16 @@ xfs_trans_get_dqtrx( | |||
198 | int i; | 197 | int i; |
199 | xfs_dqtrx_t *qa; | 198 | xfs_dqtrx_t *qa; |
200 | 199 | ||
201 | for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) { | 200 | qa = XFS_QM_ISUDQ(dqp) ? |
202 | qa = XFS_QM_DQP_TO_DQACCT(tp, dqp); | 201 | tp->t_dqinfo->dqa_usrdquots : tp->t_dqinfo->dqa_grpdquots; |
203 | 202 | ||
203 | for (i = 0; i < XFS_QM_TRANS_MAXDQS; i++) { | ||
204 | if (qa[i].qt_dquot == NULL || | 204 | if (qa[i].qt_dquot == NULL || |
205 | qa[i].qt_dquot == dqp) { | 205 | qa[i].qt_dquot == dqp) |
206 | return (&qa[i]); | 206 | return &qa[i]; |
207 | } | ||
208 | } | 207 | } |
209 | 208 | ||
210 | return (NULL); | 209 | return NULL; |
211 | } | 210 | } |
212 | 211 | ||
213 | /* | 212 | /* |
@@ -381,7 +380,7 @@ xfs_trans_apply_dquot_deltas( | |||
381 | break; | 380 | break; |
382 | 381 | ||
383 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 382 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
384 | ASSERT(XFS_DQ_IS_ADDEDTO_TRX(tp, dqp)); | 383 | ASSERT(dqp->q_transp == tp); |
385 | 384 | ||
386 | /* | 385 | /* |
387 | * adjust the actual number of blocks used | 386 | * adjust the actual number of blocks used |