diff options
author | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-11-06 09:36:37 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-11-06 09:36:37 -0500 |
commit | 2fc2991175bf77395e6b15fe6b2304d3bf72da40 (patch) | |
tree | b0ff38c09240e7c00e1577d447ebe89143d752dc /fs/xfs/quota/xfs_qm_syscalls.c | |
parent | 8b491d750885ebe8e7d385ce4186c85957d67123 (diff) | |
parent | 7015faa7df829876a0f931cd18aa6d7c24a1b581 (diff) |
Merge branch 'master' of /home/tglx/work/mtd/git/linux-2.6.git/
Diffstat (limited to 'fs/xfs/quota/xfs_qm_syscalls.c')
-rw-r--r-- | fs/xfs/quota/xfs_qm_syscalls.c | 189 |
1 files changed, 80 insertions, 109 deletions
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", |