diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/xfs/quota/xfs_quota_priv.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'fs/xfs/quota/xfs_quota_priv.h')
-rw-r--r-- | fs/xfs/quota/xfs_quota_priv.h | 192 |
1 files changed, 192 insertions, 0 deletions
diff --git a/fs/xfs/quota/xfs_quota_priv.h b/fs/xfs/quota/xfs_quota_priv.h new file mode 100644 index 000000000000..414b6004af21 --- /dev/null +++ b/fs/xfs/quota/xfs_quota_priv.h | |||
@@ -0,0 +1,192 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of version 2 of the GNU General Public License as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it would be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
11 | * | ||
12 | * Further, this software is distributed without any warranty that it is | ||
13 | * free of the rightful claim of any third person regarding infringement | ||
14 | * or the like. Any license provided herein, whether implied or | ||
15 | * otherwise, applies only to this software file. Patent licenses, if | ||
16 | * any, provided herein do not apply to combinations of this program with | ||
17 | * other software, or any other product whatsoever. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write the Free Software Foundation, Inc., 59 | ||
21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
22 | * | ||
23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, | ||
24 | * Mountain View, CA 94043, or: | ||
25 | * | ||
26 | * http://www.sgi.com | ||
27 | * | ||
28 | * For further information regarding this notice, see: | ||
29 | * | ||
30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ | ||
31 | */ | ||
32 | #ifndef __XFS_QUOTA_PRIV_H__ | ||
33 | #define __XFS_QUOTA_PRIV_H__ | ||
34 | |||
35 | /* | ||
36 | * Number of bmaps that we ask from bmapi when doing a quotacheck. | ||
37 | * We make this restriction to keep the memory usage to a minimum. | ||
38 | */ | ||
39 | #define XFS_DQITER_MAP_SIZE 10 | ||
40 | |||
41 | /* Number of dquots that fit in to a dquot block */ | ||
42 | #define XFS_QM_DQPERBLK(mp) ((mp)->m_quotainfo->qi_dqperchunk) | ||
43 | |||
44 | #define XFS_ISLOCKED_INODE(ip) (ismrlocked(&(ip)->i_lock, \ | ||
45 | MR_UPDATE | MR_ACCESS) != 0) | ||
46 | #define XFS_ISLOCKED_INODE_EXCL(ip) (ismrlocked(&(ip)->i_lock, \ | ||
47 | MR_UPDATE) != 0) | ||
48 | |||
49 | #define XFS_DQ_IS_ADDEDTO_TRX(t, d) ((d)->q_transp == (t)) | ||
50 | |||
51 | #define XFS_QI_MPLRECLAIMS(mp) ((mp)->m_quotainfo->qi_dqreclaims) | ||
52 | #define XFS_QI_UQIP(mp) ((mp)->m_quotainfo->qi_uquotaip) | ||
53 | #define XFS_QI_GQIP(mp) ((mp)->m_quotainfo->qi_gquotaip) | ||
54 | #define XFS_QI_DQCHUNKLEN(mp) ((mp)->m_quotainfo->qi_dqchunklen) | ||
55 | #define XFS_QI_BTIMELIMIT(mp) ((mp)->m_quotainfo->qi_btimelimit) | ||
56 | #define XFS_QI_RTBTIMELIMIT(mp) ((mp)->m_quotainfo->qi_rtbtimelimit) | ||
57 | #define XFS_QI_ITIMELIMIT(mp) ((mp)->m_quotainfo->qi_itimelimit) | ||
58 | #define XFS_QI_BWARNLIMIT(mp) ((mp)->m_quotainfo->qi_bwarnlimit) | ||
59 | #define XFS_QI_IWARNLIMIT(mp) ((mp)->m_quotainfo->qi_iwarnlimit) | ||
60 | #define XFS_QI_QOFFLOCK(mp) ((mp)->m_quotainfo->qi_quotaofflock) | ||
61 | |||
62 | #define XFS_QI_MPL_LIST(mp) ((mp)->m_quotainfo->qi_dqlist) | ||
63 | #define XFS_QI_MPLLOCK(mp) ((mp)->m_quotainfo->qi_dqlist.qh_lock) | ||
64 | #define XFS_QI_MPLNEXT(mp) ((mp)->m_quotainfo->qi_dqlist.qh_next) | ||
65 | #define XFS_QI_MPLNDQUOTS(mp) ((mp)->m_quotainfo->qi_dqlist.qh_nelems) | ||
66 | |||
67 | #define XQMLCK(h) (mutex_lock(&((h)->qh_lock), PINOD)) | ||
68 | #define XQMUNLCK(h) (mutex_unlock(&((h)->qh_lock))) | ||
69 | #ifdef DEBUG | ||
70 | struct xfs_dqhash; | ||
71 | static inline int XQMISLCKD(struct xfs_dqhash *h) | ||
72 | { | ||
73 | if (mutex_trylock(&h->qh_lock)) { | ||
74 | mutex_unlock(&h->qh_lock); | ||
75 | return 0; | ||
76 | } | ||
77 | return 1; | ||
78 | } | ||
79 | #endif | ||
80 | |||
81 | #define XFS_DQ_HASH_LOCK(h) XQMLCK(h) | ||
82 | #define XFS_DQ_HASH_UNLOCK(h) XQMUNLCK(h) | ||
83 | #define XFS_DQ_IS_HASH_LOCKED(h) XQMISLCKD(h) | ||
84 | |||
85 | #define xfs_qm_mplist_lock(mp) XQMLCK(&(XFS_QI_MPL_LIST(mp))) | ||
86 | #define xfs_qm_mplist_unlock(mp) XQMUNLCK(&(XFS_QI_MPL_LIST(mp))) | ||
87 | #define XFS_QM_IS_MPLIST_LOCKED(mp) XQMISLCKD(&(XFS_QI_MPL_LIST(mp))) | ||
88 | |||
89 | #define xfs_qm_freelist_lock(qm) XQMLCK(&((qm)->qm_dqfreelist)) | ||
90 | #define xfs_qm_freelist_unlock(qm) XQMUNLCK(&((qm)->qm_dqfreelist)) | ||
91 | #define XFS_QM_IS_FREELIST_LOCKED(qm) XQMISLCKD(&((qm)->qm_dqfreelist)) | ||
92 | |||
93 | /* | ||
94 | * Hash into a bucket in the dquot hash table, based on <mp, id>. | ||
95 | */ | ||
96 | #define XFS_DQ_HASHVAL(mp, id) (((__psunsigned_t)(mp) + \ | ||
97 | (__psunsigned_t)(id)) & \ | ||
98 | (xfs_Gqm->qm_dqhashmask - 1)) | ||
99 | #define XFS_DQ_HASH(mp, id, type) (type == XFS_DQ_USER ? \ | ||
100 | (xfs_Gqm->qm_usr_dqhtable + \ | ||
101 | XFS_DQ_HASHVAL(mp, id)) : \ | ||
102 | (xfs_Gqm->qm_grp_dqhtable + \ | ||
103 | XFS_DQ_HASHVAL(mp, id))) | ||
104 | #define XFS_IS_DQTYPE_ON(mp, type) (type == XFS_DQ_USER ? \ | ||
105 | XFS_IS_UQUOTA_ON(mp):XFS_IS_GQUOTA_ON(mp)) | ||
106 | #define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \ | ||
107 | !dqp->q_core.d_blk_hardlimit && \ | ||
108 | !dqp->q_core.d_blk_softlimit && \ | ||
109 | !dqp->q_core.d_rtb_hardlimit && \ | ||
110 | !dqp->q_core.d_rtb_softlimit && \ | ||
111 | !dqp->q_core.d_ino_hardlimit && \ | ||
112 | !dqp->q_core.d_ino_softlimit && \ | ||
113 | !dqp->q_core.d_bcount && \ | ||
114 | !dqp->q_core.d_rtbcount && \ | ||
115 | !dqp->q_core.d_icount) | ||
116 | |||
117 | #define HL_PREVP dq_hashlist.ql_prevp | ||
118 | #define HL_NEXT dq_hashlist.ql_next | ||
119 | #define MPL_PREVP dq_mplist.ql_prevp | ||
120 | #define MPL_NEXT dq_mplist.ql_next | ||
121 | |||
122 | |||
123 | #define _LIST_REMOVE(h, dqp, PVP, NXT) \ | ||
124 | { \ | ||
125 | xfs_dquot_t *d; \ | ||
126 | if (((d) = (dqp)->NXT)) \ | ||
127 | (d)->PVP = (dqp)->PVP; \ | ||
128 | *((dqp)->PVP) = d; \ | ||
129 | (dqp)->NXT = NULL; \ | ||
130 | (dqp)->PVP = NULL; \ | ||
131 | (h)->qh_version++; \ | ||
132 | (h)->qh_nelems--; \ | ||
133 | } | ||
134 | |||
135 | #define _LIST_INSERT(h, dqp, PVP, NXT) \ | ||
136 | { \ | ||
137 | xfs_dquot_t *d; \ | ||
138 | if (((d) = (h)->qh_next)) \ | ||
139 | (d)->PVP = &((dqp)->NXT); \ | ||
140 | (dqp)->NXT = d; \ | ||
141 | (dqp)->PVP = &((h)->qh_next); \ | ||
142 | (h)->qh_next = dqp; \ | ||
143 | (h)->qh_version++; \ | ||
144 | (h)->qh_nelems++; \ | ||
145 | } | ||
146 | |||
147 | #define FOREACH_DQUOT_IN_MP(dqp, mp) \ | ||
148 | for ((dqp) = XFS_QI_MPLNEXT(mp); (dqp) != NULL; (dqp) = (dqp)->MPL_NEXT) | ||
149 | |||
150 | #define FOREACH_DQUOT_IN_FREELIST(dqp, qlist) \ | ||
151 | for ((dqp) = (qlist)->qh_next; (dqp) != (xfs_dquot_t *)(qlist); \ | ||
152 | (dqp) = (dqp)->dq_flnext) | ||
153 | |||
154 | #define XQM_HASHLIST_INSERT(h, dqp) \ | ||
155 | _LIST_INSERT(h, dqp, HL_PREVP, HL_NEXT) | ||
156 | |||
157 | #define XQM_FREELIST_INSERT(h, dqp) \ | ||
158 | xfs_qm_freelist_append(h, dqp) | ||
159 | |||
160 | #define XQM_MPLIST_INSERT(h, dqp) \ | ||
161 | _LIST_INSERT(h, dqp, MPL_PREVP, MPL_NEXT) | ||
162 | |||
163 | #define XQM_HASHLIST_REMOVE(h, dqp) \ | ||
164 | _LIST_REMOVE(h, dqp, HL_PREVP, HL_NEXT) | ||
165 | #define XQM_FREELIST_REMOVE(dqp) \ | ||
166 | xfs_qm_freelist_unlink(dqp) | ||
167 | #define XQM_MPLIST_REMOVE(h, dqp) \ | ||
168 | { _LIST_REMOVE(h, dqp, MPL_PREVP, MPL_NEXT); \ | ||
169 | XFS_QI_MPLRECLAIMS((dqp)->q_mount)++; } | ||
170 | |||
171 | #define XFS_DQ_IS_LOGITEM_INITD(dqp) ((dqp)->q_logitem.qli_dquot == (dqp)) | ||
172 | |||
173 | #define XFS_QM_DQP_TO_DQACCT(tp, dqp) (XFS_QM_ISUDQ(dqp) ? \ | ||
174 | (tp)->t_dqinfo->dqa_usrdquots : \ | ||
175 | (tp)->t_dqinfo->dqa_grpdquots) | ||
176 | #define XFS_IS_SUSER_DQUOT(dqp) \ | ||
177 | (!((dqp)->q_core.d_id)) | ||
178 | |||
179 | #define XFS_PURGE_INODE(ip) \ | ||
180 | { \ | ||
181 | vmap_t dqvmap; \ | ||
182 | vnode_t *dqvp; \ | ||
183 | dqvp = XFS_ITOV(ip); \ | ||
184 | VMAP(dqvp, dqvmap); \ | ||
185 | VN_RELE(dqvp); \ | ||
186 | } | ||
187 | |||
188 | #define DQFLAGTO_TYPESTR(d) (((d)->dq_flags & XFS_DQ_USER) ? "USR" : \ | ||
189 | (((d)->dq_flags & XFS_DQ_GROUP) ? "GRP" : "???")) | ||
190 | #define DQFLAGTO_DIRTYSTR(d) (XFS_DQ_IS_DIRTY(d) ? "DIRTY" : "NOTDIRTY") | ||
191 | |||
192 | #endif /* __XFS_QUOTA_PRIV_H__ */ | ||