diff options
author | Christoph Hellwig <hch@lst.de> | 2011-07-13 07:43:50 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2011-07-13 07:43:50 -0400 |
commit | ea15ab3cdda1bc6822f572ce9ce5d86f097f9b08 (patch) | |
tree | 1fddbe64d7f6d9150bdb86a9579c8f5feb94f734 /fs/xfs | |
parent | 54244fec67024032cb54eb604b2a36579b5db2d3 (diff) |
xfs: remove the dead QUOTADEBUG code
Remove the dead hash table test rid which has been rotting away under
QUOTADEBUG, including some code that was compiled for normal debug
builds, but not actually called without QUOTADEBUG, and enable a few
cheap debug checks that were hidden under QUOTADEBUG for normal
debug builds.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/quota/xfs_dquot.c | 42 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot.h | 6 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 49 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.h | 6 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm_syscalls.c | 353 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_trans_dquot.c | 13 | ||||
-rw-r--r-- | fs/xfs/xfs.h | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 4 |
8 files changed, 8 insertions, 466 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c index dec11497a2ef..837f31158d43 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/quota/xfs_dquot.c | |||
@@ -220,7 +220,7 @@ xfs_qm_adjust_dqtimers( | |||
220 | { | 220 | { |
221 | ASSERT(d->d_id); | 221 | ASSERT(d->d_id); |
222 | 222 | ||
223 | #ifdef QUOTADEBUG | 223 | #ifdef DEBUG |
224 | if (d->d_blk_hardlimit) | 224 | if (d->d_blk_hardlimit) |
225 | ASSERT(be64_to_cpu(d->d_blk_softlimit) <= | 225 | ASSERT(be64_to_cpu(d->d_blk_softlimit) <= |
226 | be64_to_cpu(d->d_blk_hardlimit)); | 226 | be64_to_cpu(d->d_blk_hardlimit)); |
@@ -231,6 +231,7 @@ xfs_qm_adjust_dqtimers( | |||
231 | ASSERT(be64_to_cpu(d->d_rtb_softlimit) <= | 231 | ASSERT(be64_to_cpu(d->d_rtb_softlimit) <= |
232 | be64_to_cpu(d->d_rtb_hardlimit)); | 232 | be64_to_cpu(d->d_rtb_hardlimit)); |
233 | #endif | 233 | #endif |
234 | |||
234 | if (!d->d_btimer) { | 235 | if (!d->d_btimer) { |
235 | if ((d->d_blk_softlimit && | 236 | if ((d->d_blk_softlimit && |
236 | (be64_to_cpu(d->d_bcount) >= | 237 | (be64_to_cpu(d->d_bcount) >= |
@@ -1423,45 +1424,6 @@ xfs_qm_dqpurge( | |||
1423 | } | 1424 | } |
1424 | 1425 | ||
1425 | 1426 | ||
1426 | #ifdef QUOTADEBUG | ||
1427 | void | ||
1428 | xfs_qm_dqprint(xfs_dquot_t *dqp) | ||
1429 | { | ||
1430 | struct xfs_mount *mp = dqp->q_mount; | ||
1431 | |||
1432 | xfs_debug(mp, "-----------KERNEL DQUOT----------------"); | ||
1433 | xfs_debug(mp, "---- dquotID = %d", | ||
1434 | (int)be32_to_cpu(dqp->q_core.d_id)); | ||
1435 | xfs_debug(mp, "---- type = %s", DQFLAGTO_TYPESTR(dqp)); | ||
1436 | xfs_debug(mp, "---- fs = 0x%p", dqp->q_mount); | ||
1437 | xfs_debug(mp, "---- blkno = 0x%x", (int) dqp->q_blkno); | ||
1438 | xfs_debug(mp, "---- boffset = 0x%x", (int) dqp->q_bufoffset); | ||
1439 | xfs_debug(mp, "---- blkhlimit = %Lu (0x%x)", | ||
1440 | be64_to_cpu(dqp->q_core.d_blk_hardlimit), | ||
1441 | (int)be64_to_cpu(dqp->q_core.d_blk_hardlimit)); | ||
1442 | xfs_debug(mp, "---- blkslimit = %Lu (0x%x)", | ||
1443 | be64_to_cpu(dqp->q_core.d_blk_softlimit), | ||
1444 | (int)be64_to_cpu(dqp->q_core.d_blk_softlimit)); | ||
1445 | xfs_debug(mp, "---- inohlimit = %Lu (0x%x)", | ||
1446 | be64_to_cpu(dqp->q_core.d_ino_hardlimit), | ||
1447 | (int)be64_to_cpu(dqp->q_core.d_ino_hardlimit)); | ||
1448 | xfs_debug(mp, "---- inoslimit = %Lu (0x%x)", | ||
1449 | be64_to_cpu(dqp->q_core.d_ino_softlimit), | ||
1450 | (int)be64_to_cpu(dqp->q_core.d_ino_softlimit)); | ||
1451 | xfs_debug(mp, "---- bcount = %Lu (0x%x)", | ||
1452 | be64_to_cpu(dqp->q_core.d_bcount), | ||
1453 | (int)be64_to_cpu(dqp->q_core.d_bcount)); | ||
1454 | xfs_debug(mp, "---- icount = %Lu (0x%x)", | ||
1455 | be64_to_cpu(dqp->q_core.d_icount), | ||
1456 | (int)be64_to_cpu(dqp->q_core.d_icount)); | ||
1457 | xfs_debug(mp, "---- btimer = %d", | ||
1458 | (int)be32_to_cpu(dqp->q_core.d_btimer)); | ||
1459 | xfs_debug(mp, "---- itimer = %d", | ||
1460 | (int)be32_to_cpu(dqp->q_core.d_itimer)); | ||
1461 | xfs_debug(mp, "---------------------------"); | ||
1462 | } | ||
1463 | #endif | ||
1464 | |||
1465 | /* | 1427 | /* |
1466 | * Give the buffer a little push if it is incore and | 1428 | * Give the buffer a little push if it is incore and |
1467 | * wait on the flush lock. | 1429 | * wait on the flush lock. |
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/quota/xfs_dquot.h index 5da3a23b820d..34b7e945dbfa 100644 --- a/fs/xfs/quota/xfs_dquot.h +++ b/fs/xfs/quota/xfs_dquot.h | |||
@@ -116,12 +116,6 @@ static inline void xfs_dqfunlock(xfs_dquot_t *dqp) | |||
116 | (XFS_IS_UQUOTA_ON((d)->q_mount)) : \ | 116 | (XFS_IS_UQUOTA_ON((d)->q_mount)) : \ |
117 | (XFS_IS_OQUOTA_ON((d)->q_mount)))) | 117 | (XFS_IS_OQUOTA_ON((d)->q_mount)))) |
118 | 118 | ||
119 | #ifdef QUOTADEBUG | ||
120 | extern void xfs_qm_dqprint(xfs_dquot_t *); | ||
121 | #else | ||
122 | #define xfs_qm_dqprint(a) | ||
123 | #endif | ||
124 | |||
125 | extern void xfs_qm_dqdestroy(xfs_dquot_t *); | 119 | extern void xfs_qm_dqdestroy(xfs_dquot_t *); |
126 | extern int xfs_qm_dqflush(xfs_dquot_t *, uint); | 120 | extern int xfs_qm_dqflush(xfs_dquot_t *, uint); |
127 | extern int xfs_qm_dqpurge(xfs_dquot_t *); | 121 | extern int xfs_qm_dqpurge(xfs_dquot_t *); |
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index b94dace4e785..46e54ad9a2dc 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -67,32 +67,6 @@ static struct shrinker xfs_qm_shaker = { | |||
67 | .seeks = DEFAULT_SEEKS, | 67 | .seeks = DEFAULT_SEEKS, |
68 | }; | 68 | }; |
69 | 69 | ||
70 | #ifdef DEBUG | ||
71 | extern struct mutex qcheck_lock; | ||
72 | #endif | ||
73 | |||
74 | #ifdef QUOTADEBUG | ||
75 | static void | ||
76 | xfs_qm_dquot_list_print( | ||
77 | struct xfs_mount *mp) | ||
78 | { | ||
79 | xfs_dquot_t *dqp; | ||
80 | int i = 0; | ||
81 | |||
82 | list_for_each_entry(dqp, &mp->m_quotainfo->qi_dqlist_lock, qi_mplist) { | ||
83 | xfs_debug(mp, " %d. \"%d (%s)\" " | ||
84 | "bcnt = %lld, icnt = %lld, refs = %d", | ||
85 | i++, be32_to_cpu(dqp->q_core.d_id), | ||
86 | DQFLAGTO_TYPESTR(dqp), | ||
87 | (long long)be64_to_cpu(dqp->q_core.d_bcount), | ||
88 | (long long)be64_to_cpu(dqp->q_core.d_icount), | ||
89 | dqp->q_nrefs); | ||
90 | } | ||
91 | } | ||
92 | #else | ||
93 | static void xfs_qm_dquot_list_print(struct xfs_mount *mp) { } | ||
94 | #endif | ||
95 | |||
96 | /* | 70 | /* |
97 | * Initialize the XQM structure. | 71 | * Initialize the XQM structure. |
98 | * Note that there is not one quota manager per file system. | 72 | * Note that there is not one quota manager per file system. |
@@ -165,9 +139,6 @@ xfs_Gqm_init(void) | |||
165 | atomic_set(&xqm->qm_totaldquots, 0); | 139 | atomic_set(&xqm->qm_totaldquots, 0); |
166 | xqm->qm_dqfree_ratio = XFS_QM_DQFREE_RATIO; | 140 | xqm->qm_dqfree_ratio = XFS_QM_DQFREE_RATIO; |
167 | xqm->qm_nrefs = 0; | 141 | xqm->qm_nrefs = 0; |
168 | #ifdef DEBUG | ||
169 | mutex_init(&qcheck_lock); | ||
170 | #endif | ||
171 | return xqm; | 142 | return xqm; |
172 | 143 | ||
173 | out_free_udqhash: | 144 | out_free_udqhash: |
@@ -204,9 +175,6 @@ xfs_qm_destroy( | |||
204 | mutex_lock(&xqm->qm_dqfrlist_lock); | 175 | mutex_lock(&xqm->qm_dqfrlist_lock); |
205 | list_for_each_entry_safe(dqp, n, &xqm->qm_dqfrlist, q_freelist) { | 176 | list_for_each_entry_safe(dqp, n, &xqm->qm_dqfrlist, q_freelist) { |
206 | xfs_dqlock(dqp); | 177 | xfs_dqlock(dqp); |
207 | #ifdef QUOTADEBUG | ||
208 | xfs_debug(dqp->q_mount, "FREELIST destroy 0x%p", dqp); | ||
209 | #endif | ||
210 | list_del_init(&dqp->q_freelist); | 178 | list_del_init(&dqp->q_freelist); |
211 | xfs_Gqm->qm_dqfrlist_cnt--; | 179 | xfs_Gqm->qm_dqfrlist_cnt--; |
212 | xfs_dqunlock(dqp); | 180 | xfs_dqunlock(dqp); |
@@ -214,9 +182,6 @@ xfs_qm_destroy( | |||
214 | } | 182 | } |
215 | mutex_unlock(&xqm->qm_dqfrlist_lock); | 183 | mutex_unlock(&xqm->qm_dqfrlist_lock); |
216 | mutex_destroy(&xqm->qm_dqfrlist_lock); | 184 | mutex_destroy(&xqm->qm_dqfrlist_lock); |
217 | #ifdef DEBUG | ||
218 | mutex_destroy(&qcheck_lock); | ||
219 | #endif | ||
220 | kmem_free(xqm); | 185 | kmem_free(xqm); |
221 | } | 186 | } |
222 | 187 | ||
@@ -409,11 +374,6 @@ xfs_qm_mount_quotas( | |||
409 | xfs_warn(mp, "Failed to initialize disk quotas."); | 374 | xfs_warn(mp, "Failed to initialize disk quotas."); |
410 | return; | 375 | return; |
411 | } | 376 | } |
412 | |||
413 | #ifdef QUOTADEBUG | ||
414 | if (XFS_IS_QUOTA_ON(mp)) | ||
415 | xfs_qm_internalqcheck(mp); | ||
416 | #endif | ||
417 | } | 377 | } |
418 | 378 | ||
419 | /* | 379 | /* |
@@ -866,8 +826,8 @@ xfs_qm_dqattach_locked( | |||
866 | } | 826 | } |
867 | 827 | ||
868 | done: | 828 | done: |
869 | #ifdef QUOTADEBUG | 829 | #ifdef DEBUG |
870 | if (! error) { | 830 | if (!error) { |
871 | if (XFS_IS_UQUOTA_ON(mp)) | 831 | if (XFS_IS_UQUOTA_ON(mp)) |
872 | ASSERT(ip->i_udquot); | 832 | ASSERT(ip->i_udquot); |
873 | if (XFS_IS_OQUOTA_ON(mp)) | 833 | if (XFS_IS_OQUOTA_ON(mp)) |
@@ -1733,8 +1693,6 @@ xfs_qm_quotacheck( | |||
1733 | mp->m_qflags &= ~(XFS_OQUOTA_CHKD | XFS_UQUOTA_CHKD); | 1693 | mp->m_qflags &= ~(XFS_OQUOTA_CHKD | XFS_UQUOTA_CHKD); |
1734 | mp->m_qflags |= flags; | 1694 | mp->m_qflags |= flags; |
1735 | 1695 | ||
1736 | xfs_qm_dquot_list_print(mp); | ||
1737 | |||
1738 | error_return: | 1696 | error_return: |
1739 | if (error) { | 1697 | if (error) { |
1740 | xfs_warn(mp, | 1698 | xfs_warn(mp, |
@@ -2096,9 +2054,6 @@ xfs_qm_write_sb_changes( | |||
2096 | xfs_trans_t *tp; | 2054 | xfs_trans_t *tp; |
2097 | int error; | 2055 | int error; |
2098 | 2056 | ||
2099 | #ifdef QUOTADEBUG | ||
2100 | xfs_notice(mp, "Writing superblock quota changes"); | ||
2101 | #endif | ||
2102 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); | 2057 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); |
2103 | if ((error = xfs_trans_reserve(tp, 0, | 2058 | if ((error = xfs_trans_reserve(tp, 0, |
2104 | mp->m_sb.sb_sectsize + 128, 0, | 2059 | mp->m_sb.sb_sectsize + 128, 0, |
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h index 567b29b9f1b3..43b9abe1052c 100644 --- a/fs/xfs/quota/xfs_qm.h +++ b/fs/xfs/quota/xfs_qm.h | |||
@@ -163,10 +163,4 @@ extern int xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *); | |||
163 | extern int xfs_qm_scall_quotaon(xfs_mount_t *, uint); | 163 | extern int xfs_qm_scall_quotaon(xfs_mount_t *, uint); |
164 | extern int xfs_qm_scall_quotaoff(xfs_mount_t *, uint); | 164 | extern int xfs_qm_scall_quotaoff(xfs_mount_t *, uint); |
165 | 165 | ||
166 | #ifdef DEBUG | ||
167 | extern int xfs_qm_internalqcheck(xfs_mount_t *); | ||
168 | #else | ||
169 | #define xfs_qm_internalqcheck(mp) (0) | ||
170 | #endif | ||
171 | |||
172 | #endif /* __XFS_QM_H__ */ | 166 | #endif /* __XFS_QM_H__ */ |
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c index f2dfc74ccf34..609246f42e6c 100644 --- a/fs/xfs/quota/xfs_qm_syscalls.c +++ b/fs/xfs/quota/xfs_qm_syscalls.c | |||
@@ -622,7 +622,6 @@ xfs_qm_scall_setqlim( | |||
622 | xfs_trans_log_dquot(tp, dqp); | 622 | xfs_trans_log_dquot(tp, dqp); |
623 | 623 | ||
624 | error = xfs_trans_commit(tp, 0); | 624 | error = xfs_trans_commit(tp, 0); |
625 | xfs_qm_dqprint(dqp); | ||
626 | xfs_qm_dqrele(dqp); | 625 | xfs_qm_dqrele(dqp); |
627 | 626 | ||
628 | out_unlock: | 627 | out_unlock: |
@@ -657,7 +656,6 @@ xfs_qm_scall_getquota( | |||
657 | xfs_qm_dqput(dqp); | 656 | xfs_qm_dqput(dqp); |
658 | return XFS_ERROR(ENOENT); | 657 | return XFS_ERROR(ENOENT); |
659 | } | 658 | } |
660 | /* xfs_qm_dqprint(dqp); */ | ||
661 | /* | 659 | /* |
662 | * Convert the disk dquot to the exportable format | 660 | * Convert the disk dquot to the exportable format |
663 | */ | 661 | */ |
@@ -906,354 +904,3 @@ xfs_qm_dqrele_all_inodes( | |||
906 | ASSERT(mp->m_quotainfo); | 904 | ASSERT(mp->m_quotainfo); |
907 | xfs_inode_ag_iterator(mp, xfs_dqrele_inode, flags); | 905 | xfs_inode_ag_iterator(mp, xfs_dqrele_inode, flags); |
908 | } | 906 | } |
909 | |||
910 | /*------------------------------------------------------------------------*/ | ||
911 | #ifdef DEBUG | ||
912 | /* | ||
913 | * This contains all the test functions for XFS disk quotas. | ||
914 | * Currently it does a quota accounting check. ie. it walks through | ||
915 | * all inodes in the file system, calculating the dquot accounting fields, | ||
916 | * and prints out any inconsistencies. | ||
917 | */ | ||
918 | xfs_dqhash_t *qmtest_udqtab; | ||
919 | xfs_dqhash_t *qmtest_gdqtab; | ||
920 | int qmtest_hashmask; | ||
921 | int qmtest_nfails; | ||
922 | struct mutex qcheck_lock; | ||
923 | |||
924 | #define DQTEST_HASHVAL(mp, id) (((__psunsigned_t)(mp) + \ | ||
925 | (__psunsigned_t)(id)) & \ | ||
926 | (qmtest_hashmask - 1)) | ||
927 | |||
928 | #define DQTEST_HASH(mp, id, type) ((type & XFS_DQ_USER) ? \ | ||
929 | (qmtest_udqtab + \ | ||
930 | DQTEST_HASHVAL(mp, id)) : \ | ||
931 | (qmtest_gdqtab + \ | ||
932 | DQTEST_HASHVAL(mp, id))) | ||
933 | |||
934 | #define DQTEST_LIST_PRINT(l, NXT, title) \ | ||
935 | { \ | ||
936 | xfs_dqtest_t *dqp; int i = 0;\ | ||
937 | xfs_debug(NULL, "%s (#%d)", title, (int) (l)->qh_nelems); \ | ||
938 | for (dqp = (xfs_dqtest_t *)(l)->qh_next; dqp != NULL; \ | ||
939 | dqp = (xfs_dqtest_t *)dqp->NXT) { \ | ||
940 | xfs_debug(dqp->q_mount, \ | ||
941 | " %d. \"%d (%s)\" bcnt = %d, icnt = %d", \ | ||
942 | ++i, dqp->d_id, DQFLAGTO_TYPESTR(dqp), \ | ||
943 | dqp->d_bcount, dqp->d_icount); } \ | ||
944 | } | ||
945 | |||
946 | typedef struct dqtest { | ||
947 | uint dq_flags; /* various flags (XFS_DQ_*) */ | ||
948 | struct list_head q_hashlist; | ||
949 | xfs_dqhash_t *q_hash; /* the hashchain header */ | ||
950 | xfs_mount_t *q_mount; /* filesystem this relates to */ | ||
951 | xfs_dqid_t d_id; /* user id or group id */ | ||
952 | xfs_qcnt_t d_bcount; /* # disk blocks owned by the user */ | ||
953 | xfs_qcnt_t d_icount; /* # inodes owned by the user */ | ||
954 | } xfs_dqtest_t; | ||
955 | |||
956 | STATIC void | ||
957 | xfs_qm_hashinsert(xfs_dqhash_t *h, xfs_dqtest_t *dqp) | ||
958 | { | ||
959 | list_add(&dqp->q_hashlist, &h->qh_list); | ||
960 | h->qh_version++; | ||
961 | h->qh_nelems++; | ||
962 | } | ||
963 | STATIC void | ||
964 | xfs_qm_dqtest_print( | ||
965 | struct xfs_mount *mp, | ||
966 | struct dqtest *d) | ||
967 | { | ||
968 | xfs_debug(mp, "-----------DQTEST DQUOT----------------"); | ||
969 | xfs_debug(mp, "---- dquot ID = %d", d->d_id); | ||
970 | xfs_debug(mp, "---- fs = 0x%p", d->q_mount); | ||
971 | xfs_debug(mp, "---- bcount = %Lu (0x%x)", | ||
972 | d->d_bcount, (int)d->d_bcount); | ||
973 | xfs_debug(mp, "---- icount = %Lu (0x%x)", | ||
974 | d->d_icount, (int)d->d_icount); | ||
975 | xfs_debug(mp, "---------------------------"); | ||
976 | } | ||
977 | |||
978 | STATIC void | ||
979 | xfs_qm_dqtest_failed( | ||
980 | xfs_dqtest_t *d, | ||
981 | xfs_dquot_t *dqp, | ||
982 | char *reason, | ||
983 | xfs_qcnt_t a, | ||
984 | xfs_qcnt_t b, | ||
985 | int error) | ||
986 | { | ||
987 | qmtest_nfails++; | ||
988 | if (error) | ||
989 | xfs_debug(dqp->q_mount, | ||
990 | "quotacheck failed id=%d, err=%d\nreason: %s", | ||
991 | d->d_id, error, reason); | ||
992 | else | ||
993 | xfs_debug(dqp->q_mount, | ||
994 | "quotacheck failed id=%d (%s) [%d != %d]", | ||
995 | d->d_id, reason, (int)a, (int)b); | ||
996 | xfs_qm_dqtest_print(dqp->q_mount, d); | ||
997 | if (dqp) | ||
998 | xfs_qm_dqprint(dqp); | ||
999 | } | ||
1000 | |||
1001 | STATIC int | ||
1002 | xfs_dqtest_cmp2( | ||
1003 | xfs_dqtest_t *d, | ||
1004 | xfs_dquot_t *dqp) | ||
1005 | { | ||
1006 | int err = 0; | ||
1007 | if (be64_to_cpu(dqp->q_core.d_icount) != d->d_icount) { | ||
1008 | xfs_qm_dqtest_failed(d, dqp, "icount mismatch", | ||
1009 | be64_to_cpu(dqp->q_core.d_icount), | ||
1010 | d->d_icount, 0); | ||
1011 | err++; | ||
1012 | } | ||
1013 | if (be64_to_cpu(dqp->q_core.d_bcount) != d->d_bcount) { | ||
1014 | xfs_qm_dqtest_failed(d, dqp, "bcount mismatch", | ||
1015 | be64_to_cpu(dqp->q_core.d_bcount), | ||
1016 | d->d_bcount, 0); | ||
1017 | err++; | ||
1018 | } | ||
1019 | if (dqp->q_core.d_blk_softlimit && | ||
1020 | be64_to_cpu(dqp->q_core.d_bcount) >= | ||
1021 | be64_to_cpu(dqp->q_core.d_blk_softlimit)) { | ||
1022 | if (!dqp->q_core.d_btimer && dqp->q_core.d_id) { | ||
1023 | xfs_debug(dqp->q_mount, | ||
1024 | "%d [%s] BLK TIMER NOT STARTED", | ||
1025 | d->d_id, DQFLAGTO_TYPESTR(d)); | ||
1026 | err++; | ||
1027 | } | ||
1028 | } | ||
1029 | if (dqp->q_core.d_ino_softlimit && | ||
1030 | be64_to_cpu(dqp->q_core.d_icount) >= | ||
1031 | be64_to_cpu(dqp->q_core.d_ino_softlimit)) { | ||
1032 | if (!dqp->q_core.d_itimer && dqp->q_core.d_id) { | ||
1033 | xfs_debug(dqp->q_mount, | ||
1034 | "%d [%s] INO TIMER NOT STARTED", | ||
1035 | d->d_id, DQFLAGTO_TYPESTR(d)); | ||
1036 | err++; | ||
1037 | } | ||
1038 | } | ||
1039 | #ifdef QUOTADEBUG | ||
1040 | if (!err) { | ||
1041 | xfs_debug(dqp->q_mount, "%d [%s] qchecked", | ||
1042 | d->d_id, DQFLAGTO_TYPESTR(d)); | ||
1043 | } | ||
1044 | #endif | ||
1045 | return (err); | ||
1046 | } | ||
1047 | |||
1048 | STATIC void | ||
1049 | xfs_dqtest_cmp( | ||
1050 | xfs_dqtest_t *d) | ||
1051 | { | ||
1052 | xfs_dquot_t *dqp; | ||
1053 | int error; | ||
1054 | |||
1055 | /* xfs_qm_dqtest_print(d); */ | ||
1056 | if ((error = xfs_qm_dqget(d->q_mount, NULL, d->d_id, d->dq_flags, 0, | ||
1057 | &dqp))) { | ||
1058 | xfs_qm_dqtest_failed(d, NULL, "dqget failed", 0, 0, error); | ||
1059 | return; | ||
1060 | } | ||
1061 | xfs_dqtest_cmp2(d, dqp); | ||
1062 | xfs_qm_dqput(dqp); | ||
1063 | } | ||
1064 | |||
1065 | STATIC int | ||
1066 | xfs_qm_internalqcheck_dqget( | ||
1067 | xfs_mount_t *mp, | ||
1068 | xfs_dqid_t id, | ||
1069 | uint type, | ||
1070 | xfs_dqtest_t **O_dq) | ||
1071 | { | ||
1072 | xfs_dqtest_t *d; | ||
1073 | xfs_dqhash_t *h; | ||
1074 | |||
1075 | h = DQTEST_HASH(mp, id, type); | ||
1076 | list_for_each_entry(d, &h->qh_list, q_hashlist) { | ||
1077 | if (d->d_id == id && mp == d->q_mount) { | ||
1078 | *O_dq = d; | ||
1079 | return (0); | ||
1080 | } | ||
1081 | } | ||
1082 | d = kmem_zalloc(sizeof(xfs_dqtest_t), KM_SLEEP); | ||
1083 | d->dq_flags = type; | ||
1084 | d->d_id = id; | ||
1085 | d->q_mount = mp; | ||
1086 | d->q_hash = h; | ||
1087 | INIT_LIST_HEAD(&d->q_hashlist); | ||
1088 | xfs_qm_hashinsert(h, d); | ||
1089 | *O_dq = d; | ||
1090 | return (0); | ||
1091 | } | ||
1092 | |||
1093 | STATIC void | ||
1094 | xfs_qm_internalqcheck_get_dquots( | ||
1095 | xfs_mount_t *mp, | ||
1096 | xfs_dqid_t uid, | ||
1097 | xfs_dqid_t projid, | ||
1098 | xfs_dqid_t gid, | ||
1099 | xfs_dqtest_t **ud, | ||
1100 | xfs_dqtest_t **gd) | ||
1101 | { | ||
1102 | if (XFS_IS_UQUOTA_ON(mp)) | ||
1103 | xfs_qm_internalqcheck_dqget(mp, uid, XFS_DQ_USER, ud); | ||
1104 | if (XFS_IS_GQUOTA_ON(mp)) | ||
1105 | xfs_qm_internalqcheck_dqget(mp, gid, XFS_DQ_GROUP, gd); | ||
1106 | else if (XFS_IS_PQUOTA_ON(mp)) | ||
1107 | xfs_qm_internalqcheck_dqget(mp, projid, XFS_DQ_PROJ, gd); | ||
1108 | } | ||
1109 | |||
1110 | |||
1111 | STATIC void | ||
1112 | xfs_qm_internalqcheck_dqadjust( | ||
1113 | xfs_inode_t *ip, | ||
1114 | xfs_dqtest_t *d) | ||
1115 | { | ||
1116 | d->d_icount++; | ||
1117 | d->d_bcount += (xfs_qcnt_t)ip->i_d.di_nblocks; | ||
1118 | } | ||
1119 | |||
1120 | STATIC int | ||
1121 | xfs_qm_internalqcheck_adjust( | ||
1122 | xfs_mount_t *mp, /* mount point for filesystem */ | ||
1123 | xfs_ino_t ino, /* inode number to get data for */ | ||
1124 | void __user *buffer, /* not used */ | ||
1125 | int ubsize, /* not used */ | ||
1126 | int *ubused, /* not used */ | ||
1127 | int *res) /* bulkstat result code */ | ||
1128 | { | ||
1129 | xfs_inode_t *ip; | ||
1130 | xfs_dqtest_t *ud, *gd; | ||
1131 | uint lock_flags; | ||
1132 | boolean_t ipreleased; | ||
1133 | int error; | ||
1134 | |||
1135 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); | ||
1136 | |||
1137 | if (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino) { | ||
1138 | *res = BULKSTAT_RV_NOTHING; | ||
1139 | xfs_debug(mp, "%s: ino=%llu, uqino=%llu, gqino=%llu\n", | ||
1140 | __func__, (unsigned long long) ino, | ||
1141 | (unsigned long long) mp->m_sb.sb_uquotino, | ||
1142 | (unsigned long long) mp->m_sb.sb_gquotino); | ||
1143 | return XFS_ERROR(EINVAL); | ||
1144 | } | ||
1145 | ipreleased = B_FALSE; | ||
1146 | again: | ||
1147 | lock_flags = XFS_ILOCK_SHARED; | ||
1148 | if ((error = xfs_iget(mp, NULL, ino, 0, lock_flags, &ip))) { | ||
1149 | *res = BULKSTAT_RV_NOTHING; | ||
1150 | return (error); | ||
1151 | } | ||
1152 | |||
1153 | /* | ||
1154 | * This inode can have blocks after eof which can get released | ||
1155 | * when we send it to inactive. Since we don't check the dquot | ||
1156 | * until the after all our calculations are done, we must get rid | ||
1157 | * of those now. | ||
1158 | */ | ||
1159 | if (! ipreleased) { | ||
1160 | xfs_iunlock(ip, lock_flags); | ||
1161 | IRELE(ip); | ||
1162 | ipreleased = B_TRUE; | ||
1163 | goto again; | ||
1164 | } | ||
1165 | xfs_qm_internalqcheck_get_dquots(mp, | ||
1166 | (xfs_dqid_t) ip->i_d.di_uid, | ||
1167 | (xfs_dqid_t) xfs_get_projid(ip), | ||
1168 | (xfs_dqid_t) ip->i_d.di_gid, | ||
1169 | &ud, &gd); | ||
1170 | if (XFS_IS_UQUOTA_ON(mp)) { | ||
1171 | ASSERT(ud); | ||
1172 | xfs_qm_internalqcheck_dqadjust(ip, ud); | ||
1173 | } | ||
1174 | if (XFS_IS_OQUOTA_ON(mp)) { | ||
1175 | ASSERT(gd); | ||
1176 | xfs_qm_internalqcheck_dqadjust(ip, gd); | ||
1177 | } | ||
1178 | xfs_iunlock(ip, lock_flags); | ||
1179 | IRELE(ip); | ||
1180 | *res = BULKSTAT_RV_DIDONE; | ||
1181 | return (0); | ||
1182 | } | ||
1183 | |||
1184 | |||
1185 | /* PRIVATE, debugging */ | ||
1186 | int | ||
1187 | xfs_qm_internalqcheck( | ||
1188 | xfs_mount_t *mp) | ||
1189 | { | ||
1190 | xfs_ino_t lastino; | ||
1191 | int done, count; | ||
1192 | int i; | ||
1193 | int error; | ||
1194 | |||
1195 | lastino = 0; | ||
1196 | qmtest_hashmask = 32; | ||
1197 | count = 5; | ||
1198 | done = 0; | ||
1199 | qmtest_nfails = 0; | ||
1200 | |||
1201 | if (! XFS_IS_QUOTA_ON(mp)) | ||
1202 | return XFS_ERROR(ESRCH); | ||
1203 | |||
1204 | xfs_log_force(mp, XFS_LOG_SYNC); | ||
1205 | XFS_bflush(mp->m_ddev_targp); | ||
1206 | xfs_log_force(mp, XFS_LOG_SYNC); | ||
1207 | XFS_bflush(mp->m_ddev_targp); | ||
1208 | |||
1209 | mutex_lock(&qcheck_lock); | ||
1210 | /* There should be absolutely no quota activity while this | ||
1211 | is going on. */ | ||
1212 | qmtest_udqtab = kmem_zalloc(qmtest_hashmask * | ||
1213 | sizeof(xfs_dqhash_t), KM_SLEEP); | ||
1214 | qmtest_gdqtab = kmem_zalloc(qmtest_hashmask * | ||
1215 | sizeof(xfs_dqhash_t), KM_SLEEP); | ||
1216 | do { | ||
1217 | /* | ||
1218 | * Iterate thru all the inodes in the file system, | ||
1219 | * adjusting the corresponding dquot counters | ||
1220 | */ | ||
1221 | error = xfs_bulkstat(mp, &lastino, &count, | ||
1222 | xfs_qm_internalqcheck_adjust, | ||
1223 | 0, NULL, &done); | ||
1224 | if (error) { | ||
1225 | xfs_debug(mp, "Bulkstat returned error 0x%x", error); | ||
1226 | break; | ||
1227 | } | ||
1228 | } while (!done); | ||
1229 | |||
1230 | xfs_debug(mp, "Checking results against system dquots"); | ||
1231 | for (i = 0; i < qmtest_hashmask; i++) { | ||
1232 | xfs_dqtest_t *d, *n; | ||
1233 | xfs_dqhash_t *h; | ||
1234 | |||
1235 | h = &qmtest_udqtab[i]; | ||
1236 | list_for_each_entry_safe(d, n, &h->qh_list, q_hashlist) { | ||
1237 | xfs_dqtest_cmp(d); | ||
1238 | kmem_free(d); | ||
1239 | } | ||
1240 | h = &qmtest_gdqtab[i]; | ||
1241 | list_for_each_entry_safe(d, n, &h->qh_list, q_hashlist) { | ||
1242 | xfs_dqtest_cmp(d); | ||
1243 | kmem_free(d); | ||
1244 | } | ||
1245 | } | ||
1246 | |||
1247 | if (qmtest_nfails) { | ||
1248 | xfs_debug(mp, "******** quotacheck failed ********"); | ||
1249 | xfs_debug(mp, "failures = %d", qmtest_nfails); | ||
1250 | } else { | ||
1251 | xfs_debug(mp, "******** quotacheck successful! ********"); | ||
1252 | } | ||
1253 | kmem_free(qmtest_udqtab); | ||
1254 | kmem_free(qmtest_gdqtab); | ||
1255 | mutex_unlock(&qcheck_lock); | ||
1256 | return (qmtest_nfails); | ||
1257 | } | ||
1258 | |||
1259 | #endif /* DEBUG */ | ||
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c index 24084edb7803..4d00ee67792d 100644 --- a/fs/xfs/quota/xfs_trans_dquot.c +++ b/fs/xfs/quota/xfs_trans_dquot.c | |||
@@ -387,18 +387,18 @@ xfs_trans_apply_dquot_deltas( | |||
387 | qtrx->qt_delbcnt_delta; | 387 | qtrx->qt_delbcnt_delta; |
388 | totalrtbdelta = qtrx->qt_rtbcount_delta + | 388 | totalrtbdelta = qtrx->qt_rtbcount_delta + |
389 | qtrx->qt_delrtb_delta; | 389 | qtrx->qt_delrtb_delta; |
390 | #ifdef QUOTADEBUG | 390 | #ifdef DEBUG |
391 | if (totalbdelta < 0) | 391 | if (totalbdelta < 0) |
392 | ASSERT(be64_to_cpu(d->d_bcount) >= | 392 | ASSERT(be64_to_cpu(d->d_bcount) >= |
393 | (xfs_qcnt_t) -totalbdelta); | 393 | -totalbdelta); |
394 | 394 | ||
395 | if (totalrtbdelta < 0) | 395 | if (totalrtbdelta < 0) |
396 | ASSERT(be64_to_cpu(d->d_rtbcount) >= | 396 | ASSERT(be64_to_cpu(d->d_rtbcount) >= |
397 | (xfs_qcnt_t) -totalrtbdelta); | 397 | -totalrtbdelta); |
398 | 398 | ||
399 | if (qtrx->qt_icount_delta < 0) | 399 | if (qtrx->qt_icount_delta < 0) |
400 | ASSERT(be64_to_cpu(d->d_icount) >= | 400 | ASSERT(be64_to_cpu(d->d_icount) >= |
401 | (xfs_qcnt_t) -qtrx->qt_icount_delta); | 401 | -qtrx->qt_icount_delta); |
402 | #endif | 402 | #endif |
403 | if (totalbdelta) | 403 | if (totalbdelta) |
404 | be64_add_cpu(&d->d_bcount, (xfs_qcnt_t)totalbdelta); | 404 | be64_add_cpu(&d->d_bcount, (xfs_qcnt_t)totalbdelta); |
@@ -642,11 +642,6 @@ xfs_trans_dqresv( | |||
642 | ((XFS_IS_UQUOTA_ENFORCED(dqp->q_mount) && XFS_QM_ISUDQ(dqp)) || | 642 | ((XFS_IS_UQUOTA_ENFORCED(dqp->q_mount) && XFS_QM_ISUDQ(dqp)) || |
643 | (XFS_IS_OQUOTA_ENFORCED(dqp->q_mount) && | 643 | (XFS_IS_OQUOTA_ENFORCED(dqp->q_mount) && |
644 | (XFS_QM_ISPDQ(dqp) || XFS_QM_ISGDQ(dqp))))) { | 644 | (XFS_QM_ISPDQ(dqp) || XFS_QM_ISGDQ(dqp))))) { |
645 | #ifdef QUOTADEBUG | ||
646 | xfs_debug(mp, | ||
647 | "BLK Res: nblks=%ld + resbcount=%Ld > hardlimit=%Ld?", | ||
648 | nblks, *resbcountp, hardlimit); | ||
649 | #endif | ||
650 | if (nblks > 0) { | 645 | if (nblks > 0) { |
651 | /* | 646 | /* |
652 | * dquot is locked already. See if we'd go over the | 647 | * dquot is locked already. See if we'd go over the |
diff --git a/fs/xfs/xfs.h b/fs/xfs/xfs.h index 5ad8ad3a1dcd..53ec3ea9a625 100644 --- a/fs/xfs/xfs.h +++ b/fs/xfs/xfs.h | |||
@@ -22,7 +22,6 @@ | |||
22 | #define STATIC | 22 | #define STATIC |
23 | #define DEBUG 1 | 23 | #define DEBUG 1 |
24 | #define XFS_BUF_LOCK_TRACKING 1 | 24 | #define XFS_BUF_LOCK_TRACKING 1 |
25 | /* #define QUOTADEBUG 1 */ | ||
26 | #endif | 25 | #endif |
27 | 26 | ||
28 | #include <linux-2.6/xfs_linux.h> | 27 | #include <linux-2.6/xfs_linux.h> |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index a19e92381f90..1fe643aa0efd 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -1089,10 +1089,6 @@ xfs_mount_reset_sbqflags( | |||
1089 | if (mp->m_flags & XFS_MOUNT_RDONLY) | 1089 | if (mp->m_flags & XFS_MOUNT_RDONLY) |
1090 | return 0; | 1090 | return 0; |
1091 | 1091 | ||
1092 | #ifdef QUOTADEBUG | ||
1093 | xfs_notice(mp, "Writing superblock quota changes"); | ||
1094 | #endif | ||
1095 | |||
1096 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); | 1092 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); |
1097 | error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, | 1093 | error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, |
1098 | XFS_DEFAULT_LOG_COUNT); | 1094 | XFS_DEFAULT_LOG_COUNT); |