Commit 961fe342 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher
Browse files

gfs2: Use gfs2_qd_dispose in gfs2_quota_cleanup



Change gfs2_quota_cleanup() to move the quota data objects to dispose of
on a dispose list and call gfs2_qd_dispose() on that list, like
gfs2_qd_shrink_scan() does, instead of disposing of the quota data
objects directly.

This may look a bit pointless by itself, but it will make more sense in
combination with a fix that follows.

Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 6b0e9a5f
Loading
Loading
Loading
Loading
+4 −22
Original line number Diff line number Diff line
@@ -1459,35 +1459,17 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)

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);