aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2023-08-23 21:38:04 +0200
committerAndreas Gruenbacher <agruenba@redhat.com>2023-09-05 15:58:16 +0200
commit961fe3422e055d251b32a117cd8cd3d27153bc96 (patch)
treec378d81257430aa8c11bc253847333b2aaccf5b9
parent6b0e9a5f1e6d7f2719856b601d5639902fc0ee4f (diff)
downloadlinux-961fe3422e055d251b32a117cd8cd3d27153bc96.tar.gz
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: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r--fs/gfs2/quota.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index f58072efafc943..976bf1097706f3 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -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);