aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/quota/xfs_trans_dquot.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 09:36:37 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 09:36:37 -0500
commit2fc2991175bf77395e6b15fe6b2304d3bf72da40 (patch)
treeb0ff38c09240e7c00e1577d447ebe89143d752dc /fs/xfs/quota/xfs_trans_dquot.c
parent8b491d750885ebe8e7d385ce4186c85957d67123 (diff)
parent7015faa7df829876a0f931cd18aa6d7c24a1b581 (diff)
Merge branch 'master' of /home/tglx/work/mtd/git/linux-2.6.git/
Diffstat (limited to 'fs/xfs/quota/xfs_trans_dquot.c')
-rw-r--r--fs/xfs/quota/xfs_trans_dquot.c102
1 files changed, 42 insertions, 60 deletions
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
71STATIC void xfs_trans_alloc_dqinfo(xfs_trans_t *); 55STATIC 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
763error_return: 745error_return:
764 if (! (flags & XFS_QMOPT_DQLOCK)) { 746 if (! (flags & XFS_QMOPT_DQLOCK)) {