diff options
Diffstat (limited to 'fs/xfs/quota')
-rw-r--r-- | fs/xfs/quota/xfs_dquot.c | 280 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot.h | 50 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot_item.c | 54 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot_item.h | 36 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 211 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.h | 44 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm_bhv.c | 95 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm_stats.c | 53 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm_stats.h | 37 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm_syscalls.c | 189 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_quota_priv.h | 36 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_trans_dquot.c | 102 |
12 files changed, 460 insertions, 727 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c index 46ce1e3ce1d6..00b5043dfa5a 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/quota/xfs_dquot.c | |||
@@ -1,39 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | |||
33 | #include "xfs.h" | 18 | #include "xfs.h" |
34 | #include "xfs_fs.h" | 19 | #include "xfs_fs.h" |
35 | #include "xfs_inum.h" | 20 | #include "xfs_bit.h" |
36 | #include "xfs_log.h" | 21 | #include "xfs_log.h" |
22 | #include "xfs_inum.h" | ||
37 | #include "xfs_trans.h" | 23 | #include "xfs_trans.h" |
38 | #include "xfs_sb.h" | 24 | #include "xfs_sb.h" |
39 | #include "xfs_ag.h" | 25 | #include "xfs_ag.h" |
@@ -43,18 +29,17 @@ | |||
43 | #include "xfs_dmapi.h" | 29 | #include "xfs_dmapi.h" |
44 | #include "xfs_quota.h" | 30 | #include "xfs_quota.h" |
45 | #include "xfs_mount.h" | 31 | #include "xfs_mount.h" |
46 | #include "xfs_alloc_btree.h" | ||
47 | #include "xfs_bmap_btree.h" | 32 | #include "xfs_bmap_btree.h" |
33 | #include "xfs_alloc_btree.h" | ||
48 | #include "xfs_ialloc_btree.h" | 34 | #include "xfs_ialloc_btree.h" |
49 | #include "xfs_btree.h" | ||
50 | #include "xfs_ialloc.h" | ||
51 | #include "xfs_attr_sf.h" | ||
52 | #include "xfs_dir_sf.h" | 35 | #include "xfs_dir_sf.h" |
53 | #include "xfs_dir2_sf.h" | 36 | #include "xfs_dir2_sf.h" |
37 | #include "xfs_attr_sf.h" | ||
54 | #include "xfs_dinode.h" | 38 | #include "xfs_dinode.h" |
55 | #include "xfs_inode.h" | 39 | #include "xfs_inode.h" |
40 | #include "xfs_btree.h" | ||
41 | #include "xfs_ialloc.h" | ||
56 | #include "xfs_bmap.h" | 42 | #include "xfs_bmap.h" |
57 | #include "xfs_bit.h" | ||
58 | #include "xfs_rtalloc.h" | 43 | #include "xfs_rtalloc.h" |
59 | #include "xfs_error.h" | 44 | #include "xfs_error.h" |
60 | #include "xfs_itable.h" | 45 | #include "xfs_itable.h" |
@@ -66,7 +51,6 @@ | |||
66 | #include "xfs_buf_item.h" | 51 | #include "xfs_buf_item.h" |
67 | #include "xfs_trans_space.h" | 52 | #include "xfs_trans_space.h" |
68 | #include "xfs_trans_priv.h" | 53 | #include "xfs_trans_priv.h" |
69 | |||
70 | #include "xfs_qm.h" | 54 | #include "xfs_qm.h" |
71 | 55 | ||
72 | 56 | ||
@@ -112,7 +96,7 @@ xfs_qm_dqinit( | |||
112 | 96 | ||
113 | brandnewdquot = xfs_qm_dqalloc_incore(&dqp); | 97 | brandnewdquot = xfs_qm_dqalloc_incore(&dqp); |
114 | dqp->dq_flags = type; | 98 | dqp->dq_flags = type; |
115 | INT_SET(dqp->q_core.d_id, ARCH_CONVERT, id); | 99 | dqp->q_core.d_id = cpu_to_be32(id); |
116 | dqp->q_mount = mp; | 100 | dqp->q_mount = mp; |
117 | 101 | ||
118 | /* | 102 | /* |
@@ -194,10 +178,10 @@ xfs_qm_dqinit_core( | |||
194 | /* | 178 | /* |
195 | * Caller has zero'd the entire dquot 'chunk' already. | 179 | * Caller has zero'd the entire dquot 'chunk' already. |
196 | */ | 180 | */ |
197 | INT_SET(d->dd_diskdq.d_magic, ARCH_CONVERT, XFS_DQUOT_MAGIC); | 181 | d->dd_diskdq.d_magic = cpu_to_be16(XFS_DQUOT_MAGIC); |
198 | INT_SET(d->dd_diskdq.d_version, ARCH_CONVERT, XFS_DQUOT_VERSION); | 182 | d->dd_diskdq.d_version = XFS_DQUOT_VERSION; |
199 | INT_SET(d->dd_diskdq.d_id, ARCH_CONVERT, id); | 183 | d->dd_diskdq.d_id = cpu_to_be32(id); |
200 | INT_SET(d->dd_diskdq.d_flags, ARCH_CONVERT, type); | 184 | d->dd_diskdq.d_flags = type; |
201 | } | 185 | } |
202 | 186 | ||
203 | 187 | ||
@@ -227,19 +211,13 @@ __xfs_dqtrace_entry( | |||
227 | (void *)(__psint_t)dqp->q_nrefs, | 211 | (void *)(__psint_t)dqp->q_nrefs, |
228 | (void *)(__psint_t)dqp->dq_flags, | 212 | (void *)(__psint_t)dqp->dq_flags, |
229 | (void *)(__psint_t)dqp->q_res_bcount, | 213 | (void *)(__psint_t)dqp->q_res_bcount, |
230 | (void *)(__psint_t)INT_GET(dqp->q_core.d_bcount, | 214 | (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_bcount), |
231 | ARCH_CONVERT), | 215 | (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_icount), |
232 | (void *)(__psint_t)INT_GET(dqp->q_core.d_icount, | 216 | (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_blk_hardlimit), |
233 | ARCH_CONVERT), | 217 | (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_blk_softlimit), |
234 | (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_hardlimit, | 218 | (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_ino_hardlimit), |
235 | ARCH_CONVERT), | 219 | (void *)(__psint_t)be64_to_cpu(dqp->q_core.d_ino_softlimit), |
236 | (void *)(__psint_t)INT_GET(dqp->q_core.d_blk_softlimit, | 220 | (void *)(__psint_t)be32_to_cpu(dqp->q_core.d_id), |
237 | ARCH_CONVERT), | ||
238 | (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_hardlimit, | ||
239 | ARCH_CONVERT), | ||
240 | (void *)(__psint_t)INT_GET(dqp->q_core.d_ino_softlimit, | ||
241 | ARCH_CONVERT), | ||
242 | (void *)(__psint_t)INT_GET(dqp->q_core.d_id, ARCH_CONVERT), | ||
243 | (void *)(__psint_t)current_pid(), | 221 | (void *)(__psint_t)current_pid(), |
244 | (void *)(__psint_t)ino, | 222 | (void *)(__psint_t)ino, |
245 | (void *)(__psint_t)retaddr, | 223 | (void *)(__psint_t)retaddr, |
@@ -264,17 +242,17 @@ xfs_qm_adjust_dqlimits( | |||
264 | ASSERT(d->d_id); | 242 | ASSERT(d->d_id); |
265 | 243 | ||
266 | if (q->qi_bsoftlimit && !d->d_blk_softlimit) | 244 | if (q->qi_bsoftlimit && !d->d_blk_softlimit) |
267 | INT_SET(d->d_blk_softlimit, ARCH_CONVERT, q->qi_bsoftlimit); | 245 | d->d_blk_softlimit = cpu_to_be64(q->qi_bsoftlimit); |
268 | if (q->qi_bhardlimit && !d->d_blk_hardlimit) | 246 | if (q->qi_bhardlimit && !d->d_blk_hardlimit) |
269 | INT_SET(d->d_blk_hardlimit, ARCH_CONVERT, q->qi_bhardlimit); | 247 | d->d_blk_hardlimit = cpu_to_be64(q->qi_bhardlimit); |
270 | if (q->qi_isoftlimit && !d->d_ino_softlimit) | 248 | if (q->qi_isoftlimit && !d->d_ino_softlimit) |
271 | INT_SET(d->d_ino_softlimit, ARCH_CONVERT, q->qi_isoftlimit); | 249 | d->d_ino_softlimit = cpu_to_be64(q->qi_isoftlimit); |
272 | if (q->qi_ihardlimit && !d->d_ino_hardlimit) | 250 | if (q->qi_ihardlimit && !d->d_ino_hardlimit) |
273 | INT_SET(d->d_ino_hardlimit, ARCH_CONVERT, q->qi_ihardlimit); | 251 | d->d_ino_hardlimit = cpu_to_be64(q->qi_ihardlimit); |
274 | if (q->qi_rtbsoftlimit && !d->d_rtb_softlimit) | 252 | if (q->qi_rtbsoftlimit && !d->d_rtb_softlimit) |
275 | INT_SET(d->d_rtb_softlimit, ARCH_CONVERT, q->qi_rtbsoftlimit); | 253 | d->d_rtb_softlimit = cpu_to_be64(q->qi_rtbsoftlimit); |
276 | if (q->qi_rtbhardlimit && !d->d_rtb_hardlimit) | 254 | if (q->qi_rtbhardlimit && !d->d_rtb_hardlimit) |
277 | INT_SET(d->d_rtb_hardlimit, ARCH_CONVERT, q->qi_rtbhardlimit); | 255 | d->d_rtb_hardlimit = cpu_to_be64(q->qi_rtbhardlimit); |
278 | } | 256 | } |
279 | 257 | ||
280 | /* | 258 | /* |
@@ -298,81 +276,81 @@ xfs_qm_adjust_dqtimers( | |||
298 | ASSERT(d->d_id); | 276 | ASSERT(d->d_id); |
299 | 277 | ||
300 | #ifdef QUOTADEBUG | 278 | #ifdef QUOTADEBUG |
301 | if (INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)) | 279 | if (d->d_blk_hardlimit) |
302 | ASSERT(INT_GET(d->d_blk_softlimit, ARCH_CONVERT) <= | 280 | ASSERT(be64_to_cpu(d->d_blk_softlimit) <= |
303 | INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)); | 281 | be64_to_cpu(d->d_blk_hardlimit)); |
304 | if (INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)) | 282 | if (d->d_ino_hardlimit) |
305 | ASSERT(INT_GET(d->d_ino_softlimit, ARCH_CONVERT) <= | 283 | ASSERT(be64_to_cpu(d->d_ino_softlimit) <= |
306 | INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)); | 284 | be64_to_cpu(d->d_ino_hardlimit)); |
307 | if (INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)) | 285 | if (d->d_rtb_hardlimit) |
308 | ASSERT(INT_GET(d->d_rtb_softlimit, ARCH_CONVERT) <= | 286 | ASSERT(be64_to_cpu(d->d_rtb_softlimit) <= |
309 | INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)); | 287 | be64_to_cpu(d->d_rtb_hardlimit)); |
310 | #endif | 288 | #endif |
311 | if (!d->d_btimer) { | 289 | if (!d->d_btimer) { |
312 | if ((INT_GET(d->d_blk_softlimit, ARCH_CONVERT) && | 290 | if ((d->d_blk_softlimit && |
313 | (INT_GET(d->d_bcount, ARCH_CONVERT) >= | 291 | (be64_to_cpu(d->d_bcount) >= |
314 | INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) || | 292 | be64_to_cpu(d->d_blk_softlimit))) || |
315 | (INT_GET(d->d_blk_hardlimit, ARCH_CONVERT) && | 293 | (d->d_blk_hardlimit && |
316 | (INT_GET(d->d_bcount, ARCH_CONVERT) >= | 294 | (be64_to_cpu(d->d_bcount) >= |
317 | INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) { | 295 | be64_to_cpu(d->d_blk_hardlimit)))) { |
318 | INT_SET(d->d_btimer, ARCH_CONVERT, | 296 | d->d_btimer = cpu_to_be32(get_seconds() + |
319 | get_seconds() + XFS_QI_BTIMELIMIT(mp)); | 297 | XFS_QI_BTIMELIMIT(mp)); |
320 | } else { | 298 | } else { |
321 | d->d_bwarns = 0; | 299 | d->d_bwarns = 0; |
322 | } | 300 | } |
323 | } else { | 301 | } else { |
324 | if ((!d->d_blk_softlimit || | 302 | if ((!d->d_blk_softlimit || |
325 | (INT_GET(d->d_bcount, ARCH_CONVERT) < | 303 | (be64_to_cpu(d->d_bcount) < |
326 | INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) && | 304 | be64_to_cpu(d->d_blk_softlimit))) && |
327 | (!d->d_blk_hardlimit || | 305 | (!d->d_blk_hardlimit || |
328 | (INT_GET(d->d_bcount, ARCH_CONVERT) < | 306 | (be64_to_cpu(d->d_bcount) < |
329 | INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) { | 307 | be64_to_cpu(d->d_blk_hardlimit)))) { |
330 | d->d_btimer = 0; | 308 | d->d_btimer = 0; |
331 | } | 309 | } |
332 | } | 310 | } |
333 | 311 | ||
334 | if (!d->d_itimer) { | 312 | if (!d->d_itimer) { |
335 | if ((INT_GET(d->d_ino_softlimit, ARCH_CONVERT) && | 313 | if ((d->d_ino_softlimit && |
336 | (INT_GET(d->d_icount, ARCH_CONVERT) >= | 314 | (be64_to_cpu(d->d_icount) >= |
337 | INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) || | 315 | be64_to_cpu(d->d_ino_softlimit))) || |
338 | (INT_GET(d->d_ino_hardlimit, ARCH_CONVERT) && | 316 | (d->d_ino_hardlimit && |
339 | (INT_GET(d->d_icount, ARCH_CONVERT) >= | 317 | (be64_to_cpu(d->d_icount) >= |
340 | INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) { | 318 | be64_to_cpu(d->d_ino_hardlimit)))) { |
341 | INT_SET(d->d_itimer, ARCH_CONVERT, | 319 | d->d_itimer = cpu_to_be32(get_seconds() + |
342 | get_seconds() + XFS_QI_ITIMELIMIT(mp)); | 320 | XFS_QI_ITIMELIMIT(mp)); |
343 | } else { | 321 | } else { |
344 | d->d_iwarns = 0; | 322 | d->d_iwarns = 0; |
345 | } | 323 | } |
346 | } else { | 324 | } else { |
347 | if ((!d->d_ino_softlimit || | 325 | if ((!d->d_ino_softlimit || |
348 | (INT_GET(d->d_icount, ARCH_CONVERT) < | 326 | (be64_to_cpu(d->d_icount) < |
349 | INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) && | 327 | be64_to_cpu(d->d_ino_softlimit))) && |
350 | (!d->d_ino_hardlimit || | 328 | (!d->d_ino_hardlimit || |
351 | (INT_GET(d->d_icount, ARCH_CONVERT) < | 329 | (be64_to_cpu(d->d_icount) < |
352 | INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) { | 330 | be64_to_cpu(d->d_ino_hardlimit)))) { |
353 | d->d_itimer = 0; | 331 | d->d_itimer = 0; |
354 | } | 332 | } |
355 | } | 333 | } |
356 | 334 | ||
357 | if (!d->d_rtbtimer) { | 335 | if (!d->d_rtbtimer) { |
358 | if ((INT_GET(d->d_rtb_softlimit, ARCH_CONVERT) && | 336 | if ((d->d_rtb_softlimit && |
359 | (INT_GET(d->d_rtbcount, ARCH_CONVERT) >= | 337 | (be64_to_cpu(d->d_rtbcount) >= |
360 | INT_GET(d->d_rtb_softlimit, ARCH_CONVERT))) || | 338 | be64_to_cpu(d->d_rtb_softlimit))) || |
361 | (INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT) && | 339 | (d->d_rtb_hardlimit && |
362 | (INT_GET(d->d_rtbcount, ARCH_CONVERT) >= | 340 | (be64_to_cpu(d->d_rtbcount) >= |
363 | INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) { | 341 | be64_to_cpu(d->d_rtb_hardlimit)))) { |
364 | INT_SET(d->d_rtbtimer, ARCH_CONVERT, | 342 | d->d_rtbtimer = cpu_to_be32(get_seconds() + |
365 | get_seconds() + XFS_QI_RTBTIMELIMIT(mp)); | 343 | XFS_QI_RTBTIMELIMIT(mp)); |
366 | } else { | 344 | } else { |
367 | d->d_rtbwarns = 0; | 345 | d->d_rtbwarns = 0; |
368 | } | 346 | } |
369 | } else { | 347 | } else { |
370 | if ((!d->d_rtb_softlimit || | 348 | if ((!d->d_rtb_softlimit || |
371 | (INT_GET(d->d_rtbcount, ARCH_CONVERT) < | 349 | (be64_to_cpu(d->d_rtbcount) < |
372 | INT_GET(d->d_rtb_softlimit, ARCH_CONVERT))) && | 350 | be64_to_cpu(d->d_rtb_softlimit))) && |
373 | (!d->d_rtb_hardlimit || | 351 | (!d->d_rtb_hardlimit || |
374 | (INT_GET(d->d_rtbcount, ARCH_CONVERT) < | 352 | (be64_to_cpu(d->d_rtbcount) < |
375 | INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) { | 353 | be64_to_cpu(d->d_rtb_hardlimit)))) { |
376 | d->d_rtbtimer = 0; | 354 | d->d_rtbtimer = 0; |
377 | } | 355 | } |
378 | } | 356 | } |
@@ -421,7 +399,7 @@ xfs_qm_init_dquot_blk( | |||
421 | */ | 399 | */ |
422 | STATIC int | 400 | STATIC int |
423 | xfs_qm_dqalloc( | 401 | xfs_qm_dqalloc( |
424 | xfs_trans_t *tp, | 402 | xfs_trans_t **tpp, |
425 | xfs_mount_t *mp, | 403 | xfs_mount_t *mp, |
426 | xfs_dquot_t *dqp, | 404 | xfs_dquot_t *dqp, |
427 | xfs_inode_t *quotip, | 405 | xfs_inode_t *quotip, |
@@ -433,6 +411,7 @@ xfs_qm_dqalloc( | |||
433 | xfs_bmbt_irec_t map; | 411 | xfs_bmbt_irec_t map; |
434 | int nmaps, error, committed; | 412 | int nmaps, error, committed; |
435 | xfs_buf_t *bp; | 413 | xfs_buf_t *bp; |
414 | xfs_trans_t *tp = *tpp; | ||
436 | 415 | ||
437 | ASSERT(tp != NULL); | 416 | ASSERT(tp != NULL); |
438 | xfs_dqtrace_entry(dqp, "DQALLOC"); | 417 | xfs_dqtrace_entry(dqp, "DQALLOC"); |
@@ -489,13 +468,35 @@ xfs_qm_dqalloc( | |||
489 | * Make a chunk of dquots out of this buffer and log | 468 | * Make a chunk of dquots out of this buffer and log |
490 | * the entire thing. | 469 | * the entire thing. |
491 | */ | 470 | */ |
492 | xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT), | 471 | xfs_qm_init_dquot_blk(tp, mp, be32_to_cpu(dqp->q_core.d_id), |
493 | dqp->dq_flags & XFS_DQ_ALLTYPES, bp); | 472 | dqp->dq_flags & XFS_DQ_ALLTYPES, bp); |
494 | 473 | ||
495 | if ((error = xfs_bmap_finish(&tp, &flist, firstblock, &committed))) { | 474 | /* |
475 | * xfs_bmap_finish() may commit the current transaction and | ||
476 | * start a second transaction if the freelist is not empty. | ||
477 | * | ||
478 | * Since we still want to modify this buffer, we need to | ||
479 | * ensure that the buffer is not released on commit of | ||
480 | * the first transaction and ensure the buffer is added to the | ||
481 | * second transaction. | ||
482 | * | ||
483 | * If there is only one transaction then don't stop the buffer | ||
484 | * from being released when it commits later on. | ||
485 | */ | ||
486 | |||
487 | xfs_trans_bhold(tp, bp); | ||
488 | |||
489 | if ((error = xfs_bmap_finish(tpp, &flist, firstblock, &committed))) { | ||
496 | goto error1; | 490 | goto error1; |
497 | } | 491 | } |
498 | 492 | ||
493 | if (committed) { | ||
494 | tp = *tpp; | ||
495 | xfs_trans_bjoin(tp, bp); | ||
496 | } else { | ||
497 | xfs_trans_bhold_release(tp, bp); | ||
498 | } | ||
499 | |||
499 | *O_bpp = bp; | 500 | *O_bpp = bp; |
500 | return 0; | 501 | return 0; |
501 | 502 | ||
@@ -514,7 +515,7 @@ xfs_qm_dqalloc( | |||
514 | */ | 515 | */ |
515 | STATIC int | 516 | STATIC int |
516 | xfs_qm_dqtobp( | 517 | xfs_qm_dqtobp( |
517 | xfs_trans_t *tp, | 518 | xfs_trans_t **tpp, |
518 | xfs_dquot_t *dqp, | 519 | xfs_dquot_t *dqp, |
519 | xfs_disk_dquot_t **O_ddpp, | 520 | xfs_disk_dquot_t **O_ddpp, |
520 | xfs_buf_t **O_bpp, | 521 | xfs_buf_t **O_bpp, |
@@ -528,9 +529,10 @@ xfs_qm_dqtobp( | |||
528 | xfs_disk_dquot_t *ddq; | 529 | xfs_disk_dquot_t *ddq; |
529 | xfs_dqid_t id; | 530 | xfs_dqid_t id; |
530 | boolean_t newdquot; | 531 | boolean_t newdquot; |
532 | xfs_trans_t *tp = (tpp ? *tpp : NULL); | ||
531 | 533 | ||
532 | mp = dqp->q_mount; | 534 | mp = dqp->q_mount; |
533 | id = INT_GET(dqp->q_core.d_id, ARCH_CONVERT); | 535 | id = be32_to_cpu(dqp->q_core.d_id); |
534 | nmaps = 1; | 536 | nmaps = 1; |
535 | newdquot = B_FALSE; | 537 | newdquot = B_FALSE; |
536 | 538 | ||
@@ -539,8 +541,7 @@ xfs_qm_dqtobp( | |||
539 | */ | 541 | */ |
540 | if (dqp->q_blkno == (xfs_daddr_t) 0) { | 542 | if (dqp->q_blkno == (xfs_daddr_t) 0) { |
541 | /* We use the id as an index */ | 543 | /* We use the id as an index */ |
542 | dqp->q_fileoffset = (xfs_fileoff_t) ((uint)id / | 544 | dqp->q_fileoffset = (xfs_fileoff_t)id / XFS_QM_DQPERBLK(mp); |
543 | XFS_QM_DQPERBLK(mp)); | ||
544 | nmaps = 1; | 545 | nmaps = 1; |
545 | quotip = XFS_DQ_TO_QIP(dqp); | 546 | quotip = XFS_DQ_TO_QIP(dqp); |
546 | xfs_ilock(quotip, XFS_ILOCK_SHARED); | 547 | xfs_ilock(quotip, XFS_ILOCK_SHARED); |
@@ -579,9 +580,10 @@ xfs_qm_dqtobp( | |||
579 | return (ENOENT); | 580 | return (ENOENT); |
580 | 581 | ||
581 | ASSERT(tp); | 582 | ASSERT(tp); |
582 | if ((error = xfs_qm_dqalloc(tp, mp, dqp, quotip, | 583 | if ((error = xfs_qm_dqalloc(tpp, mp, dqp, quotip, |
583 | dqp->q_fileoffset, &bp))) | 584 | dqp->q_fileoffset, &bp))) |
584 | return (error); | 585 | return (error); |
586 | tp = *tpp; | ||
585 | newdquot = B_TRUE; | 587 | newdquot = B_TRUE; |
586 | } else { | 588 | } else { |
587 | /* | 589 | /* |
@@ -645,7 +647,7 @@ xfs_qm_dqtobp( | |||
645 | /* ARGSUSED */ | 647 | /* ARGSUSED */ |
646 | STATIC int | 648 | STATIC int |
647 | xfs_qm_dqread( | 649 | xfs_qm_dqread( |
648 | xfs_trans_t *tp, | 650 | xfs_trans_t **tpp, |
649 | xfs_dqid_t id, | 651 | xfs_dqid_t id, |
650 | xfs_dquot_t *dqp, /* dquot to get filled in */ | 652 | xfs_dquot_t *dqp, /* dquot to get filled in */ |
651 | uint flags) | 653 | uint flags) |
@@ -653,28 +655,32 @@ xfs_qm_dqread( | |||
653 | xfs_disk_dquot_t *ddqp; | 655 | xfs_disk_dquot_t *ddqp; |
654 | xfs_buf_t *bp; | 656 | xfs_buf_t *bp; |
655 | int error; | 657 | int error; |
658 | xfs_trans_t *tp; | ||
659 | |||
660 | ASSERT(tpp); | ||
656 | 661 | ||
657 | /* | 662 | /* |
658 | * get a pointer to the on-disk dquot and the buffer containing it | 663 | * get a pointer to the on-disk dquot and the buffer containing it |
659 | * dqp already knows its own type (GROUP/USER). | 664 | * dqp already knows its own type (GROUP/USER). |
660 | */ | 665 | */ |
661 | xfs_dqtrace_entry(dqp, "DQREAD"); | 666 | xfs_dqtrace_entry(dqp, "DQREAD"); |
662 | if ((error = xfs_qm_dqtobp(tp, dqp, &ddqp, &bp, flags))) { | 667 | if ((error = xfs_qm_dqtobp(tpp, dqp, &ddqp, &bp, flags))) { |
663 | return (error); | 668 | return (error); |
664 | } | 669 | } |
670 | tp = *tpp; | ||
665 | 671 | ||
666 | /* copy everything from disk dquot to the incore dquot */ | 672 | /* copy everything from disk dquot to the incore dquot */ |
667 | memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t)); | 673 | memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t)); |
668 | ASSERT(INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id); | 674 | ASSERT(be32_to_cpu(dqp->q_core.d_id) == id); |
669 | xfs_qm_dquot_logitem_init(dqp); | 675 | xfs_qm_dquot_logitem_init(dqp); |
670 | 676 | ||
671 | /* | 677 | /* |
672 | * Reservation counters are defined as reservation plus current usage | 678 | * Reservation counters are defined as reservation plus current usage |
673 | * to avoid having to add everytime. | 679 | * to avoid having to add everytime. |
674 | */ | 680 | */ |
675 | dqp->q_res_bcount = INT_GET(ddqp->d_bcount, ARCH_CONVERT); | 681 | dqp->q_res_bcount = be64_to_cpu(ddqp->d_bcount); |
676 | dqp->q_res_icount = INT_GET(ddqp->d_icount, ARCH_CONVERT); | 682 | dqp->q_res_icount = be64_to_cpu(ddqp->d_icount); |
677 | dqp->q_res_rtbcount = INT_GET(ddqp->d_rtbcount, ARCH_CONVERT); | 683 | dqp->q_res_rtbcount = be64_to_cpu(ddqp->d_rtbcount); |
678 | 684 | ||
679 | /* Mark the buf so that this will stay incore a little longer */ | 685 | /* Mark the buf so that this will stay incore a little longer */ |
680 | XFS_BUF_SET_VTYPE_REF(bp, B_FS_DQUOT, XFS_DQUOT_REF); | 686 | XFS_BUF_SET_VTYPE_REF(bp, B_FS_DQUOT, XFS_DQUOT_REF); |
@@ -740,7 +746,7 @@ xfs_qm_idtodq( | |||
740 | * Read it from disk; xfs_dqread() takes care of | 746 | * Read it from disk; xfs_dqread() takes care of |
741 | * all the necessary initialization of dquot's fields (locks, etc) | 747 | * all the necessary initialization of dquot's fields (locks, etc) |
742 | */ | 748 | */ |
743 | if ((error = xfs_qm_dqread(tp, id, dqp, flags))) { | 749 | if ((error = xfs_qm_dqread(&tp, id, dqp, flags))) { |
744 | /* | 750 | /* |
745 | * This can happen if quotas got turned off (ESRCH), | 751 | * This can happen if quotas got turned off (ESRCH), |
746 | * or if the dquot didn't exist on disk and we ask to | 752 | * or if the dquot didn't exist on disk and we ask to |
@@ -800,7 +806,7 @@ xfs_qm_dqlookup( | |||
800 | * dqlock to look at the id field of the dquot, since the | 806 | * dqlock to look at the id field of the dquot, since the |
801 | * id can't be modified without the hashlock anyway. | 807 | * id can't be modified without the hashlock anyway. |
802 | */ | 808 | */ |
803 | if (INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id && dqp->q_mount == mp) { | 809 | if (be32_to_cpu(dqp->q_core.d_id) == id && dqp->q_mount == mp) { |
804 | xfs_dqtrace_entry(dqp, "DQFOUND BY LOOKUP"); | 810 | xfs_dqtrace_entry(dqp, "DQFOUND BY LOOKUP"); |
805 | /* | 811 | /* |
806 | * All in core dquots must be on the dqlist of mp | 812 | * All in core dquots must be on the dqlist of mp |
@@ -831,7 +837,7 @@ xfs_qm_dqlookup( | |||
831 | * id couldn't have changed; we had the hashlock all | 837 | * id couldn't have changed; we had the hashlock all |
832 | * along | 838 | * along |
833 | */ | 839 | */ |
834 | ASSERT(INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id); | 840 | ASSERT(be32_to_cpu(dqp->q_core.d_id) == id); |
835 | 841 | ||
836 | if (flist_locked) { | 842 | if (flist_locked) { |
837 | if (dqp->q_nrefs != 0) { | 843 | if (dqp->q_nrefs != 0) { |
@@ -1253,7 +1259,7 @@ xfs_qm_dqflush( | |||
1253 | return (error); | 1259 | return (error); |
1254 | } | 1260 | } |
1255 | 1261 | ||
1256 | if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT), | 1262 | if (xfs_qm_dqcheck(&dqp->q_core, be32_to_cpu(ddqp->d_id), |
1257 | 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) { | 1263 | 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) { |
1258 | xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE); | 1264 | xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE); |
1259 | return XFS_ERROR(EIO); | 1265 | return XFS_ERROR(EIO); |
@@ -1406,8 +1412,8 @@ xfs_dqlock2( | |||
1406 | { | 1412 | { |
1407 | if (d1 && d2) { | 1413 | if (d1 && d2) { |
1408 | ASSERT(d1 != d2); | 1414 | ASSERT(d1 != d2); |
1409 | if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) > | 1415 | if (be32_to_cpu(d1->q_core.d_id) > |
1410 | INT_GET(d2->q_core.d_id, ARCH_CONVERT)) { | 1416 | be32_to_cpu(d2->q_core.d_id)) { |
1411 | xfs_dqlock(d2); | 1417 | xfs_dqlock(d2); |
1412 | xfs_dqlock(d1); | 1418 | xfs_dqlock(d1); |
1413 | } else { | 1419 | } else { |
@@ -1529,33 +1535,33 @@ xfs_qm_dqprint(xfs_dquot_t *dqp) | |||
1529 | { | 1535 | { |
1530 | cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------"); | 1536 | cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------"); |
1531 | cmn_err(CE_DEBUG, "---- dquotID = %d", | 1537 | cmn_err(CE_DEBUG, "---- dquotID = %d", |
1532 | (int)INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); | 1538 | (int)be32_to_cpu(dqp->q_core.d_id)); |
1533 | cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp)); | 1539 | cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp)); |
1534 | cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount); | 1540 | cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount); |
1535 | cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno); | 1541 | cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno); |
1536 | cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset); | 1542 | cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset); |
1537 | cmn_err(CE_DEBUG, "---- blkhlimit = %Lu (0x%x)", | 1543 | cmn_err(CE_DEBUG, "---- blkhlimit = %Lu (0x%x)", |
1538 | INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT), | 1544 | be64_to_cpu(dqp->q_core.d_blk_hardlimit), |
1539 | (int) INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT)); | 1545 | (int)be64_to_cpu(dqp->q_core.d_blk_hardlimit)); |
1540 | cmn_err(CE_DEBUG, "---- blkslimit = %Lu (0x%x)", | 1546 | cmn_err(CE_DEBUG, "---- blkslimit = %Lu (0x%x)", |
1541 | INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT), | 1547 | be64_to_cpu(dqp->q_core.d_blk_softlimit), |
1542 | (int)INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT)); | 1548 | (int)be64_to_cpu(dqp->q_core.d_blk_softlimit)); |
1543 | cmn_err(CE_DEBUG, "---- inohlimit = %Lu (0x%x)", | 1549 | cmn_err(CE_DEBUG, "---- inohlimit = %Lu (0x%x)", |
1544 | INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT), | 1550 | be64_to_cpu(dqp->q_core.d_ino_hardlimit), |
1545 | (int)INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT)); | 1551 | (int)be64_to_cpu(dqp->q_core.d_ino_hardlimit)); |
1546 | cmn_err(CE_DEBUG, "---- inoslimit = %Lu (0x%x)", | 1552 | cmn_err(CE_DEBUG, "---- inoslimit = %Lu (0x%x)", |
1547 | INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT), | 1553 | be64_to_cpu(dqp->q_core.d_ino_softlimit), |
1548 | (int)INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT)); | 1554 | (int)be64_to_cpu(dqp->q_core.d_ino_softlimit)); |
1549 | cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)", | 1555 | cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)", |
1550 | INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), | 1556 | be64_to_cpu(dqp->q_core.d_bcount), |
1551 | (int)INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); | 1557 | (int)be64_to_cpu(dqp->q_core.d_bcount)); |
1552 | cmn_err(CE_DEBUG, "---- icount = %Lu (0x%x)", | 1558 | cmn_err(CE_DEBUG, "---- icount = %Lu (0x%x)", |
1553 | INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), | 1559 | be64_to_cpu(dqp->q_core.d_icount), |
1554 | (int)INT_GET(dqp->q_core.d_icount, ARCH_CONVERT)); | 1560 | (int)be64_to_cpu(dqp->q_core.d_icount)); |
1555 | cmn_err(CE_DEBUG, "---- btimer = %d", | 1561 | cmn_err(CE_DEBUG, "---- btimer = %d", |
1556 | (int)INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT)); | 1562 | (int)be32_to_cpu(dqp->q_core.d_btimer)); |
1557 | cmn_err(CE_DEBUG, "---- itimer = %d", | 1563 | cmn_err(CE_DEBUG, "---- itimer = %d", |
1558 | (int)INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT)); | 1564 | (int)be32_to_cpu(dqp->q_core.d_itimer)); |
1559 | cmn_err(CE_DEBUG, "---------------------------"); | 1565 | cmn_err(CE_DEBUG, "---------------------------"); |
1560 | } | 1566 | } |
1561 | #endif | 1567 | #endif |
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/quota/xfs_dquot.h index 39175103c8e0..c0c629663a5c 100644 --- a/fs/xfs/quota/xfs_dquot.h +++ b/fs/xfs/quota/xfs_dquot.h | |||
@@ -1,33 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | #ifndef __XFS_DQUOT_H__ | 18 | #ifndef __XFS_DQUOT_H__ |
33 | #define __XFS_DQUOT_H__ | 19 | #define __XFS_DQUOT_H__ |
@@ -113,20 +99,6 @@ typedef struct xfs_dquot { | |||
113 | 99 | ||
114 | #define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++) | 100 | #define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++) |
115 | 101 | ||
116 | /* | ||
117 | * Quota Accounting/Enforcement flags | ||
118 | */ | ||
119 | #define XFS_ALL_QUOTA_ACCT \ | ||
120 | (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT) | ||
121 | #define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD) | ||
122 | #define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD) | ||
123 | |||
124 | #define XFS_IS_QUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT) | ||
125 | #define XFS_IS_QUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ENFD) | ||
126 | #define XFS_IS_UQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT) | ||
127 | #define XFS_IS_PQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT) | ||
128 | #define XFS_IS_GQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT) | ||
129 | |||
130 | #ifdef DEBUG | 102 | #ifdef DEBUG |
131 | static inline int | 103 | static inline int |
132 | XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp) | 104 | XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp) |
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c index f5271b7b1e84..2f69822344e5 100644 --- a/fs/xfs/quota/xfs_dquot_item.c +++ b/fs/xfs/quota/xfs_dquot_item.c | |||
@@ -1,39 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | |||
33 | #include "xfs.h" | 18 | #include "xfs.h" |
34 | #include "xfs_fs.h" | 19 | #include "xfs_fs.h" |
35 | #include "xfs_inum.h" | 20 | #include "xfs_bit.h" |
36 | #include "xfs_log.h" | 21 | #include "xfs_log.h" |
22 | #include "xfs_inum.h" | ||
37 | #include "xfs_trans.h" | 23 | #include "xfs_trans.h" |
38 | #include "xfs_sb.h" | 24 | #include "xfs_sb.h" |
39 | #include "xfs_ag.h" | 25 | #include "xfs_ag.h" |
@@ -43,18 +29,17 @@ | |||
43 | #include "xfs_dmapi.h" | 29 | #include "xfs_dmapi.h" |
44 | #include "xfs_quota.h" | 30 | #include "xfs_quota.h" |
45 | #include "xfs_mount.h" | 31 | #include "xfs_mount.h" |
46 | #include "xfs_alloc_btree.h" | ||
47 | #include "xfs_bmap_btree.h" | 32 | #include "xfs_bmap_btree.h" |
33 | #include "xfs_alloc_btree.h" | ||
48 | #include "xfs_ialloc_btree.h" | 34 | #include "xfs_ialloc_btree.h" |
49 | #include "xfs_btree.h" | ||
50 | #include "xfs_ialloc.h" | ||
51 | #include "xfs_attr_sf.h" | ||
52 | #include "xfs_dir_sf.h" | 35 | #include "xfs_dir_sf.h" |
53 | #include "xfs_dir2_sf.h" | 36 | #include "xfs_dir2_sf.h" |
37 | #include "xfs_attr_sf.h" | ||
54 | #include "xfs_dinode.h" | 38 | #include "xfs_dinode.h" |
55 | #include "xfs_inode.h" | 39 | #include "xfs_inode.h" |
56 | #include "xfs_bmap.h" | 40 | #include "xfs_bmap.h" |
57 | #include "xfs_bit.h" | 41 | #include "xfs_btree.h" |
42 | #include "xfs_ialloc.h" | ||
58 | #include "xfs_rtalloc.h" | 43 | #include "xfs_rtalloc.h" |
59 | #include "xfs_error.h" | 44 | #include "xfs_error.h" |
60 | #include "xfs_itable.h" | 45 | #include "xfs_itable.h" |
@@ -65,10 +50,8 @@ | |||
65 | #include "xfs_attr.h" | 50 | #include "xfs_attr.h" |
66 | #include "xfs_buf_item.h" | 51 | #include "xfs_buf_item.h" |
67 | #include "xfs_trans_priv.h" | 52 | #include "xfs_trans_priv.h" |
68 | |||
69 | #include "xfs_qm.h" | 53 | #include "xfs_qm.h" |
70 | 54 | ||
71 | |||
72 | /* | 55 | /* |
73 | * returns the number of iovecs needed to log the given dquot item. | 56 | * returns the number of iovecs needed to log the given dquot item. |
74 | */ | 57 | */ |
@@ -467,7 +450,7 @@ xfs_qm_dquot_logitem_init( | |||
467 | lp->qli_item.li_mountp = dqp->q_mount; | 450 | lp->qli_item.li_mountp = dqp->q_mount; |
468 | lp->qli_dquot = dqp; | 451 | lp->qli_dquot = dqp; |
469 | lp->qli_format.qlf_type = XFS_LI_DQUOT; | 452 | lp->qli_format.qlf_type = XFS_LI_DQUOT; |
470 | lp->qli_format.qlf_id = INT_GET(dqp->q_core.d_id, ARCH_CONVERT); | 453 | lp->qli_format.qlf_id = be32_to_cpu(dqp->q_core.d_id); |
471 | lp->qli_format.qlf_blkno = dqp->q_blkno; | 454 | lp->qli_format.qlf_blkno = dqp->q_blkno; |
472 | lp->qli_format.qlf_len = 1; | 455 | lp->qli_format.qlf_len = 1; |
473 | /* | 456 | /* |
@@ -509,6 +492,7 @@ xfs_qm_qoff_logitem_format(xfs_qoff_logitem_t *qf, | |||
509 | 492 | ||
510 | log_vector->i_addr = (xfs_caddr_t)&(qf->qql_format); | 493 | log_vector->i_addr = (xfs_caddr_t)&(qf->qql_format); |
511 | log_vector->i_len = sizeof(xfs_qoff_logitem_t); | 494 | log_vector->i_len = sizeof(xfs_qoff_logitem_t); |
495 | XLOG_VEC_SET_TYPE(log_vector, XLOG_REG_TYPE_QUOTAOFF); | ||
512 | qf->qql_format.qf_size = 1; | 496 | qf->qql_format.qf_size = 1; |
513 | } | 497 | } |
514 | 498 | ||
diff --git a/fs/xfs/quota/xfs_dquot_item.h b/fs/xfs/quota/xfs_dquot_item.h index 9c6500dabcaa..5a632531f843 100644 --- a/fs/xfs/quota/xfs_dquot_item.h +++ b/fs/xfs/quota/xfs_dquot_item.h | |||
@@ -1,33 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | #ifndef __XFS_DQUOT_ITEM_H__ | 18 | #ifndef __XFS_DQUOT_ITEM_H__ |
33 | #define __XFS_DQUOT_ITEM_H__ | 19 | #define __XFS_DQUOT_ITEM_H__ |
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index f665ca8f9e96..1aea42d71a64 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -1,39 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | |||
33 | #include "xfs.h" | 18 | #include "xfs.h" |
34 | #include "xfs_fs.h" | 19 | #include "xfs_fs.h" |
35 | #include "xfs_inum.h" | 20 | #include "xfs_bit.h" |
36 | #include "xfs_log.h" | 21 | #include "xfs_log.h" |
22 | #include "xfs_inum.h" | ||
37 | #include "xfs_clnt.h" | 23 | #include "xfs_clnt.h" |
38 | #include "xfs_trans.h" | 24 | #include "xfs_trans.h" |
39 | #include "xfs_sb.h" | 25 | #include "xfs_sb.h" |
@@ -44,21 +30,20 @@ | |||
44 | #include "xfs_dmapi.h" | 30 | #include "xfs_dmapi.h" |
45 | #include "xfs_quota.h" | 31 | #include "xfs_quota.h" |
46 | #include "xfs_mount.h" | 32 | #include "xfs_mount.h" |
47 | #include "xfs_alloc_btree.h" | ||
48 | #include "xfs_bmap_btree.h" | 33 | #include "xfs_bmap_btree.h" |
34 | #include "xfs_alloc_btree.h" | ||
49 | #include "xfs_ialloc_btree.h" | 35 | #include "xfs_ialloc_btree.h" |
50 | #include "xfs_btree.h" | ||
51 | #include "xfs_ialloc.h" | ||
52 | #include "xfs_attr_sf.h" | ||
53 | #include "xfs_dir_sf.h" | 36 | #include "xfs_dir_sf.h" |
54 | #include "xfs_dir2_sf.h" | 37 | #include "xfs_dir2_sf.h" |
38 | #include "xfs_attr_sf.h" | ||
55 | #include "xfs_dinode.h" | 39 | #include "xfs_dinode.h" |
56 | #include "xfs_inode.h" | 40 | #include "xfs_inode.h" |
57 | #include "xfs_bmap.h" | 41 | #include "xfs_btree.h" |
58 | #include "xfs_bit.h" | 42 | #include "xfs_ialloc.h" |
43 | #include "xfs_itable.h" | ||
59 | #include "xfs_rtalloc.h" | 44 | #include "xfs_rtalloc.h" |
60 | #include "xfs_error.h" | 45 | #include "xfs_error.h" |
61 | #include "xfs_itable.h" | 46 | #include "xfs_bmap.h" |
62 | #include "xfs_rw.h" | 47 | #include "xfs_rw.h" |
63 | #include "xfs_acl.h" | 48 | #include "xfs_acl.h" |
64 | #include "xfs_cap.h" | 49 | #include "xfs_cap.h" |
@@ -67,7 +52,6 @@ | |||
67 | #include "xfs_buf_item.h" | 52 | #include "xfs_buf_item.h" |
68 | #include "xfs_trans_space.h" | 53 | #include "xfs_trans_space.h" |
69 | #include "xfs_utils.h" | 54 | #include "xfs_utils.h" |
70 | |||
71 | #include "xfs_qm.h" | 55 | #include "xfs_qm.h" |
72 | 56 | ||
73 | /* | 57 | /* |
@@ -76,8 +60,9 @@ | |||
76 | * quota functionality, including maintaining the freelist and hash | 60 | * quota functionality, including maintaining the freelist and hash |
77 | * tables of dquots. | 61 | * tables of dquots. |
78 | */ | 62 | */ |
79 | mutex_t xfs_Gqm_lock; | 63 | mutex_t xfs_Gqm_lock; |
80 | struct xfs_qm *xfs_Gqm; | 64 | struct xfs_qm *xfs_Gqm; |
65 | uint ndquot; | ||
81 | 66 | ||
82 | kmem_zone_t *qm_dqzone; | 67 | kmem_zone_t *qm_dqzone; |
83 | kmem_zone_t *qm_dqtrxzone; | 68 | kmem_zone_t *qm_dqtrxzone; |
@@ -107,10 +92,10 @@ extern mutex_t qcheck_lock; | |||
107 | for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \ | 92 | for (dqp = (l)->qh_next; dqp != NULL; dqp = dqp->NXT) { \ |
108 | cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \ | 93 | cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " \ |
109 | "bcnt = %d, icnt = %d, refs = %d", \ | 94 | "bcnt = %d, icnt = %d, refs = %d", \ |
110 | ++i, (int) INT_GET(dqp->q_core.d_id, ARCH_CONVERT), \ | 95 | ++i, (int) be32_to_cpu(dqp->q_core.d_id), \ |
111 | DQFLAGTO_TYPESTR(dqp), \ | 96 | DQFLAGTO_TYPESTR(dqp), \ |
112 | (int) INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), \ | 97 | (int) be64_to_cpu(dqp->q_core.d_bcount), \ |
113 | (int) INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), \ | 98 | (int) be64_to_cpu(dqp->q_core.d_icount), \ |
114 | (int) dqp->q_nrefs); } \ | 99 | (int) dqp->q_nrefs); } \ |
115 | } | 100 | } |
116 | #else | 101 | #else |
@@ -124,25 +109,25 @@ extern mutex_t qcheck_lock; | |||
124 | STATIC struct xfs_qm * | 109 | STATIC struct xfs_qm * |
125 | xfs_Gqm_init(void) | 110 | xfs_Gqm_init(void) |
126 | { | 111 | { |
127 | xfs_qm_t *xqm; | 112 | xfs_dqhash_t *udqhash, *gdqhash; |
128 | int hsize, i; | 113 | xfs_qm_t *xqm; |
129 | 114 | uint i, hsize, flags = KM_SLEEP | KM_MAYFAIL; | |
130 | xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP); | ||
131 | ASSERT(xqm); | ||
132 | 115 | ||
133 | /* | 116 | /* |
134 | * Initialize the dquot hash tables. | 117 | * Initialize the dquot hash tables. |
135 | */ | 118 | */ |
136 | hsize = (DQUOT_HASH_HEURISTIC < XFS_QM_NCSIZE_THRESHOLD) ? | 119 | hsize = XFS_QM_HASHSIZE_HIGH; |
137 | XFS_QM_HASHSIZE_LOW : XFS_QM_HASHSIZE_HIGH; | 120 | while (!(udqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), flags))) { |
138 | xqm->qm_dqhashmask = hsize - 1; | 121 | if ((hsize >>= 1) <= XFS_QM_HASHSIZE_LOW) |
122 | flags = KM_SLEEP; | ||
123 | } | ||
124 | gdqhash = kmem_zalloc(hsize * sizeof(xfs_dqhash_t), KM_SLEEP); | ||
125 | ndquot = hsize << 8; | ||
139 | 126 | ||
140 | xqm->qm_usr_dqhtable = (xfs_dqhash_t *)kmem_zalloc(hsize * | 127 | xqm = kmem_zalloc(sizeof(xfs_qm_t), KM_SLEEP); |
141 | sizeof(xfs_dqhash_t), | 128 | xqm->qm_dqhashmask = hsize - 1; |
142 | KM_SLEEP); | 129 | xqm->qm_usr_dqhtable = udqhash; |
143 | xqm->qm_grp_dqhtable = (xfs_dqhash_t *)kmem_zalloc(hsize * | 130 | xqm->qm_grp_dqhtable = gdqhash; |
144 | sizeof(xfs_dqhash_t), | ||
145 | KM_SLEEP); | ||
146 | ASSERT(xqm->qm_usr_dqhtable != NULL); | 131 | ASSERT(xqm->qm_usr_dqhtable != NULL); |
147 | ASSERT(xqm->qm_grp_dqhtable != NULL); | 132 | ASSERT(xqm->qm_grp_dqhtable != NULL); |
148 | 133 | ||
@@ -365,16 +350,6 @@ xfs_qm_mount_quotas( | |||
365 | int error = 0; | 350 | int error = 0; |
366 | uint sbf; | 351 | uint sbf; |
367 | 352 | ||
368 | /* | ||
369 | * If a file system had quotas running earlier, but decided to | ||
370 | * mount without -o uquota/pquota/gquota options, revoke the | ||
371 | * quotachecked license, and bail out. | ||
372 | */ | ||
373 | if (! XFS_IS_QUOTA_ON(mp) && | ||
374 | (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT)) { | ||
375 | mp->m_qflags = 0; | ||
376 | goto write_changes; | ||
377 | } | ||
378 | 353 | ||
379 | /* | 354 | /* |
380 | * If quotas on realtime volumes is not supported, we disable | 355 | * If quotas on realtime volumes is not supported, we disable |
@@ -388,11 +363,8 @@ xfs_qm_mount_quotas( | |||
388 | goto write_changes; | 363 | goto write_changes; |
389 | } | 364 | } |
390 | 365 | ||
391 | #if defined(DEBUG) && defined(XFS_LOUD_RECOVERY) | ||
392 | cmn_err(CE_NOTE, "Attempting to turn on disk quotas."); | ||
393 | #endif | ||
394 | |||
395 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); | 366 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); |
367 | |||
396 | /* | 368 | /* |
397 | * Allocate the quotainfo structure inside the mount struct, and | 369 | * Allocate the quotainfo structure inside the mount struct, and |
398 | * create quotainode(s), and change/rev superblock if necessary. | 370 | * create quotainode(s), and change/rev superblock if necessary. |
@@ -410,19 +382,14 @@ xfs_qm_mount_quotas( | |||
410 | */ | 382 | */ |
411 | if (XFS_QM_NEED_QUOTACHECK(mp) && | 383 | if (XFS_QM_NEED_QUOTACHECK(mp) && |
412 | !(mfsi_flags & XFS_MFSI_NO_QUOTACHECK)) { | 384 | !(mfsi_flags & XFS_MFSI_NO_QUOTACHECK)) { |
413 | #ifdef DEBUG | ||
414 | cmn_err(CE_NOTE, "Doing a quotacheck. Please wait."); | ||
415 | #endif | ||
416 | if ((error = xfs_qm_quotacheck(mp))) { | 385 | if ((error = xfs_qm_quotacheck(mp))) { |
417 | /* Quotacheck has failed and quotas have | 386 | /* Quotacheck has failed and quotas have |
418 | * been disabled. | 387 | * been disabled. |
419 | */ | 388 | */ |
420 | return XFS_ERROR(error); | 389 | return XFS_ERROR(error); |
421 | } | 390 | } |
422 | #ifdef DEBUG | ||
423 | cmn_err(CE_NOTE, "Done quotacheck."); | ||
424 | #endif | ||
425 | } | 391 | } |
392 | |||
426 | write_changes: | 393 | write_changes: |
427 | /* | 394 | /* |
428 | * We actually don't have to acquire the SB_LOCK at all. | 395 | * We actually don't have to acquire the SB_LOCK at all. |
@@ -761,7 +728,7 @@ xfs_qm_dqattach_one( | |||
761 | */ | 728 | */ |
762 | if (udqhint && | 729 | if (udqhint && |
763 | (dqp = udqhint->q_gdquot) && | 730 | (dqp = udqhint->q_gdquot) && |
764 | (INT_GET(dqp->q_core.d_id, ARCH_CONVERT) == id)) { | 731 | (be32_to_cpu(dqp->q_core.d_id) == id)) { |
765 | ASSERT(XFS_DQ_IS_LOCKED(udqhint)); | 732 | ASSERT(XFS_DQ_IS_LOCKED(udqhint)); |
766 | xfs_dqlock(dqp); | 733 | xfs_dqlock(dqp); |
767 | XFS_DQHOLD(dqp); | 734 | XFS_DQHOLD(dqp); |
@@ -1231,42 +1198,24 @@ xfs_qm_init_quotainfo( | |||
1231 | * a user or group before he or she can not perform any | 1198 | * a user or group before he or she can not perform any |
1232 | * more writing. If it is zero, a default is used. | 1199 | * more writing. If it is zero, a default is used. |
1233 | */ | 1200 | */ |
1234 | qinf->qi_btimelimit = | 1201 | qinf->qi_btimelimit = ddqp->d_btimer ? |
1235 | INT_GET(ddqp->d_btimer, ARCH_CONVERT) ? | 1202 | be32_to_cpu(ddqp->d_btimer) : XFS_QM_BTIMELIMIT; |
1236 | INT_GET(ddqp->d_btimer, ARCH_CONVERT) : | 1203 | qinf->qi_itimelimit = ddqp->d_itimer ? |
1237 | XFS_QM_BTIMELIMIT; | 1204 | be32_to_cpu(ddqp->d_itimer) : XFS_QM_ITIMELIMIT; |
1238 | qinf->qi_itimelimit = | 1205 | qinf->qi_rtbtimelimit = ddqp->d_rtbtimer ? |
1239 | INT_GET(ddqp->d_itimer, ARCH_CONVERT) ? | 1206 | be32_to_cpu(ddqp->d_rtbtimer) : XFS_QM_RTBTIMELIMIT; |
1240 | INT_GET(ddqp->d_itimer, ARCH_CONVERT) : | 1207 | qinf->qi_bwarnlimit = ddqp->d_bwarns ? |
1241 | XFS_QM_ITIMELIMIT; | 1208 | be16_to_cpu(ddqp->d_bwarns) : XFS_QM_BWARNLIMIT; |
1242 | qinf->qi_rtbtimelimit = | 1209 | qinf->qi_iwarnlimit = ddqp->d_iwarns ? |
1243 | INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) ? | 1210 | be16_to_cpu(ddqp->d_iwarns) : XFS_QM_IWARNLIMIT; |
1244 | INT_GET(ddqp->d_rtbtimer, ARCH_CONVERT) : | 1211 | qinf->qi_rtbwarnlimit = ddqp->d_rtbwarns ? |
1245 | XFS_QM_RTBTIMELIMIT; | 1212 | be16_to_cpu(ddqp->d_rtbwarns) : XFS_QM_RTBWARNLIMIT; |
1246 | qinf->qi_bwarnlimit = | 1213 | qinf->qi_bhardlimit = be64_to_cpu(ddqp->d_blk_hardlimit); |
1247 | INT_GET(ddqp->d_bwarns, ARCH_CONVERT) ? | 1214 | qinf->qi_bsoftlimit = be64_to_cpu(ddqp->d_blk_softlimit); |
1248 | INT_GET(ddqp->d_bwarns, ARCH_CONVERT) : | 1215 | qinf->qi_ihardlimit = be64_to_cpu(ddqp->d_ino_hardlimit); |
1249 | XFS_QM_BWARNLIMIT; | 1216 | qinf->qi_isoftlimit = be64_to_cpu(ddqp->d_ino_softlimit); |
1250 | qinf->qi_iwarnlimit = | 1217 | qinf->qi_rtbhardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit); |
1251 | INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ? | 1218 | qinf->qi_rtbsoftlimit = be64_to_cpu(ddqp->d_rtb_softlimit); |
1252 | INT_GET(ddqp->d_iwarns, ARCH_CONVERT) : | ||
1253 | XFS_QM_IWARNLIMIT; | ||
1254 | qinf->qi_rtbwarnlimit = | ||
1255 | INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) ? | ||
1256 | INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) : | ||
1257 | XFS_QM_RTBWARNLIMIT; | ||
1258 | qinf->qi_bhardlimit = | ||
1259 | INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT); | ||
1260 | qinf->qi_bsoftlimit = | ||
1261 | INT_GET(ddqp->d_blk_softlimit, ARCH_CONVERT); | ||
1262 | qinf->qi_ihardlimit = | ||
1263 | INT_GET(ddqp->d_ino_hardlimit, ARCH_CONVERT); | ||
1264 | qinf->qi_isoftlimit = | ||
1265 | INT_GET(ddqp->d_ino_softlimit, ARCH_CONVERT); | ||
1266 | qinf->qi_rtbhardlimit = | ||
1267 | INT_GET(ddqp->d_rtb_hardlimit, ARCH_CONVERT); | ||
1268 | qinf->qi_rtbsoftlimit = | ||
1269 | INT_GET(ddqp->d_rtb_softlimit, ARCH_CONVERT); | ||
1270 | 1219 | ||
1271 | /* | 1220 | /* |
1272 | * We sent the XFS_QMOPT_DQSUSER flag to dqget because | 1221 | * We sent the XFS_QMOPT_DQSUSER flag to dqget because |
@@ -1545,15 +1494,15 @@ xfs_qm_reset_dqcounts( | |||
1545 | */ | 1494 | */ |
1546 | (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR, | 1495 | (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR, |
1547 | "xfs_quotacheck"); | 1496 | "xfs_quotacheck"); |
1548 | INT_SET(ddq->d_bcount, ARCH_CONVERT, 0ULL); | 1497 | ddq->d_bcount = 0; |
1549 | INT_SET(ddq->d_icount, ARCH_CONVERT, 0ULL); | 1498 | ddq->d_icount = 0; |
1550 | INT_SET(ddq->d_rtbcount, ARCH_CONVERT, 0ULL); | 1499 | ddq->d_rtbcount = 0; |
1551 | INT_SET(ddq->d_btimer, ARCH_CONVERT, (time_t)0); | 1500 | ddq->d_btimer = 0; |
1552 | INT_SET(ddq->d_itimer, ARCH_CONVERT, (time_t)0); | 1501 | ddq->d_itimer = 0; |
1553 | INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, (time_t)0); | 1502 | ddq->d_rtbtimer = 0; |
1554 | INT_SET(ddq->d_bwarns, ARCH_CONVERT, 0UL); | 1503 | ddq->d_bwarns = 0; |
1555 | INT_SET(ddq->d_iwarns, ARCH_CONVERT, 0UL); | 1504 | ddq->d_iwarns = 0; |
1556 | INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, 0UL); | 1505 | ddq->d_rtbwarns = 0; |
1557 | ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1); | 1506 | ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1); |
1558 | } | 1507 | } |
1559 | 1508 | ||
@@ -1726,14 +1675,14 @@ xfs_qm_quotacheck_dqadjust( | |||
1726 | * Adjust the inode count and the block count to reflect this inode's | 1675 | * Adjust the inode count and the block count to reflect this inode's |
1727 | * resource usage. | 1676 | * resource usage. |
1728 | */ | 1677 | */ |
1729 | INT_MOD(dqp->q_core.d_icount, ARCH_CONVERT, +1); | 1678 | be64_add(&dqp->q_core.d_icount, 1); |
1730 | dqp->q_res_icount++; | 1679 | dqp->q_res_icount++; |
1731 | if (nblks) { | 1680 | if (nblks) { |
1732 | INT_MOD(dqp->q_core.d_bcount, ARCH_CONVERT, nblks); | 1681 | be64_add(&dqp->q_core.d_bcount, nblks); |
1733 | dqp->q_res_bcount += nblks; | 1682 | dqp->q_res_bcount += nblks; |
1734 | } | 1683 | } |
1735 | if (rtblks) { | 1684 | if (rtblks) { |
1736 | INT_MOD(dqp->q_core.d_rtbcount, ARCH_CONVERT, rtblks); | 1685 | be64_add(&dqp->q_core.d_rtbcount, rtblks); |
1737 | dqp->q_res_rtbcount += rtblks; | 1686 | dqp->q_res_rtbcount += rtblks; |
1738 | } | 1687 | } |
1739 | 1688 | ||
@@ -2010,7 +1959,7 @@ xfs_qm_quotacheck( | |||
2010 | ASSERT(mp->m_quotainfo != NULL); | 1959 | ASSERT(mp->m_quotainfo != NULL); |
2011 | ASSERT(xfs_Gqm != NULL); | 1960 | ASSERT(xfs_Gqm != NULL); |
2012 | xfs_qm_destroy_quotainfo(mp); | 1961 | xfs_qm_destroy_quotainfo(mp); |
2013 | xfs_mount_reset_sbqflags(mp); | 1962 | (void)xfs_mount_reset_sbqflags(mp); |
2014 | } else { | 1963 | } else { |
2015 | cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname); | 1964 | cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname); |
2016 | } | 1965 | } |
@@ -2220,7 +2169,7 @@ xfs_qm_shake_freelist( | |||
2220 | xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING"); | 2169 | xfs_dqtrace_entry(dqp, "DQSHAKE: UNLINKING"); |
2221 | #ifdef QUOTADEBUG | 2170 | #ifdef QUOTADEBUG |
2222 | cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n", | 2171 | cmn_err(CE_DEBUG, "Shake 0x%p, ID 0x%x\n", |
2223 | dqp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); | 2172 | dqp, be32_to_cpu(dqp->q_core.d_id)); |
2224 | #endif | 2173 | #endif |
2225 | ASSERT(dqp->q_nrefs == 0); | 2174 | ASSERT(dqp->q_nrefs == 0); |
2226 | nextdqp = dqp->dq_flnext; | 2175 | nextdqp = dqp->dq_flnext; |
@@ -2688,7 +2637,7 @@ xfs_qm_vop_chown_reserve( | |||
2688 | XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; | 2637 | XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; |
2689 | 2638 | ||
2690 | if (XFS_IS_UQUOTA_ON(mp) && udqp && | 2639 | if (XFS_IS_UQUOTA_ON(mp) && udqp && |
2691 | ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) { | 2640 | ip->i_d.di_uid != (uid_t)be32_to_cpu(udqp->q_core.d_id)) { |
2692 | delblksudq = udqp; | 2641 | delblksudq = udqp; |
2693 | /* | 2642 | /* |
2694 | * If there are delayed allocation blocks, then we have to | 2643 | * If there are delayed allocation blocks, then we have to |
@@ -2701,10 +2650,10 @@ xfs_qm_vop_chown_reserve( | |||
2701 | } | 2650 | } |
2702 | } | 2651 | } |
2703 | if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) { | 2652 | if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) { |
2704 | if ((XFS_IS_GQUOTA_ON(ip->i_mount) && ip->i_d.di_gid != | 2653 | if ((XFS_IS_GQUOTA_ON(ip->i_mount) && |
2705 | INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)) || | 2654 | ip->i_d.di_gid != be32_to_cpu(gdqp->q_core.d_id)) || |
2706 | (XFS_IS_PQUOTA_ON(ip->i_mount) && ip->i_d.di_projid != | 2655 | (XFS_IS_PQUOTA_ON(ip->i_mount) && |
2707 | INT_GET(gdqp->q_core.d_id, ARCH_CONVERT))) { | 2656 | ip->i_d.di_projid != be32_to_cpu(gdqp->q_core.d_id))) { |
2708 | delblksgdq = gdqp; | 2657 | delblksgdq = gdqp; |
2709 | if (delblks) { | 2658 | if (delblks) { |
2710 | ASSERT(ip->i_gdquot); | 2659 | ASSERT(ip->i_gdquot); |
@@ -2794,7 +2743,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode( | |||
2794 | xfs_dqunlock(udqp); | 2743 | xfs_dqunlock(udqp); |
2795 | ASSERT(ip->i_udquot == NULL); | 2744 | ASSERT(ip->i_udquot == NULL); |
2796 | ip->i_udquot = udqp; | 2745 | ip->i_udquot = udqp; |
2797 | ASSERT(ip->i_d.di_uid == INT_GET(udqp->q_core.d_id, ARCH_CONVERT)); | 2746 | ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id)); |
2798 | xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1); | 2747 | xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1); |
2799 | } | 2748 | } |
2800 | if (gdqp) { | 2749 | if (gdqp) { |
@@ -2803,7 +2752,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode( | |||
2803 | xfs_dqunlock(gdqp); | 2752 | xfs_dqunlock(gdqp); |
2804 | ASSERT(ip->i_gdquot == NULL); | 2753 | ASSERT(ip->i_gdquot == NULL); |
2805 | ip->i_gdquot = gdqp; | 2754 | ip->i_gdquot = gdqp; |
2806 | ASSERT(ip->i_d.di_gid == INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)); | 2755 | ASSERT(ip->i_d.di_gid == be32_to_cpu(gdqp->q_core.d_id)); |
2807 | xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1); | 2756 | xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1); |
2808 | } | 2757 | } |
2809 | } | 2758 | } |
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h index b03eecf3b6cb..12da259f2fcb 100644 --- a/fs/xfs/quota/xfs_qm.h +++ b/fs/xfs/quota/xfs_qm.h | |||
@@ -1,33 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | #ifndef __XFS_QM_H__ | 18 | #ifndef __XFS_QM_H__ |
33 | #define __XFS_QM_H__ | 19 | #define __XFS_QM_H__ |
@@ -40,6 +26,7 @@ | |||
40 | struct xfs_qm; | 26 | struct xfs_qm; |
41 | struct xfs_inode; | 27 | struct xfs_inode; |
42 | 28 | ||
29 | extern uint ndquot; | ||
43 | extern mutex_t xfs_Gqm_lock; | 30 | extern mutex_t xfs_Gqm_lock; |
44 | extern struct xfs_qm *xfs_Gqm; | 31 | extern struct xfs_qm *xfs_Gqm; |
45 | extern kmem_zone_t *qm_dqzone; | 32 | extern kmem_zone_t *qm_dqzone; |
@@ -65,9 +52,8 @@ extern kmem_zone_t *qm_dqtrxzone; | |||
65 | /* | 52 | /* |
66 | * Dquot hashtable constants/threshold values. | 53 | * Dquot hashtable constants/threshold values. |
67 | */ | 54 | */ |
68 | #define XFS_QM_NCSIZE_THRESHOLD 5000 | 55 | #define XFS_QM_HASHSIZE_LOW (NBPP / sizeof(xfs_dqhash_t)) |
69 | #define XFS_QM_HASHSIZE_LOW 32 | 56 | #define XFS_QM_HASHSIZE_HIGH ((NBPP * 4) / sizeof(xfs_dqhash_t)) |
70 | #define XFS_QM_HASHSIZE_HIGH 64 | ||
71 | 57 | ||
72 | /* | 58 | /* |
73 | * We output a cmn_err when quotachecking a quota file with more than | 59 | * We output a cmn_err when quotachecking a quota file with more than |
@@ -184,8 +170,6 @@ typedef struct xfs_dquot_acct { | |||
184 | #define XFS_QM_HOLD(xqm) ((xqm)->qm_nrefs++) | 170 | #define XFS_QM_HOLD(xqm) ((xqm)->qm_nrefs++) |
185 | #define XFS_QM_RELE(xqm) ((xqm)->qm_nrefs--) | 171 | #define XFS_QM_RELE(xqm) ((xqm)->qm_nrefs--) |
186 | 172 | ||
187 | extern void xfs_mount_reset_sbqflags(xfs_mount_t *); | ||
188 | |||
189 | extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); | 173 | extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); |
190 | extern int xfs_qm_mount_quotas(xfs_mount_t *, int); | 174 | extern int xfs_qm_mount_quotas(xfs_mount_t *, int); |
191 | extern void xfs_qm_mount_quotainit(xfs_mount_t *, uint); | 175 | extern void xfs_qm_mount_quotainit(xfs_mount_t *, uint); |
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/quota/xfs_qm_bhv.c index dc3c37a1e158..d9d2993de435 100644 --- a/fs/xfs/quota/xfs_qm_bhv.c +++ b/fs/xfs/quota/xfs_qm_bhv.c | |||
@@ -1,70 +1,55 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | |||
33 | #include "xfs.h" | 18 | #include "xfs.h" |
34 | #include "xfs_fs.h" | 19 | #include "xfs_fs.h" |
35 | #include "xfs_inum.h" | 20 | #include "xfs_bit.h" |
36 | #include "xfs_log.h" | 21 | #include "xfs_log.h" |
22 | #include "xfs_inum.h" | ||
37 | #include "xfs_clnt.h" | 23 | #include "xfs_clnt.h" |
38 | #include "xfs_trans.h" | 24 | #include "xfs_trans.h" |
39 | #include "xfs_sb.h" | 25 | #include "xfs_sb.h" |
26 | #include "xfs_ag.h" | ||
40 | #include "xfs_dir.h" | 27 | #include "xfs_dir.h" |
41 | #include "xfs_dir2.h" | 28 | #include "xfs_dir2.h" |
42 | #include "xfs_alloc.h" | 29 | #include "xfs_alloc.h" |
43 | #include "xfs_dmapi.h" | 30 | #include "xfs_dmapi.h" |
44 | #include "xfs_quota.h" | 31 | #include "xfs_quota.h" |
45 | #include "xfs_mount.h" | 32 | #include "xfs_mount.h" |
46 | #include "xfs_alloc_btree.h" | ||
47 | #include "xfs_bmap_btree.h" | 33 | #include "xfs_bmap_btree.h" |
34 | #include "xfs_alloc_btree.h" | ||
48 | #include "xfs_ialloc_btree.h" | 35 | #include "xfs_ialloc_btree.h" |
49 | #include "xfs_btree.h" | ||
50 | #include "xfs_ialloc.h" | ||
51 | #include "xfs_attr_sf.h" | ||
52 | #include "xfs_dir_sf.h" | 36 | #include "xfs_dir_sf.h" |
53 | #include "xfs_dir2_sf.h" | 37 | #include "xfs_dir2_sf.h" |
38 | #include "xfs_attr_sf.h" | ||
54 | #include "xfs_dinode.h" | 39 | #include "xfs_dinode.h" |
55 | #include "xfs_inode.h" | 40 | #include "xfs_inode.h" |
41 | #include "xfs_ialloc.h" | ||
42 | #include "xfs_itable.h" | ||
43 | #include "xfs_btree.h" | ||
56 | #include "xfs_bmap.h" | 44 | #include "xfs_bmap.h" |
57 | #include "xfs_bit.h" | ||
58 | #include "xfs_rtalloc.h" | 45 | #include "xfs_rtalloc.h" |
59 | #include "xfs_error.h" | 46 | #include "xfs_error.h" |
60 | #include "xfs_itable.h" | ||
61 | #include "xfs_rw.h" | 47 | #include "xfs_rw.h" |
62 | #include "xfs_acl.h" | 48 | #include "xfs_acl.h" |
63 | #include "xfs_cap.h" | 49 | #include "xfs_cap.h" |
64 | #include "xfs_mac.h" | 50 | #include "xfs_mac.h" |
65 | #include "xfs_attr.h" | 51 | #include "xfs_attr.h" |
66 | #include "xfs_buf_item.h" | 52 | #include "xfs_buf_item.h" |
67 | |||
68 | #include "xfs_qm.h" | 53 | #include "xfs_qm.h" |
69 | 54 | ||
70 | #define MNTOPT_QUOTA "quota" /* disk quotas (user) */ | 55 | #define MNTOPT_QUOTA "quota" /* disk quotas (user) */ |
@@ -229,48 +214,6 @@ xfs_qm_syncall( | |||
229 | return error; | 214 | return error; |
230 | } | 215 | } |
231 | 216 | ||
232 | /* | ||
233 | * Clear the quotaflags in memory and in the superblock. | ||
234 | */ | ||
235 | void | ||
236 | xfs_mount_reset_sbqflags( | ||
237 | xfs_mount_t *mp) | ||
238 | { | ||
239 | xfs_trans_t *tp; | ||
240 | unsigned long s; | ||
241 | |||
242 | mp->m_qflags = 0; | ||
243 | /* | ||
244 | * It is OK to look at sb_qflags here in mount path, | ||
245 | * without SB_LOCK. | ||
246 | */ | ||
247 | if (mp->m_sb.sb_qflags == 0) | ||
248 | return; | ||
249 | s = XFS_SB_LOCK(mp); | ||
250 | mp->m_sb.sb_qflags = 0; | ||
251 | XFS_SB_UNLOCK(mp, s); | ||
252 | |||
253 | /* | ||
254 | * if the fs is readonly, let the incore superblock run | ||
255 | * with quotas off but don't flush the update out to disk | ||
256 | */ | ||
257 | if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) | ||
258 | return; | ||
259 | #ifdef QUOTADEBUG | ||
260 | xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes"); | ||
261 | #endif | ||
262 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); | ||
263 | if (xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, | ||
264 | XFS_DEFAULT_LOG_COUNT)) { | ||
265 | xfs_trans_cancel(tp, 0); | ||
266 | xfs_fs_cmn_err(CE_ALERT, mp, | ||
267 | "xfs_mount_reset_sbqflags: Superblock update failed!"); | ||
268 | return; | ||
269 | } | ||
270 | xfs_mod_sb(tp, XFS_SB_QFLAGS); | ||
271 | xfs_trans_commit(tp, 0, NULL); | ||
272 | } | ||
273 | |||
274 | STATIC int | 217 | STATIC int |
275 | xfs_qm_newmount( | 218 | xfs_qm_newmount( |
276 | xfs_mount_t *mp, | 219 | xfs_mount_t *mp, |
diff --git a/fs/xfs/quota/xfs_qm_stats.c b/fs/xfs/quota/xfs_qm_stats.c index 29978e037fee..0570f7733550 100644 --- a/fs/xfs/quota/xfs_qm_stats.c +++ b/fs/xfs/quota/xfs_qm_stats.c | |||
@@ -1,69 +1,54 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | |||
33 | #include "xfs.h" | 18 | #include "xfs.h" |
34 | #include "xfs_fs.h" | 19 | #include "xfs_fs.h" |
35 | #include "xfs_inum.h" | 20 | #include "xfs_bit.h" |
36 | #include "xfs_log.h" | 21 | #include "xfs_log.h" |
22 | #include "xfs_inum.h" | ||
37 | #include "xfs_trans.h" | 23 | #include "xfs_trans.h" |
38 | #include "xfs_sb.h" | 24 | #include "xfs_sb.h" |
25 | #include "xfs_ag.h" | ||
39 | #include "xfs_dir.h" | 26 | #include "xfs_dir.h" |
40 | #include "xfs_dir2.h" | 27 | #include "xfs_dir2.h" |
41 | #include "xfs_alloc.h" | 28 | #include "xfs_alloc.h" |
42 | #include "xfs_dmapi.h" | 29 | #include "xfs_dmapi.h" |
43 | #include "xfs_quota.h" | 30 | #include "xfs_quota.h" |
44 | #include "xfs_mount.h" | 31 | #include "xfs_mount.h" |
45 | #include "xfs_alloc_btree.h" | ||
46 | #include "xfs_bmap_btree.h" | 32 | #include "xfs_bmap_btree.h" |
33 | #include "xfs_alloc_btree.h" | ||
47 | #include "xfs_ialloc_btree.h" | 34 | #include "xfs_ialloc_btree.h" |
48 | #include "xfs_btree.h" | ||
49 | #include "xfs_ialloc.h" | ||
50 | #include "xfs_attr_sf.h" | ||
51 | #include "xfs_dir_sf.h" | 35 | #include "xfs_dir_sf.h" |
52 | #include "xfs_dir2_sf.h" | 36 | #include "xfs_dir2_sf.h" |
37 | #include "xfs_attr_sf.h" | ||
53 | #include "xfs_dinode.h" | 38 | #include "xfs_dinode.h" |
54 | #include "xfs_inode.h" | 39 | #include "xfs_inode.h" |
40 | #include "xfs_ialloc.h" | ||
41 | #include "xfs_itable.h" | ||
55 | #include "xfs_bmap.h" | 42 | #include "xfs_bmap.h" |
56 | #include "xfs_bit.h" | 43 | #include "xfs_btree.h" |
57 | #include "xfs_rtalloc.h" | 44 | #include "xfs_rtalloc.h" |
58 | #include "xfs_error.h" | 45 | #include "xfs_error.h" |
59 | #include "xfs_itable.h" | ||
60 | #include "xfs_rw.h" | 46 | #include "xfs_rw.h" |
61 | #include "xfs_acl.h" | 47 | #include "xfs_acl.h" |
62 | #include "xfs_cap.h" | 48 | #include "xfs_cap.h" |
63 | #include "xfs_mac.h" | 49 | #include "xfs_mac.h" |
64 | #include "xfs_attr.h" | 50 | #include "xfs_attr.h" |
65 | #include "xfs_buf_item.h" | 51 | #include "xfs_buf_item.h" |
66 | |||
67 | #include "xfs_qm.h" | 52 | #include "xfs_qm.h" |
68 | 53 | ||
69 | struct xqmstats xqmstats; | 54 | struct xqmstats xqmstats; |
diff --git a/fs/xfs/quota/xfs_qm_stats.h b/fs/xfs/quota/xfs_qm_stats.h index 8093c5c284ec..a50ffabcf554 100644 --- a/fs/xfs/quota/xfs_qm_stats.h +++ b/fs/xfs/quota/xfs_qm_stats.h | |||
@@ -1,38 +1,23 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2002 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2002 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | #ifndef __XFS_QM_STATS_H__ | 18 | #ifndef __XFS_QM_STATS_H__ |
33 | #define __XFS_QM_STATS_H__ | 19 | #define __XFS_QM_STATS_H__ |
34 | 20 | ||
35 | |||
36 | #if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF) | 21 | #if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF) |
37 | 22 | ||
38 | /* | 23 | /* |
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c index 68e98962dbef..24690e1af659 100644 --- a/fs/xfs/quota/xfs_qm_syscalls.c +++ b/fs/xfs/quota/xfs_qm_syscalls.c | |||
@@ -1,62 +1,48 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | |||
33 | #include "xfs.h" | 18 | #include "xfs.h" |
34 | #include "xfs_fs.h" | 19 | #include "xfs_fs.h" |
35 | #include "xfs_inum.h" | 20 | #include "xfs_bit.h" |
36 | #include "xfs_log.h" | 21 | #include "xfs_log.h" |
22 | #include "xfs_inum.h" | ||
37 | #include "xfs_trans.h" | 23 | #include "xfs_trans.h" |
38 | #include "xfs_sb.h" | 24 | #include "xfs_sb.h" |
25 | #include "xfs_ag.h" | ||
39 | #include "xfs_dir.h" | 26 | #include "xfs_dir.h" |
40 | #include "xfs_dir2.h" | 27 | #include "xfs_dir2.h" |
41 | #include "xfs_alloc.h" | 28 | #include "xfs_alloc.h" |
42 | #include "xfs_dmapi.h" | 29 | #include "xfs_dmapi.h" |
43 | #include "xfs_quota.h" | 30 | #include "xfs_quota.h" |
44 | #include "xfs_mount.h" | 31 | #include "xfs_mount.h" |
45 | #include "xfs_alloc_btree.h" | ||
46 | #include "xfs_bmap_btree.h" | 32 | #include "xfs_bmap_btree.h" |
33 | #include "xfs_alloc_btree.h" | ||
47 | #include "xfs_ialloc_btree.h" | 34 | #include "xfs_ialloc_btree.h" |
48 | #include "xfs_btree.h" | ||
49 | #include "xfs_ialloc.h" | ||
50 | #include "xfs_attr_sf.h" | ||
51 | #include "xfs_dir_sf.h" | 35 | #include "xfs_dir_sf.h" |
52 | #include "xfs_dir2_sf.h" | 36 | #include "xfs_dir2_sf.h" |
37 | #include "xfs_attr_sf.h" | ||
53 | #include "xfs_dinode.h" | 38 | #include "xfs_dinode.h" |
54 | #include "xfs_inode.h" | 39 | #include "xfs_inode.h" |
40 | #include "xfs_ialloc.h" | ||
41 | #include "xfs_itable.h" | ||
55 | #include "xfs_bmap.h" | 42 | #include "xfs_bmap.h" |
56 | #include "xfs_bit.h" | 43 | #include "xfs_btree.h" |
57 | #include "xfs_rtalloc.h" | 44 | #include "xfs_rtalloc.h" |
58 | #include "xfs_error.h" | 45 | #include "xfs_error.h" |
59 | #include "xfs_itable.h" | ||
60 | #include "xfs_rw.h" | 46 | #include "xfs_rw.h" |
61 | #include "xfs_acl.h" | 47 | #include "xfs_acl.h" |
62 | #include "xfs_cap.h" | 48 | #include "xfs_cap.h" |
@@ -64,7 +50,6 @@ | |||
64 | #include "xfs_attr.h" | 50 | #include "xfs_attr.h" |
65 | #include "xfs_buf_item.h" | 51 | #include "xfs_buf_item.h" |
66 | #include "xfs_utils.h" | 52 | #include "xfs_utils.h" |
67 | |||
68 | #include "xfs_qm.h" | 53 | #include "xfs_qm.h" |
69 | 54 | ||
70 | #ifdef DEBUG | 55 | #ifdef DEBUG |
@@ -109,10 +94,7 @@ xfs_qm_quotactl( | |||
109 | vfsp = bhvtovfs(bdp); | 94 | vfsp = bhvtovfs(bdp); |
110 | mp = XFS_VFSTOM(vfsp); | 95 | mp = XFS_VFSTOM(vfsp); |
111 | 96 | ||
112 | if (addr == NULL && cmd != Q_SYNC) | 97 | ASSERT(addr != NULL || cmd == Q_XQUOTASYNC); |
113 | return XFS_ERROR(EINVAL); | ||
114 | if (id < 0 && cmd != Q_SYNC) | ||
115 | return XFS_ERROR(EINVAL); | ||
116 | 98 | ||
117 | /* | 99 | /* |
118 | * The following commands are valid even when quotaoff. | 100 | * The following commands are valid even when quotaoff. |
@@ -122,7 +104,7 @@ xfs_qm_quotactl( | |||
122 | /* | 104 | /* |
123 | * Truncate quota files. quota must be off. | 105 | * Truncate quota files. quota must be off. |
124 | */ | 106 | */ |
125 | if (XFS_IS_QUOTA_ON(mp) || addr == NULL) | 107 | if (XFS_IS_QUOTA_ON(mp)) |
126 | return XFS_ERROR(EINVAL); | 108 | return XFS_ERROR(EINVAL); |
127 | if (vfsp->vfs_flag & VFS_RDONLY) | 109 | if (vfsp->vfs_flag & VFS_RDONLY) |
128 | return XFS_ERROR(EROFS); | 110 | return XFS_ERROR(EROFS); |
@@ -140,8 +122,6 @@ xfs_qm_quotactl( | |||
140 | * QUOTAON - enabling quota enforcement. | 122 | * QUOTAON - enabling quota enforcement. |
141 | * Quota accounting must be turned on at mount time. | 123 | * Quota accounting must be turned on at mount time. |
142 | */ | 124 | */ |
143 | if (addr == NULL) | ||
144 | return XFS_ERROR(EINVAL); | ||
145 | if (vfsp->vfs_flag & VFS_RDONLY) | 125 | if (vfsp->vfs_flag & VFS_RDONLY) |
146 | return XFS_ERROR(EROFS); | 126 | return XFS_ERROR(EROFS); |
147 | return (xfs_qm_scall_quotaon(mp, | 127 | return (xfs_qm_scall_quotaon(mp, |
@@ -152,6 +132,9 @@ xfs_qm_quotactl( | |||
152 | return XFS_ERROR(EROFS); | 132 | return XFS_ERROR(EROFS); |
153 | break; | 133 | break; |
154 | 134 | ||
135 | case Q_XQUOTASYNC: | ||
136 | return (xfs_sync_inodes(mp, SYNC_DELWRI, 0, NULL)); | ||
137 | |||
155 | default: | 138 | default: |
156 | break; | 139 | break; |
157 | } | 140 | } |
@@ -655,13 +638,13 @@ xfs_qm_scall_setqlim( | |||
655 | */ | 638 | */ |
656 | hard = (newlim->d_fieldmask & FS_DQ_BHARD) ? | 639 | hard = (newlim->d_fieldmask & FS_DQ_BHARD) ? |
657 | (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_hardlimit) : | 640 | (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_hardlimit) : |
658 | INT_GET(ddq->d_blk_hardlimit, ARCH_CONVERT); | 641 | be64_to_cpu(ddq->d_blk_hardlimit); |
659 | soft = (newlim->d_fieldmask & FS_DQ_BSOFT) ? | 642 | soft = (newlim->d_fieldmask & FS_DQ_BSOFT) ? |
660 | (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_softlimit) : | 643 | (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_softlimit) : |
661 | INT_GET(ddq->d_blk_softlimit, ARCH_CONVERT); | 644 | be64_to_cpu(ddq->d_blk_softlimit); |
662 | if (hard == 0 || hard >= soft) { | 645 | if (hard == 0 || hard >= soft) { |
663 | INT_SET(ddq->d_blk_hardlimit, ARCH_CONVERT, hard); | 646 | ddq->d_blk_hardlimit = cpu_to_be64(hard); |
664 | INT_SET(ddq->d_blk_softlimit, ARCH_CONVERT, soft); | 647 | ddq->d_blk_softlimit = cpu_to_be64(soft); |
665 | if (id == 0) { | 648 | if (id == 0) { |
666 | mp->m_quotainfo->qi_bhardlimit = hard; | 649 | mp->m_quotainfo->qi_bhardlimit = hard; |
667 | mp->m_quotainfo->qi_bsoftlimit = soft; | 650 | mp->m_quotainfo->qi_bsoftlimit = soft; |
@@ -671,13 +654,13 @@ xfs_qm_scall_setqlim( | |||
671 | } | 654 | } |
672 | hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ? | 655 | hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ? |
673 | (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) : | 656 | (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) : |
674 | INT_GET(ddq->d_rtb_hardlimit, ARCH_CONVERT); | 657 | be64_to_cpu(ddq->d_rtb_hardlimit); |
675 | soft = (newlim->d_fieldmask & FS_DQ_RTBSOFT) ? | 658 | soft = (newlim->d_fieldmask & FS_DQ_RTBSOFT) ? |
676 | (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_softlimit) : | 659 | (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_softlimit) : |
677 | INT_GET(ddq->d_rtb_softlimit, ARCH_CONVERT); | 660 | be64_to_cpu(ddq->d_rtb_softlimit); |
678 | if (hard == 0 || hard >= soft) { | 661 | if (hard == 0 || hard >= soft) { |
679 | INT_SET(ddq->d_rtb_hardlimit, ARCH_CONVERT, hard); | 662 | ddq->d_rtb_hardlimit = cpu_to_be64(hard); |
680 | INT_SET(ddq->d_rtb_softlimit, ARCH_CONVERT, soft); | 663 | ddq->d_rtb_softlimit = cpu_to_be64(soft); |
681 | if (id == 0) { | 664 | if (id == 0) { |
682 | mp->m_quotainfo->qi_rtbhardlimit = hard; | 665 | mp->m_quotainfo->qi_rtbhardlimit = hard; |
683 | mp->m_quotainfo->qi_rtbsoftlimit = soft; | 666 | mp->m_quotainfo->qi_rtbsoftlimit = soft; |
@@ -688,13 +671,13 @@ xfs_qm_scall_setqlim( | |||
688 | 671 | ||
689 | hard = (newlim->d_fieldmask & FS_DQ_IHARD) ? | 672 | hard = (newlim->d_fieldmask & FS_DQ_IHARD) ? |
690 | (xfs_qcnt_t) newlim->d_ino_hardlimit : | 673 | (xfs_qcnt_t) newlim->d_ino_hardlimit : |
691 | INT_GET(ddq->d_ino_hardlimit, ARCH_CONVERT); | 674 | be64_to_cpu(ddq->d_ino_hardlimit); |
692 | soft = (newlim->d_fieldmask & FS_DQ_ISOFT) ? | 675 | soft = (newlim->d_fieldmask & FS_DQ_ISOFT) ? |
693 | (xfs_qcnt_t) newlim->d_ino_softlimit : | 676 | (xfs_qcnt_t) newlim->d_ino_softlimit : |
694 | INT_GET(ddq->d_ino_softlimit, ARCH_CONVERT); | 677 | be64_to_cpu(ddq->d_ino_softlimit); |
695 | if (hard == 0 || hard >= soft) { | 678 | if (hard == 0 || hard >= soft) { |
696 | INT_SET(ddq->d_ino_hardlimit, ARCH_CONVERT, hard); | 679 | ddq->d_ino_hardlimit = cpu_to_be64(hard); |
697 | INT_SET(ddq->d_ino_softlimit, ARCH_CONVERT, soft); | 680 | ddq->d_ino_softlimit = cpu_to_be64(soft); |
698 | if (id == 0) { | 681 | if (id == 0) { |
699 | mp->m_quotainfo->qi_ihardlimit = hard; | 682 | mp->m_quotainfo->qi_ihardlimit = hard; |
700 | mp->m_quotainfo->qi_isoftlimit = soft; | 683 | mp->m_quotainfo->qi_isoftlimit = soft; |
@@ -707,11 +690,11 @@ xfs_qm_scall_setqlim( | |||
707 | * Update warnings counter(s) if requested | 690 | * Update warnings counter(s) if requested |
708 | */ | 691 | */ |
709 | if (newlim->d_fieldmask & FS_DQ_BWARNS) | 692 | if (newlim->d_fieldmask & FS_DQ_BWARNS) |
710 | INT_SET(ddq->d_bwarns, ARCH_CONVERT, newlim->d_bwarns); | 693 | ddq->d_bwarns = cpu_to_be16(newlim->d_bwarns); |
711 | if (newlim->d_fieldmask & FS_DQ_IWARNS) | 694 | if (newlim->d_fieldmask & FS_DQ_IWARNS) |
712 | INT_SET(ddq->d_iwarns, ARCH_CONVERT, newlim->d_iwarns); | 695 | ddq->d_iwarns = cpu_to_be16(newlim->d_iwarns); |
713 | if (newlim->d_fieldmask & FS_DQ_RTBWARNS) | 696 | if (newlim->d_fieldmask & FS_DQ_RTBWARNS) |
714 | INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, newlim->d_rtbwarns); | 697 | ddq->d_rtbwarns = cpu_to_be16(newlim->d_rtbwarns); |
715 | 698 | ||
716 | if (id == 0) { | 699 | if (id == 0) { |
717 | /* | 700 | /* |
@@ -723,15 +706,15 @@ xfs_qm_scall_setqlim( | |||
723 | */ | 706 | */ |
724 | if (newlim->d_fieldmask & FS_DQ_BTIMER) { | 707 | if (newlim->d_fieldmask & FS_DQ_BTIMER) { |
725 | mp->m_quotainfo->qi_btimelimit = newlim->d_btimer; | 708 | mp->m_quotainfo->qi_btimelimit = newlim->d_btimer; |
726 | INT_SET(ddq->d_btimer, ARCH_CONVERT, newlim->d_btimer); | 709 | ddq->d_btimer = cpu_to_be32(newlim->d_btimer); |
727 | } | 710 | } |
728 | if (newlim->d_fieldmask & FS_DQ_ITIMER) { | 711 | if (newlim->d_fieldmask & FS_DQ_ITIMER) { |
729 | mp->m_quotainfo->qi_itimelimit = newlim->d_itimer; | 712 | mp->m_quotainfo->qi_itimelimit = newlim->d_itimer; |
730 | INT_SET(ddq->d_itimer, ARCH_CONVERT, newlim->d_itimer); | 713 | ddq->d_itimer = cpu_to_be32(newlim->d_itimer); |
731 | } | 714 | } |
732 | if (newlim->d_fieldmask & FS_DQ_RTBTIMER) { | 715 | if (newlim->d_fieldmask & FS_DQ_RTBTIMER) { |
733 | mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer; | 716 | mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer; |
734 | INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, newlim->d_rtbtimer); | 717 | ddq->d_rtbtimer = cpu_to_be32(newlim->d_rtbtimer); |
735 | } | 718 | } |
736 | if (newlim->d_fieldmask & FS_DQ_BWARNS) | 719 | if (newlim->d_fieldmask & FS_DQ_BWARNS) |
737 | mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns; | 720 | mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns; |
@@ -902,33 +885,27 @@ xfs_qm_export_dquot( | |||
902 | { | 885 | { |
903 | memset(dst, 0, sizeof(*dst)); | 886 | memset(dst, 0, sizeof(*dst)); |
904 | dst->d_version = FS_DQUOT_VERSION; /* different from src->d_version */ | 887 | dst->d_version = FS_DQUOT_VERSION; /* different from src->d_version */ |
905 | dst->d_flags = | 888 | dst->d_flags = xfs_qm_export_qtype_flags(src->d_flags); |
906 | xfs_qm_export_qtype_flags(INT_GET(src->d_flags, ARCH_CONVERT)); | 889 | dst->d_id = be32_to_cpu(src->d_id); |
907 | dst->d_id = INT_GET(src->d_id, ARCH_CONVERT); | 890 | dst->d_blk_hardlimit = |
908 | dst->d_blk_hardlimit = (__uint64_t) | 891 | XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_blk_hardlimit)); |
909 | XFS_FSB_TO_BB(mp, INT_GET(src->d_blk_hardlimit, ARCH_CONVERT)); | 892 | dst->d_blk_softlimit = |
910 | dst->d_blk_softlimit = (__uint64_t) | 893 | XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_blk_softlimit)); |
911 | XFS_FSB_TO_BB(mp, INT_GET(src->d_blk_softlimit, ARCH_CONVERT)); | 894 | dst->d_ino_hardlimit = be64_to_cpu(src->d_ino_hardlimit); |
912 | dst->d_ino_hardlimit = (__uint64_t) | 895 | dst->d_ino_softlimit = be64_to_cpu(src->d_ino_softlimit); |
913 | INT_GET(src->d_ino_hardlimit, ARCH_CONVERT); | 896 | dst->d_bcount = XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_bcount)); |
914 | dst->d_ino_softlimit = (__uint64_t) | 897 | dst->d_icount = be64_to_cpu(src->d_icount); |
915 | INT_GET(src->d_ino_softlimit, ARCH_CONVERT); | 898 | dst->d_btimer = be32_to_cpu(src->d_btimer); |
916 | dst->d_bcount = (__uint64_t) | 899 | dst->d_itimer = be32_to_cpu(src->d_itimer); |
917 | XFS_FSB_TO_BB(mp, INT_GET(src->d_bcount, ARCH_CONVERT)); | 900 | dst->d_iwarns = be16_to_cpu(src->d_iwarns); |
918 | dst->d_icount = (__uint64_t) INT_GET(src->d_icount, ARCH_CONVERT); | 901 | dst->d_bwarns = be16_to_cpu(src->d_bwarns); |
919 | dst->d_btimer = (__uint32_t) INT_GET(src->d_btimer, ARCH_CONVERT); | 902 | dst->d_rtb_hardlimit = |
920 | dst->d_itimer = (__uint32_t) INT_GET(src->d_itimer, ARCH_CONVERT); | 903 | XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtb_hardlimit)); |
921 | dst->d_iwarns = INT_GET(src->d_iwarns, ARCH_CONVERT); | 904 | dst->d_rtb_softlimit = |
922 | dst->d_bwarns = INT_GET(src->d_bwarns, ARCH_CONVERT); | 905 | XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtb_softlimit)); |
923 | 906 | dst->d_rtbcount = XFS_FSB_TO_BB(mp, be64_to_cpu(src->d_rtbcount)); | |
924 | dst->d_rtb_hardlimit = (__uint64_t) | 907 | dst->d_rtbtimer = be32_to_cpu(src->d_rtbtimer); |
925 | XFS_FSB_TO_BB(mp, INT_GET(src->d_rtb_hardlimit, ARCH_CONVERT)); | 908 | dst->d_rtbwarns = be16_to_cpu(src->d_rtbwarns); |
926 | dst->d_rtb_softlimit = (__uint64_t) | ||
927 | XFS_FSB_TO_BB(mp, INT_GET(src->d_rtb_softlimit, ARCH_CONVERT)); | ||
928 | dst->d_rtbcount = (__uint64_t) | ||
929 | XFS_FSB_TO_BB(mp, INT_GET(src->d_rtbcount, ARCH_CONVERT)); | ||
930 | dst->d_rtbtimer = (__uint32_t) INT_GET(src->d_rtbtimer, ARCH_CONVERT); | ||
931 | dst->d_rtbwarns = INT_GET(src->d_rtbwarns, ARCH_CONVERT); | ||
932 | 909 | ||
933 | /* | 910 | /* |
934 | * Internally, we don't reset all the timers when quota enforcement | 911 | * Internally, we don't reset all the timers when quota enforcement |
@@ -1053,7 +1030,6 @@ xfs_qm_dqrele_all_inodes( | |||
1053 | struct xfs_mount *mp, | 1030 | struct xfs_mount *mp, |
1054 | uint flags) | 1031 | uint flags) |
1055 | { | 1032 | { |
1056 | vmap_t vmap; | ||
1057 | xfs_inode_t *ip, *topino; | 1033 | xfs_inode_t *ip, *topino; |
1058 | uint ireclaims; | 1034 | uint ireclaims; |
1059 | vnode_t *vp; | 1035 | vnode_t *vp; |
@@ -1061,8 +1037,8 @@ xfs_qm_dqrele_all_inodes( | |||
1061 | 1037 | ||
1062 | ASSERT(mp->m_quotainfo); | 1038 | ASSERT(mp->m_quotainfo); |
1063 | 1039 | ||
1064 | again: | ||
1065 | XFS_MOUNT_ILOCK(mp); | 1040 | XFS_MOUNT_ILOCK(mp); |
1041 | again: | ||
1066 | ip = mp->m_inodes; | 1042 | ip = mp->m_inodes; |
1067 | if (ip == NULL) { | 1043 | if (ip == NULL) { |
1068 | XFS_MOUNT_IUNLOCK(mp); | 1044 | XFS_MOUNT_IUNLOCK(mp); |
@@ -1090,18 +1066,14 @@ again: | |||
1090 | } | 1066 | } |
1091 | vnode_refd = B_FALSE; | 1067 | vnode_refd = B_FALSE; |
1092 | if (xfs_ilock_nowait(ip, XFS_ILOCK_EXCL) == 0) { | 1068 | if (xfs_ilock_nowait(ip, XFS_ILOCK_EXCL) == 0) { |
1093 | /* | ||
1094 | * Sample vp mapping while holding the mplock, lest | ||
1095 | * we come across a non-existent vnode. | ||
1096 | */ | ||
1097 | VMAP(vp, vmap); | ||
1098 | ireclaims = mp->m_ireclaims; | 1069 | ireclaims = mp->m_ireclaims; |
1099 | topino = mp->m_inodes; | 1070 | topino = mp->m_inodes; |
1100 | XFS_MOUNT_IUNLOCK(mp); | 1071 | vp = vn_grab(vp); |
1072 | if (!vp) | ||
1073 | goto again; | ||
1101 | 1074 | ||
1075 | XFS_MOUNT_IUNLOCK(mp); | ||
1102 | /* XXX restart limit ? */ | 1076 | /* XXX restart limit ? */ |
1103 | if ( ! (vp = vn_get(vp, &vmap))) | ||
1104 | goto again; | ||
1105 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 1077 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
1106 | vnode_refd = B_TRUE; | 1078 | vnode_refd = B_TRUE; |
1107 | } else { | 1079 | } else { |
@@ -1137,7 +1109,6 @@ again: | |||
1137 | */ | 1109 | */ |
1138 | if (topino != mp->m_inodes || mp->m_ireclaims != ireclaims) { | 1110 | if (topino != mp->m_inodes || mp->m_ireclaims != ireclaims) { |
1139 | /* XXX use a sentinel */ | 1111 | /* XXX use a sentinel */ |
1140 | XFS_MOUNT_IUNLOCK(mp); | ||
1141 | goto again; | 1112 | goto again; |
1142 | } | 1113 | } |
1143 | ip = ip->i_mnext; | 1114 | ip = ip->i_mnext; |
@@ -1228,10 +1199,10 @@ xfs_qm_dqtest_failed( | |||
1228 | qmtest_nfails++; | 1199 | qmtest_nfails++; |
1229 | if (error) | 1200 | if (error) |
1230 | cmn_err(CE_DEBUG, "quotacheck failed id=%d, err=%d\nreason: %s", | 1201 | cmn_err(CE_DEBUG, "quotacheck failed id=%d, err=%d\nreason: %s", |
1231 | INT_GET(d->d_id, ARCH_CONVERT), error, reason); | 1202 | d->d_id, error, reason); |
1232 | else | 1203 | else |
1233 | cmn_err(CE_DEBUG, "quotacheck failed id=%d (%s) [%d != %d]", | 1204 | cmn_err(CE_DEBUG, "quotacheck failed id=%d (%s) [%d != %d]", |
1234 | INT_GET(d->d_id, ARCH_CONVERT), reason, (int)a, (int)b); | 1205 | d->d_id, reason, (int)a, (int)b); |
1235 | xfs_qm_dqtest_print(d); | 1206 | xfs_qm_dqtest_print(d); |
1236 | if (dqp) | 1207 | if (dqp) |
1237 | xfs_qm_dqprint(dqp); | 1208 | xfs_qm_dqprint(dqp); |
@@ -1243,21 +1214,21 @@ xfs_dqtest_cmp2( | |||
1243 | xfs_dquot_t *dqp) | 1214 | xfs_dquot_t *dqp) |
1244 | { | 1215 | { |
1245 | int err = 0; | 1216 | int err = 0; |
1246 | if (INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) != d->d_icount) { | 1217 | if (be64_to_cpu(dqp->q_core.d_icount) != d->d_icount) { |
1247 | xfs_qm_dqtest_failed(d, dqp, "icount mismatch", | 1218 | xfs_qm_dqtest_failed(d, dqp, "icount mismatch", |
1248 | INT_GET(dqp->q_core.d_icount, ARCH_CONVERT), | 1219 | be64_to_cpu(dqp->q_core.d_icount), |
1249 | d->d_icount, 0); | 1220 | d->d_icount, 0); |
1250 | err++; | 1221 | err++; |
1251 | } | 1222 | } |
1252 | if (INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT) != d->d_bcount) { | 1223 | if (be64_to_cpu(dqp->q_core.d_bcount) != d->d_bcount) { |
1253 | xfs_qm_dqtest_failed(d, dqp, "bcount mismatch", | 1224 | xfs_qm_dqtest_failed(d, dqp, "bcount mismatch", |
1254 | INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT), | 1225 | be64_to_cpu(dqp->q_core.d_bcount), |
1255 | d->d_bcount, 0); | 1226 | d->d_bcount, 0); |
1256 | err++; | 1227 | err++; |
1257 | } | 1228 | } |
1258 | if (INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT) && | 1229 | if (dqp->q_core.d_blk_softlimit && |
1259 | INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT) >= | 1230 | be64_to_cpu(dqp->q_core.d_bcount) >= |
1260 | INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT)) { | 1231 | be64_to_cpu(dqp->q_core.d_blk_softlimit)) { |
1261 | if (!dqp->q_core.d_btimer && dqp->q_core.d_id) { | 1232 | if (!dqp->q_core.d_btimer && dqp->q_core.d_id) { |
1262 | cmn_err(CE_DEBUG, | 1233 | cmn_err(CE_DEBUG, |
1263 | "%d [%s] [0x%p] BLK TIMER NOT STARTED", | 1234 | "%d [%s] [0x%p] BLK TIMER NOT STARTED", |
@@ -1265,9 +1236,9 @@ xfs_dqtest_cmp2( | |||
1265 | err++; | 1236 | err++; |
1266 | } | 1237 | } |
1267 | } | 1238 | } |
1268 | if (INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT) && | 1239 | if (dqp->q_core.d_ino_softlimit && |
1269 | INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >= | 1240 | be64_to_cpu(dqp->q_core.d_icount) >= |
1270 | INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT)) { | 1241 | be64_to_cpu(dqp->q_core.d_ino_softlimit)) { |
1271 | if (!dqp->q_core.d_itimer && dqp->q_core.d_id) { | 1242 | if (!dqp->q_core.d_itimer && dqp->q_core.d_id) { |
1272 | cmn_err(CE_DEBUG, | 1243 | cmn_err(CE_DEBUG, |
1273 | "%d [%s] [0x%p] INO TIMER NOT STARTED", | 1244 | "%d [%s] [0x%p] INO TIMER NOT STARTED", |
diff --git a/fs/xfs/quota/xfs_quota_priv.h b/fs/xfs/quota/xfs_quota_priv.h index bf413e70ec07..7a9f3beb818c 100644 --- a/fs/xfs/quota/xfs_quota_priv.h +++ b/fs/xfs/quota/xfs_quota_priv.h | |||
@@ -1,33 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | #ifndef __XFS_QUOTA_PRIV_H__ | 18 | #ifndef __XFS_QUOTA_PRIV_H__ |
33 | #define __XFS_QUOTA_PRIV_H__ | 19 | #define __XFS_QUOTA_PRIV_H__ |
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c index 3b99daf8a640..3290975d31f7 100644 --- a/fs/xfs/quota/xfs_trans_dquot.c +++ b/fs/xfs/quota/xfs_trans_dquot.c | |||
@@ -1,39 +1,25 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2002 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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 | */ | 17 | */ |
32 | |||
33 | #include "xfs.h" | 18 | #include "xfs.h" |
34 | #include "xfs_fs.h" | 19 | #include "xfs_fs.h" |
35 | #include "xfs_inum.h" | 20 | #include "xfs_bit.h" |
36 | #include "xfs_log.h" | 21 | #include "xfs_log.h" |
22 | #include "xfs_inum.h" | ||
37 | #include "xfs_trans.h" | 23 | #include "xfs_trans.h" |
38 | #include "xfs_sb.h" | 24 | #include "xfs_sb.h" |
39 | #include "xfs_ag.h" | 25 | #include "xfs_ag.h" |
@@ -43,21 +29,20 @@ | |||
43 | #include "xfs_dmapi.h" | 29 | #include "xfs_dmapi.h" |
44 | #include "xfs_quota.h" | 30 | #include "xfs_quota.h" |
45 | #include "xfs_mount.h" | 31 | #include "xfs_mount.h" |
46 | #include "xfs_alloc_btree.h" | ||
47 | #include "xfs_bmap_btree.h" | 32 | #include "xfs_bmap_btree.h" |
33 | #include "xfs_alloc_btree.h" | ||
48 | #include "xfs_ialloc_btree.h" | 34 | #include "xfs_ialloc_btree.h" |
49 | #include "xfs_btree.h" | ||
50 | #include "xfs_ialloc.h" | ||
51 | #include "xfs_attr_sf.h" | 35 | #include "xfs_attr_sf.h" |
52 | #include "xfs_dir_sf.h" | 36 | #include "xfs_dir_sf.h" |
53 | #include "xfs_dir2_sf.h" | 37 | #include "xfs_dir2_sf.h" |
54 | #include "xfs_dinode.h" | 38 | #include "xfs_dinode.h" |
55 | #include "xfs_inode.h" | 39 | #include "xfs_inode.h" |
40 | #include "xfs_ialloc.h" | ||
41 | #include "xfs_itable.h" | ||
42 | #include "xfs_btree.h" | ||
56 | #include "xfs_bmap.h" | 43 | #include "xfs_bmap.h" |
57 | #include "xfs_bit.h" | ||
58 | #include "xfs_rtalloc.h" | 44 | #include "xfs_rtalloc.h" |
59 | #include "xfs_error.h" | 45 | #include "xfs_error.h" |
60 | #include "xfs_itable.h" | ||
61 | #include "xfs_rw.h" | 46 | #include "xfs_rw.h" |
62 | #include "xfs_acl.h" | 47 | #include "xfs_acl.h" |
63 | #include "xfs_cap.h" | 48 | #include "xfs_cap.h" |
@@ -65,7 +50,6 @@ | |||
65 | #include "xfs_attr.h" | 50 | #include "xfs_attr.h" |
66 | #include "xfs_buf_item.h" | 51 | #include "xfs_buf_item.h" |
67 | #include "xfs_trans_priv.h" | 52 | #include "xfs_trans_priv.h" |
68 | |||
69 | #include "xfs_qm.h" | 53 | #include "xfs_qm.h" |
70 | 54 | ||
71 | STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *); | 55 | STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *); |
@@ -429,25 +413,25 @@ xfs_trans_apply_dquot_deltas( | |||
429 | qtrx->qt_delrtb_delta; | 413 | qtrx->qt_delrtb_delta; |
430 | #ifdef QUOTADEBUG | 414 | #ifdef QUOTADEBUG |
431 | if (totalbdelta < 0) | 415 | if (totalbdelta < 0) |
432 | ASSERT(INT_GET(d->d_bcount, ARCH_CONVERT) >= | 416 | ASSERT(be64_to_cpu(d->d_bcount) >= |
433 | (xfs_qcnt_t) -totalbdelta); | 417 | (xfs_qcnt_t) -totalbdelta); |
434 | 418 | ||
435 | if (totalrtbdelta < 0) | 419 | if (totalrtbdelta < 0) |
436 | ASSERT(INT_GET(d->d_rtbcount, ARCH_CONVERT) >= | 420 | ASSERT(be64_to_cpu(d->d_rtbcount) >= |
437 | (xfs_qcnt_t) -totalrtbdelta); | 421 | (xfs_qcnt_t) -totalrtbdelta); |
438 | 422 | ||
439 | if (qtrx->qt_icount_delta < 0) | 423 | if (qtrx->qt_icount_delta < 0) |
440 | ASSERT(INT_GET(d->d_icount, ARCH_CONVERT) >= | 424 | ASSERT(be64_to_cpu(d->d_icount) >= |
441 | (xfs_qcnt_t) -qtrx->qt_icount_delta); | 425 | (xfs_qcnt_t) -qtrx->qt_icount_delta); |
442 | #endif | 426 | #endif |
443 | if (totalbdelta) | 427 | if (totalbdelta) |
444 | INT_MOD(d->d_bcount, ARCH_CONVERT, (xfs_qcnt_t)totalbdelta); | 428 | be64_add(&d->d_bcount, (xfs_qcnt_t)totalbdelta); |
445 | 429 | ||
446 | if (qtrx->qt_icount_delta) | 430 | if (qtrx->qt_icount_delta) |
447 | INT_MOD(d->d_icount, ARCH_CONVERT, (xfs_qcnt_t)qtrx->qt_icount_delta); | 431 | be64_add(&d->d_icount, (xfs_qcnt_t)qtrx->qt_icount_delta); |
448 | 432 | ||
449 | if (totalrtbdelta) | 433 | if (totalrtbdelta) |
450 | INT_MOD(d->d_rtbcount, ARCH_CONVERT, (xfs_qcnt_t)totalrtbdelta); | 434 | be64_add(&d->d_rtbcount, (xfs_qcnt_t)totalrtbdelta); |
451 | 435 | ||
452 | /* | 436 | /* |
453 | * Get any default limits in use. | 437 | * Get any default limits in use. |
@@ -531,11 +515,11 @@ xfs_trans_apply_dquot_deltas( | |||
531 | } | 515 | } |
532 | 516 | ||
533 | ASSERT(dqp->q_res_bcount >= | 517 | ASSERT(dqp->q_res_bcount >= |
534 | INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); | 518 | be64_to_cpu(dqp->q_core.d_bcount)); |
535 | ASSERT(dqp->q_res_icount >= | 519 | ASSERT(dqp->q_res_icount >= |
536 | INT_GET(dqp->q_core.d_icount, ARCH_CONVERT)); | 520 | be64_to_cpu(dqp->q_core.d_icount)); |
537 | ASSERT(dqp->q_res_rtbcount >= | 521 | ASSERT(dqp->q_res_rtbcount >= |
538 | INT_GET(dqp->q_core.d_rtbcount, ARCH_CONVERT)); | 522 | be64_to_cpu(dqp->q_core.d_rtbcount)); |
539 | } | 523 | } |
540 | /* | 524 | /* |
541 | * Do the group quotas next | 525 | * Do the group quotas next |
@@ -642,26 +626,26 @@ xfs_trans_dqresv( | |||
642 | } | 626 | } |
643 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); | 627 | ASSERT(XFS_DQ_IS_LOCKED(dqp)); |
644 | if (flags & XFS_TRANS_DQ_RES_BLKS) { | 628 | if (flags & XFS_TRANS_DQ_RES_BLKS) { |
645 | hardlimit = INT_GET(dqp->q_core.d_blk_hardlimit, ARCH_CONVERT); | 629 | hardlimit = be64_to_cpu(dqp->q_core.d_blk_hardlimit); |
646 | if (!hardlimit) | 630 | if (!hardlimit) |
647 | hardlimit = q->qi_bhardlimit; | 631 | hardlimit = q->qi_bhardlimit; |
648 | softlimit = INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT); | 632 | softlimit = be64_to_cpu(dqp->q_core.d_blk_softlimit); |
649 | if (!softlimit) | 633 | if (!softlimit) |
650 | softlimit = q->qi_bsoftlimit; | 634 | softlimit = q->qi_bsoftlimit; |
651 | timer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT); | 635 | timer = be32_to_cpu(dqp->q_core.d_btimer); |
652 | warns = INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT); | 636 | warns = be16_to_cpu(dqp->q_core.d_bwarns); |
653 | warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount); | 637 | warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount); |
654 | resbcountp = &dqp->q_res_bcount; | 638 | resbcountp = &dqp->q_res_bcount; |
655 | } else { | 639 | } else { |
656 | ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS); | 640 | ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS); |
657 | hardlimit = INT_GET(dqp->q_core.d_rtb_hardlimit, ARCH_CONVERT); | 641 | hardlimit = be64_to_cpu(dqp->q_core.d_rtb_hardlimit); |
658 | if (!hardlimit) | 642 | if (!hardlimit) |
659 | hardlimit = q->qi_rtbhardlimit; | 643 | hardlimit = q->qi_rtbhardlimit; |
660 | softlimit = INT_GET(dqp->q_core.d_rtb_softlimit, ARCH_CONVERT); | 644 | softlimit = be64_to_cpu(dqp->q_core.d_rtb_softlimit); |
661 | if (!softlimit) | 645 | if (!softlimit) |
662 | softlimit = q->qi_rtbsoftlimit; | 646 | softlimit = q->qi_rtbsoftlimit; |
663 | timer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT); | 647 | timer = be32_to_cpu(dqp->q_core.d_rtbtimer); |
664 | warns = INT_GET(dqp->q_core.d_rtbwarns, ARCH_CONVERT); | 648 | warns = be16_to_cpu(dqp->q_core.d_rtbwarns); |
665 | warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount); | 649 | warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount); |
666 | resbcountp = &dqp->q_res_rtbcount; | 650 | resbcountp = &dqp->q_res_rtbcount; |
667 | } | 651 | } |
@@ -700,16 +684,14 @@ xfs_trans_dqresv( | |||
700 | } | 684 | } |
701 | } | 685 | } |
702 | if (ninos > 0) { | 686 | if (ninos > 0) { |
703 | count = INT_GET(dqp->q_core.d_icount, ARCH_CONVERT); | 687 | count = be64_to_cpu(dqp->q_core.d_icount); |
704 | timer = INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT); | 688 | timer = be32_to_cpu(dqp->q_core.d_itimer); |
705 | warns = INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT); | 689 | warns = be16_to_cpu(dqp->q_core.d_iwarns); |
706 | warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount); | 690 | warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount); |
707 | hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit, | 691 | hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit); |
708 | ARCH_CONVERT); | ||
709 | if (!hardlimit) | 692 | if (!hardlimit) |
710 | hardlimit = q->qi_ihardlimit; | 693 | hardlimit = q->qi_ihardlimit; |
711 | softlimit = INT_GET(dqp->q_core.d_ino_softlimit, | 694 | softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit); |
712 | ARCH_CONVERT); | ||
713 | if (!softlimit) | 695 | if (!softlimit) |
714 | softlimit = q->qi_isoftlimit; | 696 | softlimit = q->qi_isoftlimit; |
715 | if (hardlimit > 0ULL && count >= hardlimit) { | 697 | if (hardlimit > 0ULL && count >= hardlimit) { |
@@ -756,9 +738,9 @@ xfs_trans_dqresv( | |||
756 | XFS_TRANS_DQ_RES_INOS, | 738 | XFS_TRANS_DQ_RES_INOS, |
757 | ninos); | 739 | ninos); |
758 | } | 740 | } |
759 | ASSERT(dqp->q_res_bcount >= INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); | 741 | ASSERT(dqp->q_res_bcount >= be64_to_cpu(dqp->q_core.d_bcount)); |
760 | ASSERT(dqp->q_res_rtbcount >= INT_GET(dqp->q_core.d_rtbcount, ARCH_CONVERT)); | 742 | ASSERT(dqp->q_res_rtbcount >= be64_to_cpu(dqp->q_core.d_rtbcount)); |
761 | ASSERT(dqp->q_res_icount >= INT_GET(dqp->q_core.d_icount, ARCH_CONVERT)); | 743 | ASSERT(dqp->q_res_icount >= be64_to_cpu(dqp->q_core.d_icount)); |
762 | 744 | ||
763 | error_return: | 745 | error_return: |
764 | if (! (flags & XFS_QMOPT_DQLOCK)) { | 746 | if (! (flags & XFS_QMOPT_DQLOCK)) { |