Commit df6771bde14551eceeacf331666a92735e0773ac

Authored by Christoph Hellwig
Committed by Niv Sardi
1 parent 63ad2a5c4c

kill dead quota flags

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Niv Sardi <xaiki@sgi.com>

Showing 1 changed file with 3 additions and 5 deletions Inline Diff

1 /* 1 /*
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved. 3 * All Rights Reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * This program is distributed in the hope that it would be useful, 9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation, 15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18 #ifndef __XFS_QUOTA_H__ 18 #ifndef __XFS_QUOTA_H__
19 #define __XFS_QUOTA_H__ 19 #define __XFS_QUOTA_H__
20 20
21 /* 21 /*
22 * The ondisk form of a dquot structure. 22 * The ondisk form of a dquot structure.
23 */ 23 */
24 #define XFS_DQUOT_MAGIC 0x4451 /* 'DQ' */ 24 #define XFS_DQUOT_MAGIC 0x4451 /* 'DQ' */
25 #define XFS_DQUOT_VERSION (u_int8_t)0x01 /* latest version number */ 25 #define XFS_DQUOT_VERSION (u_int8_t)0x01 /* latest version number */
26 26
27 /* 27 /*
28 * uid_t and gid_t are hard-coded to 32 bits in the inode. 28 * uid_t and gid_t are hard-coded to 32 bits in the inode.
29 * Hence, an 'id' in a dquot is 32 bits.. 29 * Hence, an 'id' in a dquot is 32 bits..
30 */ 30 */
31 typedef __uint32_t xfs_dqid_t; 31 typedef __uint32_t xfs_dqid_t;
32 32
33 /* 33 /*
34 * Even though users may not have quota limits occupying all 64-bits, 34 * Even though users may not have quota limits occupying all 64-bits,
35 * they may need 64-bit accounting. Hence, 64-bit quota-counters, 35 * they may need 64-bit accounting. Hence, 64-bit quota-counters,
36 * and quota-limits. This is a waste in the common case, but hey ... 36 * and quota-limits. This is a waste in the common case, but hey ...
37 */ 37 */
38 typedef __uint64_t xfs_qcnt_t; 38 typedef __uint64_t xfs_qcnt_t;
39 typedef __uint16_t xfs_qwarncnt_t; 39 typedef __uint16_t xfs_qwarncnt_t;
40 40
41 /* 41 /*
42 * This is the main portion of the on-disk representation of quota 42 * This is the main portion of the on-disk representation of quota
43 * information for a user. This is the q_core of the xfs_dquot_t that 43 * information for a user. This is the q_core of the xfs_dquot_t that
44 * is kept in kernel memory. We pad this with some more expansion room 44 * is kept in kernel memory. We pad this with some more expansion room
45 * to construct the on disk structure. 45 * to construct the on disk structure.
46 */ 46 */
47 typedef struct xfs_disk_dquot { 47 typedef struct xfs_disk_dquot {
48 __be16 d_magic; /* dquot magic = XFS_DQUOT_MAGIC */ 48 __be16 d_magic; /* dquot magic = XFS_DQUOT_MAGIC */
49 __u8 d_version; /* dquot version */ 49 __u8 d_version; /* dquot version */
50 __u8 d_flags; /* XFS_DQ_USER/PROJ/GROUP */ 50 __u8 d_flags; /* XFS_DQ_USER/PROJ/GROUP */
51 __be32 d_id; /* user,project,group id */ 51 __be32 d_id; /* user,project,group id */
52 __be64 d_blk_hardlimit;/* absolute limit on disk blks */ 52 __be64 d_blk_hardlimit;/* absolute limit on disk blks */
53 __be64 d_blk_softlimit;/* preferred limit on disk blks */ 53 __be64 d_blk_softlimit;/* preferred limit on disk blks */
54 __be64 d_ino_hardlimit;/* maximum # allocated inodes */ 54 __be64 d_ino_hardlimit;/* maximum # allocated inodes */
55 __be64 d_ino_softlimit;/* preferred inode limit */ 55 __be64 d_ino_softlimit;/* preferred inode limit */
56 __be64 d_bcount; /* disk blocks owned by the user */ 56 __be64 d_bcount; /* disk blocks owned by the user */
57 __be64 d_icount; /* inodes owned by the user */ 57 __be64 d_icount; /* inodes owned by the user */
58 __be32 d_itimer; /* zero if within inode limits if not, 58 __be32 d_itimer; /* zero if within inode limits if not,
59 this is when we refuse service */ 59 this is when we refuse service */
60 __be32 d_btimer; /* similar to above; for disk blocks */ 60 __be32 d_btimer; /* similar to above; for disk blocks */
61 __be16 d_iwarns; /* warnings issued wrt num inodes */ 61 __be16 d_iwarns; /* warnings issued wrt num inodes */
62 __be16 d_bwarns; /* warnings issued wrt disk blocks */ 62 __be16 d_bwarns; /* warnings issued wrt disk blocks */
63 __be32 d_pad0; /* 64 bit align */ 63 __be32 d_pad0; /* 64 bit align */
64 __be64 d_rtb_hardlimit;/* absolute limit on realtime blks */ 64 __be64 d_rtb_hardlimit;/* absolute limit on realtime blks */
65 __be64 d_rtb_softlimit;/* preferred limit on RT disk blks */ 65 __be64 d_rtb_softlimit;/* preferred limit on RT disk blks */
66 __be64 d_rtbcount; /* realtime blocks owned */ 66 __be64 d_rtbcount; /* realtime blocks owned */
67 __be32 d_rtbtimer; /* similar to above; for RT disk blocks */ 67 __be32 d_rtbtimer; /* similar to above; for RT disk blocks */
68 __be16 d_rtbwarns; /* warnings issued wrt RT disk blocks */ 68 __be16 d_rtbwarns; /* warnings issued wrt RT disk blocks */
69 __be16 d_pad; 69 __be16 d_pad;
70 } xfs_disk_dquot_t; 70 } xfs_disk_dquot_t;
71 71
72 /* 72 /*
73 * This is what goes on disk. This is separated from the xfs_disk_dquot because 73 * This is what goes on disk. This is separated from the xfs_disk_dquot because
74 * carrying the unnecessary padding would be a waste of memory. 74 * carrying the unnecessary padding would be a waste of memory.
75 */ 75 */
76 typedef struct xfs_dqblk { 76 typedef struct xfs_dqblk {
77 xfs_disk_dquot_t dd_diskdq; /* portion that lives incore as well */ 77 xfs_disk_dquot_t dd_diskdq; /* portion that lives incore as well */
78 char dd_fill[32]; /* filling for posterity */ 78 char dd_fill[32]; /* filling for posterity */
79 } xfs_dqblk_t; 79 } xfs_dqblk_t;
80 80
81 /* 81 /*
82 * flags for q_flags field in the dquot. 82 * flags for q_flags field in the dquot.
83 */ 83 */
84 #define XFS_DQ_USER 0x0001 /* a user quota */ 84 #define XFS_DQ_USER 0x0001 /* a user quota */
85 #define XFS_DQ_PROJ 0x0002 /* project quota */ 85 #define XFS_DQ_PROJ 0x0002 /* project quota */
86 #define XFS_DQ_GROUP 0x0004 /* a group quota */ 86 #define XFS_DQ_GROUP 0x0004 /* a group quota */
87 #define XFS_DQ_FLOCKED 0x0008 /* flush lock taken */ 87 #define XFS_DQ_DIRTY 0x0008 /* dquot is dirty */
88 #define XFS_DQ_DIRTY 0x0010 /* dquot is dirty */ 88 #define XFS_DQ_WANT 0x0010 /* for lookup/reclaim race */
89 #define XFS_DQ_WANT 0x0020 /* for lookup/reclaim race */ 89 #define XFS_DQ_INACTIVE 0x0020 /* dq off mplist & hashlist */
90 #define XFS_DQ_INACTIVE 0x0040 /* dq off mplist & hashlist */
91 #define XFS_DQ_MARKER 0x0080 /* sentinel */
92 90
93 #define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP) 91 #define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP)
94 92
95 /* 93 /*
96 * In the worst case, when both user and group quotas are on, 94 * In the worst case, when both user and group quotas are on,
97 * we can have a max of three dquots changing in a single transaction. 95 * we can have a max of three dquots changing in a single transaction.
98 */ 96 */
99 #define XFS_DQUOT_LOGRES(mp) (sizeof(xfs_disk_dquot_t) * 3) 97 #define XFS_DQUOT_LOGRES(mp) (sizeof(xfs_disk_dquot_t) * 3)
100 98
101 99
102 /* 100 /*
103 * These are the structures used to lay out dquots and quotaoff 101 * These are the structures used to lay out dquots and quotaoff
104 * records on the log. Quite similar to those of inodes. 102 * records on the log. Quite similar to those of inodes.
105 */ 103 */
106 104
107 /* 105 /*
108 * log format struct for dquots. 106 * log format struct for dquots.
109 * The first two fields must be the type and size fitting into 107 * The first two fields must be the type and size fitting into
110 * 32 bits : log_recovery code assumes that. 108 * 32 bits : log_recovery code assumes that.
111 */ 109 */
112 typedef struct xfs_dq_logformat { 110 typedef struct xfs_dq_logformat {
113 __uint16_t qlf_type; /* dquot log item type */ 111 __uint16_t qlf_type; /* dquot log item type */
114 __uint16_t qlf_size; /* size of this item */ 112 __uint16_t qlf_size; /* size of this item */
115 xfs_dqid_t qlf_id; /* usr/grp/proj id : 32 bits */ 113 xfs_dqid_t qlf_id; /* usr/grp/proj id : 32 bits */
116 __int64_t qlf_blkno; /* blkno of dquot buffer */ 114 __int64_t qlf_blkno; /* blkno of dquot buffer */
117 __int32_t qlf_len; /* len of dquot buffer */ 115 __int32_t qlf_len; /* len of dquot buffer */
118 __uint32_t qlf_boffset; /* off of dquot in buffer */ 116 __uint32_t qlf_boffset; /* off of dquot in buffer */
119 } xfs_dq_logformat_t; 117 } xfs_dq_logformat_t;
120 118
121 /* 119 /*
122 * log format struct for QUOTAOFF records. 120 * log format struct for QUOTAOFF records.
123 * The first two fields must be the type and size fitting into 121 * The first two fields must be the type and size fitting into
124 * 32 bits : log_recovery code assumes that. 122 * 32 bits : log_recovery code assumes that.
125 * We write two LI_QUOTAOFF logitems per quotaoff, the last one keeps a pointer 123 * We write two LI_QUOTAOFF logitems per quotaoff, the last one keeps a pointer
126 * to the first and ensures that the first logitem is taken out of the AIL 124 * to the first and ensures that the first logitem is taken out of the AIL
127 * only when the last one is securely committed. 125 * only when the last one is securely committed.
128 */ 126 */
129 typedef struct xfs_qoff_logformat { 127 typedef struct xfs_qoff_logformat {
130 unsigned short qf_type; /* quotaoff log item type */ 128 unsigned short qf_type; /* quotaoff log item type */
131 unsigned short qf_size; /* size of this item */ 129 unsigned short qf_size; /* size of this item */
132 unsigned int qf_flags; /* USR and/or GRP */ 130 unsigned int qf_flags; /* USR and/or GRP */
133 char qf_pad[12]; /* padding for future */ 131 char qf_pad[12]; /* padding for future */
134 } xfs_qoff_logformat_t; 132 } xfs_qoff_logformat_t;
135 133
136 134
137 /* 135 /*
138 * Disk quotas status in m_qflags, and also sb_qflags. 16 bits. 136 * Disk quotas status in m_qflags, and also sb_qflags. 16 bits.
139 */ 137 */
140 #define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */ 138 #define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */
141 #define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */ 139 #define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */
142 #define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */ 140 #define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */
143 #define XFS_PQUOTA_ACCT 0x0008 /* project quota accounting ON */ 141 #define XFS_PQUOTA_ACCT 0x0008 /* project quota accounting ON */
144 #define XFS_OQUOTA_ENFD 0x0010 /* other (grp/prj) quota limits enforced */ 142 #define XFS_OQUOTA_ENFD 0x0010 /* other (grp/prj) quota limits enforced */
145 #define XFS_OQUOTA_CHKD 0x0020 /* quotacheck run on other (grp/prj) quotas */ 143 #define XFS_OQUOTA_CHKD 0x0020 /* quotacheck run on other (grp/prj) quotas */
146 #define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */ 144 #define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */
147 145
148 /* 146 /*
149 * Quota Accounting/Enforcement flags 147 * Quota Accounting/Enforcement flags
150 */ 148 */
151 #define XFS_ALL_QUOTA_ACCT \ 149 #define XFS_ALL_QUOTA_ACCT \
152 (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT) 150 (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT)
153 #define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD) 151 #define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD)
154 #define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD) 152 #define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD)
155 153
156 #define XFS_IS_QUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT) 154 #define XFS_IS_QUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT)
157 #define XFS_IS_UQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT) 155 #define XFS_IS_UQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT)
158 #define XFS_IS_PQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT) 156 #define XFS_IS_PQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT)
159 #define XFS_IS_GQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT) 157 #define XFS_IS_GQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT)
160 #define XFS_IS_UQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_UQUOTA_ENFD) 158 #define XFS_IS_UQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_UQUOTA_ENFD)
161 #define XFS_IS_OQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_OQUOTA_ENFD) 159 #define XFS_IS_OQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_OQUOTA_ENFD)
162 160
163 /* 161 /*
164 * Incore only flags for quotaoff - these bits get cleared when quota(s) 162 * Incore only flags for quotaoff - these bits get cleared when quota(s)
165 * are in the process of getting turned off. These flags are in m_qflags but 163 * are in the process of getting turned off. These flags are in m_qflags but
166 * never in sb_qflags. 164 * never in sb_qflags.
167 */ 165 */
168 #define XFS_UQUOTA_ACTIVE 0x0100 /* uquotas are being turned off */ 166 #define XFS_UQUOTA_ACTIVE 0x0100 /* uquotas are being turned off */
169 #define XFS_PQUOTA_ACTIVE 0x0200 /* pquotas are being turned off */ 167 #define XFS_PQUOTA_ACTIVE 0x0200 /* pquotas are being turned off */
170 #define XFS_GQUOTA_ACTIVE 0x0400 /* gquotas are being turned off */ 168 #define XFS_GQUOTA_ACTIVE 0x0400 /* gquotas are being turned off */
171 169
172 /* 170 /*
173 * Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees 171 * Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees
174 * quota will be not be switched off as long as that inode lock is held. 172 * quota will be not be switched off as long as that inode lock is held.
175 */ 173 */
176 #define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \ 174 #define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \
177 XFS_GQUOTA_ACTIVE | \ 175 XFS_GQUOTA_ACTIVE | \
178 XFS_PQUOTA_ACTIVE)) 176 XFS_PQUOTA_ACTIVE))
179 #define XFS_IS_OQUOTA_ON(mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \ 177 #define XFS_IS_OQUOTA_ON(mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \
180 XFS_PQUOTA_ACTIVE)) 178 XFS_PQUOTA_ACTIVE))
181 #define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE) 179 #define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE)
182 #define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE) 180 #define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE)
183 #define XFS_IS_PQUOTA_ON(mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE) 181 #define XFS_IS_PQUOTA_ON(mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE)
184 182
185 /* 183 /*
186 * Flags to tell various functions what to do. Not all of these are meaningful 184 * Flags to tell various functions what to do. Not all of these are meaningful
187 * to a single function. None of these XFS_QMOPT_* flags are meant to have 185 * to a single function. None of these XFS_QMOPT_* flags are meant to have
188 * persistent values (ie. their values can and will change between versions) 186 * persistent values (ie. their values can and will change between versions)
189 */ 187 */
190 #define XFS_QMOPT_DQLOCK 0x0000001 /* dqlock */ 188 #define XFS_QMOPT_DQLOCK 0x0000001 /* dqlock */
191 #define XFS_QMOPT_DQALLOC 0x0000002 /* alloc dquot ondisk if needed */ 189 #define XFS_QMOPT_DQALLOC 0x0000002 /* alloc dquot ondisk if needed */
192 #define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */ 190 #define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */
193 #define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */ 191 #define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */
194 #define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */ 192 #define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */
195 #define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot */ 193 #define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot */
196 #define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */ 194 #define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */
197 #define XFS_QMOPT_QUOTAOFF 0x0000080 /* quotas are being turned off */ 195 #define XFS_QMOPT_QUOTAOFF 0x0000080 /* quotas are being turned off */
198 #define XFS_QMOPT_UMOUNTING 0x0000100 /* filesys is being unmounted */ 196 #define XFS_QMOPT_UMOUNTING 0x0000100 /* filesys is being unmounted */
199 #define XFS_QMOPT_DOLOG 0x0000200 /* log buf changes (in quotacheck) */ 197 #define XFS_QMOPT_DOLOG 0x0000200 /* log buf changes (in quotacheck) */
200 #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */ 198 #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */
201 #define XFS_QMOPT_ILOCKED 0x0000800 /* inode is already locked (excl) */ 199 #define XFS_QMOPT_ILOCKED 0x0000800 /* inode is already locked (excl) */
202 #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */ 200 #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */
203 #define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */ 201 #define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */
204 #define XFS_QMOPT_ENOSPC 0x0004000 /* enospc instead of edquot (prj) */ 202 #define XFS_QMOPT_ENOSPC 0x0004000 /* enospc instead of edquot (prj) */
205 203
206 /* 204 /*
207 * flags to xfs_trans_mod_dquot to indicate which field needs to be 205 * flags to xfs_trans_mod_dquot to indicate which field needs to be
208 * modified. 206 * modified.
209 */ 207 */
210 #define XFS_QMOPT_RES_REGBLKS 0x0010000 208 #define XFS_QMOPT_RES_REGBLKS 0x0010000
211 #define XFS_QMOPT_RES_RTBLKS 0x0020000 209 #define XFS_QMOPT_RES_RTBLKS 0x0020000
212 #define XFS_QMOPT_BCOUNT 0x0040000 210 #define XFS_QMOPT_BCOUNT 0x0040000
213 #define XFS_QMOPT_ICOUNT 0x0080000 211 #define XFS_QMOPT_ICOUNT 0x0080000
214 #define XFS_QMOPT_RTBCOUNT 0x0100000 212 #define XFS_QMOPT_RTBCOUNT 0x0100000
215 #define XFS_QMOPT_DELBCOUNT 0x0200000 213 #define XFS_QMOPT_DELBCOUNT 0x0200000
216 #define XFS_QMOPT_DELRTBCOUNT 0x0400000 214 #define XFS_QMOPT_DELRTBCOUNT 0x0400000
217 #define XFS_QMOPT_RES_INOS 0x0800000 215 #define XFS_QMOPT_RES_INOS 0x0800000
218 216
219 /* 217 /*
220 * flags for dqflush and dqflush_all. 218 * flags for dqflush and dqflush_all.
221 */ 219 */
222 #define XFS_QMOPT_SYNC 0x1000000 220 #define XFS_QMOPT_SYNC 0x1000000
223 #define XFS_QMOPT_ASYNC 0x2000000 221 #define XFS_QMOPT_ASYNC 0x2000000
224 #define XFS_QMOPT_DELWRI 0x4000000 222 #define XFS_QMOPT_DELWRI 0x4000000
225 223
226 /* 224 /*
227 * flags for dqalloc. 225 * flags for dqalloc.
228 */ 226 */
229 #define XFS_QMOPT_INHERIT 0x8000000 227 #define XFS_QMOPT_INHERIT 0x8000000
230 228
231 /* 229 /*
232 * flags to xfs_trans_mod_dquot. 230 * flags to xfs_trans_mod_dquot.
233 */ 231 */
234 #define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS 232 #define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS
235 #define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS 233 #define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS
236 #define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS 234 #define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS
237 #define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT 235 #define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT
238 #define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT 236 #define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT
239 #define XFS_TRANS_DQ_ICOUNT XFS_QMOPT_ICOUNT 237 #define XFS_TRANS_DQ_ICOUNT XFS_QMOPT_ICOUNT
240 #define XFS_TRANS_DQ_RTBCOUNT XFS_QMOPT_RTBCOUNT 238 #define XFS_TRANS_DQ_RTBCOUNT XFS_QMOPT_RTBCOUNT
241 #define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT 239 #define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT
242 240
243 241
244 #define XFS_QMOPT_QUOTALL \ 242 #define XFS_QMOPT_QUOTALL \
245 (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA) 243 (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA)
246 #define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS) 244 #define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS)
247 245
248 #ifdef __KERNEL__ 246 #ifdef __KERNEL__
249 /* 247 /*
250 * This check is done typically without holding the inode lock; 248 * This check is done typically without holding the inode lock;
251 * that may seem racy, but it is harmless in the context that it is used. 249 * that may seem racy, but it is harmless in the context that it is used.
252 * The inode cannot go inactive as long a reference is kept, and 250 * The inode cannot go inactive as long a reference is kept, and
253 * therefore if dquot(s) were attached, they'll stay consistent. 251 * therefore if dquot(s) were attached, they'll stay consistent.
254 * If, for example, the ownership of the inode changes while 252 * If, for example, the ownership of the inode changes while
255 * we didn't have the inode locked, the appropriate dquot(s) will be 253 * we didn't have the inode locked, the appropriate dquot(s) will be
256 * attached atomically. 254 * attached atomically.
257 */ 255 */
258 #define XFS_NOT_DQATTACHED(mp, ip) ((XFS_IS_UQUOTA_ON(mp) &&\ 256 #define XFS_NOT_DQATTACHED(mp, ip) ((XFS_IS_UQUOTA_ON(mp) &&\
259 (ip)->i_udquot == NULL) || \ 257 (ip)->i_udquot == NULL) || \
260 (XFS_IS_OQUOTA_ON(mp) && \ 258 (XFS_IS_OQUOTA_ON(mp) && \
261 (ip)->i_gdquot == NULL)) 259 (ip)->i_gdquot == NULL))
262 260
263 #define XFS_QM_NEED_QUOTACHECK(mp) \ 261 #define XFS_QM_NEED_QUOTACHECK(mp) \
264 ((XFS_IS_UQUOTA_ON(mp) && \ 262 ((XFS_IS_UQUOTA_ON(mp) && \
265 (mp->m_sb.sb_qflags & XFS_UQUOTA_CHKD) == 0) || \ 263 (mp->m_sb.sb_qflags & XFS_UQUOTA_CHKD) == 0) || \
266 (XFS_IS_GQUOTA_ON(mp) && \ 264 (XFS_IS_GQUOTA_ON(mp) && \
267 ((mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD) == 0 || \ 265 ((mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD) == 0 || \
268 (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT))) || \ 266 (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT))) || \
269 (XFS_IS_PQUOTA_ON(mp) && \ 267 (XFS_IS_PQUOTA_ON(mp) && \
270 ((mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD) == 0 || \ 268 ((mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD) == 0 || \
271 (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT)))) 269 (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT))))
272 270
273 #define XFS_MOUNT_QUOTA_SET1 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ 271 #define XFS_MOUNT_QUOTA_SET1 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\
274 XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ 272 XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\
275 XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD) 273 XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD)
276 274
277 #define XFS_MOUNT_QUOTA_SET2 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ 275 #define XFS_MOUNT_QUOTA_SET2 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\
278 XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\ 276 XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\
279 XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD) 277 XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD)
280 278
281 #define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ 279 #define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\
282 XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ 280 XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\
283 XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD|\ 281 XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD|\
284 XFS_GQUOTA_ACCT) 282 XFS_GQUOTA_ACCT)
285 283
286 284
287 /* 285 /*
288 * The structure kept inside the xfs_trans_t keep track of dquot changes 286 * The structure kept inside the xfs_trans_t keep track of dquot changes
289 * within a transaction and apply them later. 287 * within a transaction and apply them later.
290 */ 288 */
291 typedef struct xfs_dqtrx { 289 typedef struct xfs_dqtrx {
292 struct xfs_dquot *qt_dquot; /* the dquot this refers to */ 290 struct xfs_dquot *qt_dquot; /* the dquot this refers to */
293 ulong qt_blk_res; /* blks reserved on a dquot */ 291 ulong qt_blk_res; /* blks reserved on a dquot */
294 ulong qt_blk_res_used; /* blks used from the reservation */ 292 ulong qt_blk_res_used; /* blks used from the reservation */
295 ulong qt_ino_res; /* inode reserved on a dquot */ 293 ulong qt_ino_res; /* inode reserved on a dquot */
296 ulong qt_ino_res_used; /* inodes used from the reservation */ 294 ulong qt_ino_res_used; /* inodes used from the reservation */
297 long qt_bcount_delta; /* dquot blk count changes */ 295 long qt_bcount_delta; /* dquot blk count changes */
298 long qt_delbcnt_delta; /* delayed dquot blk count changes */ 296 long qt_delbcnt_delta; /* delayed dquot blk count changes */
299 long qt_icount_delta; /* dquot inode count changes */ 297 long qt_icount_delta; /* dquot inode count changes */
300 ulong qt_rtblk_res; /* # blks reserved on a dquot */ 298 ulong qt_rtblk_res; /* # blks reserved on a dquot */
301 ulong qt_rtblk_res_used;/* # blks used from reservation */ 299 ulong qt_rtblk_res_used;/* # blks used from reservation */
302 long qt_rtbcount_delta;/* dquot realtime blk changes */ 300 long qt_rtbcount_delta;/* dquot realtime blk changes */
303 long qt_delrtb_delta; /* delayed RT blk count changes */ 301 long qt_delrtb_delta; /* delayed RT blk count changes */
304 } xfs_dqtrx_t; 302 } xfs_dqtrx_t;
305 303
306 /* 304 /*
307 * Dquot transaction functions, used if quota is enabled. 305 * Dquot transaction functions, used if quota is enabled.
308 */ 306 */
309 typedef void (*qo_dup_dqinfo_t)(struct xfs_trans *, struct xfs_trans *); 307 typedef void (*qo_dup_dqinfo_t)(struct xfs_trans *, struct xfs_trans *);
310 typedef void (*qo_mod_dquot_byino_t)(struct xfs_trans *, 308 typedef void (*qo_mod_dquot_byino_t)(struct xfs_trans *,
311 struct xfs_inode *, uint, long); 309 struct xfs_inode *, uint, long);
312 typedef void (*qo_free_dqinfo_t)(struct xfs_trans *); 310 typedef void (*qo_free_dqinfo_t)(struct xfs_trans *);
313 typedef void (*qo_apply_dquot_deltas_t)(struct xfs_trans *); 311 typedef void (*qo_apply_dquot_deltas_t)(struct xfs_trans *);
314 typedef void (*qo_unreserve_and_mod_dquots_t)(struct xfs_trans *); 312 typedef void (*qo_unreserve_and_mod_dquots_t)(struct xfs_trans *);
315 typedef int (*qo_reserve_quota_nblks_t)( 313 typedef int (*qo_reserve_quota_nblks_t)(
316 struct xfs_trans *, struct xfs_mount *, 314 struct xfs_trans *, struct xfs_mount *,
317 struct xfs_inode *, long, long, uint); 315 struct xfs_inode *, long, long, uint);
318 typedef int (*qo_reserve_quota_bydquots_t)( 316 typedef int (*qo_reserve_quota_bydquots_t)(
319 struct xfs_trans *, struct xfs_mount *, 317 struct xfs_trans *, struct xfs_mount *,
320 struct xfs_dquot *, struct xfs_dquot *, 318 struct xfs_dquot *, struct xfs_dquot *,
321 long, long, uint); 319 long, long, uint);
322 typedef struct xfs_dqtrxops { 320 typedef struct xfs_dqtrxops {
323 qo_dup_dqinfo_t qo_dup_dqinfo; 321 qo_dup_dqinfo_t qo_dup_dqinfo;
324 qo_free_dqinfo_t qo_free_dqinfo; 322 qo_free_dqinfo_t qo_free_dqinfo;
325 qo_mod_dquot_byino_t qo_mod_dquot_byino; 323 qo_mod_dquot_byino_t qo_mod_dquot_byino;
326 qo_apply_dquot_deltas_t qo_apply_dquot_deltas; 324 qo_apply_dquot_deltas_t qo_apply_dquot_deltas;
327 qo_reserve_quota_nblks_t qo_reserve_quota_nblks; 325 qo_reserve_quota_nblks_t qo_reserve_quota_nblks;
328 qo_reserve_quota_bydquots_t qo_reserve_quota_bydquots; 326 qo_reserve_quota_bydquots_t qo_reserve_quota_bydquots;
329 qo_unreserve_and_mod_dquots_t qo_unreserve_and_mod_dquots; 327 qo_unreserve_and_mod_dquots_t qo_unreserve_and_mod_dquots;
330 } xfs_dqtrxops_t; 328 } xfs_dqtrxops_t;
331 329
332 #define XFS_DQTRXOP(mp, tp, op, args...) \ 330 #define XFS_DQTRXOP(mp, tp, op, args...) \
333 ((mp)->m_qm_ops->xfs_dqtrxops ? \ 331 ((mp)->m_qm_ops->xfs_dqtrxops ? \
334 ((mp)->m_qm_ops->xfs_dqtrxops->op)(tp, ## args) : 0) 332 ((mp)->m_qm_ops->xfs_dqtrxops->op)(tp, ## args) : 0)
335 333
336 #define XFS_DQTRXOP_VOID(mp, tp, op, args...) \ 334 #define XFS_DQTRXOP_VOID(mp, tp, op, args...) \
337 ((mp)->m_qm_ops->xfs_dqtrxops ? \ 335 ((mp)->m_qm_ops->xfs_dqtrxops ? \
338 ((mp)->m_qm_ops->xfs_dqtrxops->op)(tp, ## args) : (void)0) 336 ((mp)->m_qm_ops->xfs_dqtrxops->op)(tp, ## args) : (void)0)
339 337
340 #define XFS_TRANS_DUP_DQINFO(mp, otp, ntp) \ 338 #define XFS_TRANS_DUP_DQINFO(mp, otp, ntp) \
341 XFS_DQTRXOP_VOID(mp, otp, qo_dup_dqinfo, ntp) 339 XFS_DQTRXOP_VOID(mp, otp, qo_dup_dqinfo, ntp)
342 #define XFS_TRANS_FREE_DQINFO(mp, tp) \ 340 #define XFS_TRANS_FREE_DQINFO(mp, tp) \
343 XFS_DQTRXOP_VOID(mp, tp, qo_free_dqinfo) 341 XFS_DQTRXOP_VOID(mp, tp, qo_free_dqinfo)
344 #define XFS_TRANS_MOD_DQUOT_BYINO(mp, tp, ip, field, delta) \ 342 #define XFS_TRANS_MOD_DQUOT_BYINO(mp, tp, ip, field, delta) \
345 XFS_DQTRXOP_VOID(mp, tp, qo_mod_dquot_byino, ip, field, delta) 343 XFS_DQTRXOP_VOID(mp, tp, qo_mod_dquot_byino, ip, field, delta)
346 #define XFS_TRANS_APPLY_DQUOT_DELTAS(mp, tp) \ 344 #define XFS_TRANS_APPLY_DQUOT_DELTAS(mp, tp) \
347 XFS_DQTRXOP_VOID(mp, tp, qo_apply_dquot_deltas) 345 XFS_DQTRXOP_VOID(mp, tp, qo_apply_dquot_deltas)
348 #define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, ninos, fl) \ 346 #define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, ninos, fl) \
349 XFS_DQTRXOP(mp, tp, qo_reserve_quota_nblks, mp, ip, nblks, ninos, fl) 347 XFS_DQTRXOP(mp, tp, qo_reserve_quota_nblks, mp, ip, nblks, ninos, fl)
350 #define XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, fl) \ 348 #define XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, fl) \
351 XFS_DQTRXOP(mp, tp, qo_reserve_quota_bydquots, mp, ud, gd, nb, ni, fl) 349 XFS_DQTRXOP(mp, tp, qo_reserve_quota_bydquots, mp, ud, gd, nb, ni, fl)
352 #define XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp) \ 350 #define XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp) \
353 XFS_DQTRXOP_VOID(mp, tp, qo_unreserve_and_mod_dquots) 351 XFS_DQTRXOP_VOID(mp, tp, qo_unreserve_and_mod_dquots)
354 352
355 #define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, ninos, flags) \ 353 #define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, ninos, flags) \
356 XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, -(nblks), -(ninos), flags) 354 XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, -(nblks), -(ninos), flags)
357 #define XFS_TRANS_RESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \ 355 #define XFS_TRANS_RESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \
358 XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, \ 356 XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, \
359 f | XFS_QMOPT_RES_REGBLKS) 357 f | XFS_QMOPT_RES_REGBLKS)
360 #define XFS_TRANS_UNRESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \ 358 #define XFS_TRANS_UNRESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \
361 XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, -(nb), -(ni), \ 359 XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, -(nb), -(ni), \
362 f | XFS_QMOPT_RES_REGBLKS) 360 f | XFS_QMOPT_RES_REGBLKS)
363 361
364 extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *); 362 extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *);
365 extern int xfs_mount_reset_sbqflags(struct xfs_mount *); 363 extern int xfs_mount_reset_sbqflags(struct xfs_mount *);
366 364
367 extern struct xfs_qmops xfs_qmcore_xfs; 365 extern struct xfs_qmops xfs_qmcore_xfs;
368 366
369 #endif /* __KERNEL__ */ 367 #endif /* __KERNEL__ */
370 368
371 #endif /* __XFS_QUOTA_H__ */ 369 #endif /* __XFS_QUOTA_H__ */
372 370