Commit faada74a authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Factor out duplicate quota data disposal code

Rename gfs2_qd_dispose() to gfs2_qd_dispose_list().  Move some code
duplicated in gfs2_qd_dispose_list() and gfs2_quota_cleanup() into a
new gfs2_qd_dispose() function.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 961fe342
......@@ -112,18 +112,10 @@ static void gfs2_qd_dealloc(struct rcu_head *rcu)
kmem_cache_free(gfs2_quotad_cachep, qd);
}
static void gfs2_qd_dispose(struct list_head *list)
static void gfs2_qd_dispose(struct gfs2_quota_data *qd)
{
struct gfs2_quota_data *qd;
struct gfs2_sbd *sdp;
while (!list_empty(list)) {
qd = list_first_entry(list, struct gfs2_quota_data, qd_lru);
sdp = qd->qd_sbd;
list_del(&qd->qd_lru);
struct gfs2_sbd *sdp = qd->qd_sbd;
/* Free from the filesystem-specific list */
spin_lock(&qd_lock);
list_del(&qd->qd_list);
spin_unlock(&qd_lock);
......@@ -137,10 +129,19 @@ static void gfs2_qd_dispose(struct list_head *list)
gfs2_assert_warn(sdp, !qd->qd_bh_count);
gfs2_glock_put(qd->qd_gl);
atomic_dec(&sdp->sd_quota_count);
/* Delete it from the common reclaim list */
call_rcu(&qd->qd_rcu, gfs2_qd_dealloc);
}
static void gfs2_qd_list_dispose(struct list_head *list)
{
struct gfs2_quota_data *qd;
while (!list_empty(list)) {
qd = list_first_entry(list, struct gfs2_quota_data, qd_lru);
list_del(&qd->qd_lru);
gfs2_qd_dispose(qd);
atomic_dec(&sdp->sd_quota_count);
}
}
......@@ -179,7 +180,7 @@ static unsigned long gfs2_qd_shrink_scan(struct shrinker *shrink,
freed = list_lru_shrink_walk(&gfs2_qd_lru, sc,
gfs2_qd_isolate, &dispose);
gfs2_qd_dispose(&dispose);
gfs2_qd_list_dispose(&dispose);
return freed;
}
......@@ -1469,7 +1470,7 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
}
spin_unlock(&qd_lock);
gfs2_qd_dispose(&dispose);
gfs2_qd_list_dispose(&dispose);
gfs2_assert_warn(sdp, !atomic_read(&sdp->sd_quota_count));
kvfree(sdp->sd_quota_bitmap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment