aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_qm.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-12-06 16:58:16 -0500
committerBen Myers <bpm@sgi.com>2011-12-13 15:55:54 -0500
commit80a376bfb7f8ff8f1942cb1bdd0052e908918252 (patch)
treef370553d188065bfa2722b74076ef81b111cd477 /fs/xfs/xfs_qm.c
parent497507b9ee63499d364ad7149c584285cd925dfc (diff)
xfs: remove XFS_DQ_INACTIVE
Free dquots when purging them during umount instead of keeping them around on the freelist in a degraded state. The out of order locking in xfs_qm_dqpurge will be removed again later in this series. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_qm.c')
-rw-r--r--fs/xfs/xfs_qm.c61
1 files changed, 6 insertions, 55 deletions
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 6535c4e5f87..be1df683923 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -154,12 +154,17 @@ STATIC void
154xfs_qm_destroy( 154xfs_qm_destroy(
155 struct xfs_qm *xqm) 155 struct xfs_qm *xqm)
156{ 156{
157 struct xfs_dquot *dqp, *n;
158 int hsize, i; 157 int hsize, i;
159 158
160 ASSERT(xqm != NULL); 159 ASSERT(xqm != NULL);
161 ASSERT(xqm->qm_nrefs == 0); 160 ASSERT(xqm->qm_nrefs == 0);
161
162 unregister_shrinker(&xfs_qm_shaker); 162 unregister_shrinker(&xfs_qm_shaker);
163
164 mutex_lock(&xqm->qm_dqfrlist_lock);
165 ASSERT(list_empty(&xqm->qm_dqfrlist));
166 mutex_unlock(&xqm->qm_dqfrlist_lock);
167
163 hsize = xqm->qm_dqhashmask + 1; 168 hsize = xqm->qm_dqhashmask + 1;
164 for (i = 0; i < hsize; i++) { 169 for (i = 0; i < hsize; i++) {
165 xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i])); 170 xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i]));
@@ -171,17 +176,6 @@ xfs_qm_destroy(
171 xqm->qm_grp_dqhtable = NULL; 176 xqm->qm_grp_dqhtable = NULL;
172 xqm->qm_dqhashmask = 0; 177 xqm->qm_dqhashmask = 0;
173 178
174 /* frlist cleanup */
175 mutex_lock(&xqm->qm_dqfrlist_lock);
176 list_for_each_entry_safe(dqp, n, &xqm->qm_dqfrlist, q_freelist) {
177 xfs_dqlock(dqp);
178 list_del_init(&dqp->q_freelist);
179 xfs_Gqm->qm_dqfrlist_cnt--;
180 xfs_dqunlock(dqp);
181 xfs_qm_dqdestroy(dqp);
182 }
183 mutex_unlock(&xqm->qm_dqfrlist_lock);
184 mutex_destroy(&xqm->qm_dqfrlist_lock);
185 kmem_free(xqm); 179 kmem_free(xqm);
186} 180}
187 181
@@ -232,34 +226,10 @@ STATIC void
232xfs_qm_rele_quotafs_ref( 226xfs_qm_rele_quotafs_ref(
233 struct xfs_mount *mp) 227 struct xfs_mount *mp)
234{ 228{
235 xfs_dquot_t *dqp, *n;
236
237 ASSERT(xfs_Gqm); 229 ASSERT(xfs_Gqm);
238 ASSERT(xfs_Gqm->qm_nrefs > 0); 230 ASSERT(xfs_Gqm->qm_nrefs > 0);
239 231
240 /* 232 /*
241 * Go thru the freelist and destroy all inactive dquots.
242 */
243 mutex_lock(&xfs_Gqm->qm_dqfrlist_lock);
244
245 list_for_each_entry_safe(dqp, n, &xfs_Gqm->qm_dqfrlist, q_freelist) {
246 xfs_dqlock(dqp);
247 if (dqp->dq_flags & XFS_DQ_INACTIVE) {
248 ASSERT(dqp->q_mount == NULL);
249 ASSERT(! XFS_DQ_IS_DIRTY(dqp));
250 ASSERT(list_empty(&dqp->q_hashlist));
251 ASSERT(list_empty(&dqp->q_mplist));
252 list_del_init(&dqp->q_freelist);
253 xfs_Gqm->qm_dqfrlist_cnt--;
254 xfs_dqunlock(dqp);
255 xfs_qm_dqdestroy(dqp);
256 } else {
257 xfs_dqunlock(dqp);
258 }
259 }
260 mutex_unlock(&xfs_Gqm->qm_dqfrlist_lock);
261
262 /*
263 * Destroy the entire XQM. If somebody mounts with quotaon, this'll 233 * Destroy the entire XQM. If somebody mounts with quotaon, this'll
264 * be restarted. 234 * be restarted.
265 */ 235 */
@@ -1728,8 +1698,6 @@ again:
1728 * both the dquot and the freelistlock. 1698 * both the dquot and the freelistlock.
1729 */ 1699 */
1730 if (dqp->dq_flags & XFS_DQ_WANT) { 1700 if (dqp->dq_flags & XFS_DQ_WANT) {
1731 ASSERT(! (dqp->dq_flags & XFS_DQ_INACTIVE));
1732
1733 trace_xfs_dqreclaim_want(dqp); 1701 trace_xfs_dqreclaim_want(dqp);
1734 XQM_STATS_INC(xqmstats.xs_qm_dqwants); 1702 XQM_STATS_INC(xqmstats.xs_qm_dqwants);
1735 restarts++; 1703 restarts++;
@@ -1737,23 +1705,6 @@ again:
1737 goto dqunlock; 1705 goto dqunlock;
1738 } 1706 }
1739 1707
1740 /*
1741 * If the dquot is inactive, we are assured that it is
1742 * not on the mplist or the hashlist, and that makes our
1743 * life easier.
1744 */
1745 if (dqp->dq_flags & XFS_DQ_INACTIVE) {
1746 ASSERT(mp == NULL);
1747 ASSERT(! XFS_DQ_IS_DIRTY(dqp));
1748 ASSERT(list_empty(&dqp->q_hashlist));
1749 ASSERT(list_empty(&dqp->q_mplist));
1750 list_del_init(&dqp->q_freelist);
1751 xfs_Gqm->qm_dqfrlist_cnt--;
1752 dqpout = dqp;
1753 XQM_STATS_INC(xqmstats.xs_qm_dqinact_reclaims);
1754 goto dqunlock;
1755 }
1756
1757 ASSERT(dqp->q_hash); 1708 ASSERT(dqp->q_hash);
1758 ASSERT(!list_empty(&dqp->q_mplist)); 1709 ASSERT(!list_empty(&dqp->q_mplist));
1759 1710