gfs2: Use gfs2_qd_dispose in gfs2_quota_cleanup
[sfrench/cifs-2.6.git] / fs / gfs2 / quota.c
index f58072efafc943c2e5ee6582e51ec0451a376cc7..976bf1097706f3997b32b38bfc623f43b6501c6c 100644 (file)
@@ -1459,35 +1459,17 @@ fail:
 
 void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
 {
-       struct list_head *head = &sdp->sd_quota_list;
        struct gfs2_quota_data *qd;
+       LIST_HEAD(dispose);
 
        spin_lock(&qd_lock);
-       while (!list_empty(head)) {
-               qd = list_last_entry(head, struct gfs2_quota_data, qd_list);
-
-               list_del(&qd->qd_list);
-
-               /* Also remove if this qd exists in the reclaim list */
+       list_for_each_entry(qd, &sdp->sd_quota_list, qd_list) {
                list_lru_del(&gfs2_qd_lru, &qd->qd_lru);
-               atomic_dec(&sdp->sd_quota_count);
-               spin_unlock(&qd_lock);
-
-               spin_lock_bucket(qd->qd_hash);
-               hlist_bl_del_rcu(&qd->qd_hlist);
-               spin_unlock_bucket(qd->qd_hash);
-
-               gfs2_assert_warn(sdp, !qd->qd_change);
-               gfs2_assert_warn(sdp, !qd->qd_slot_count);
-               gfs2_assert_warn(sdp, !qd->qd_bh_count);
-
-               gfs2_glock_put(qd->qd_gl);
-               call_rcu(&qd->qd_rcu, gfs2_qd_dealloc);
-
-               spin_lock(&qd_lock);
+               list_add(&qd->qd_lru, &dispose);
        }
        spin_unlock(&qd_lock);
 
+       gfs2_qd_dispose(&dispose);
        gfs2_assert_warn(sdp, !atomic_read(&sdp->sd_quota_count));
 
        kvfree(sdp->sd_quota_bitmap);