Commit 7d80823e authored by Steven Whitehouse's avatar Steven Whitehouse

GFS2: Rename quota qd_lru_lock qd_lock

This is a straight forward rename which is in preparation for
introducing the generic list_lru infrastructure in the
following patch.
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
Signed-off-by: default avatarAbhijith Das <adas@redhat.com>
Tested-by: default avatarAbhijith Das <adas@redhat.com>
parent 9b9f039d
...@@ -74,7 +74,7 @@ struct gfs2_quota_change_host { ...@@ -74,7 +74,7 @@ struct gfs2_quota_change_host {
static LIST_HEAD(qd_lru_list); static LIST_HEAD(qd_lru_list);
static atomic_t qd_lru_count = ATOMIC_INIT(0); static atomic_t qd_lru_count = ATOMIC_INIT(0);
static DEFINE_SPINLOCK(qd_lru_lock); static DEFINE_SPINLOCK(qd_lock);
unsigned long gfs2_qd_shrink_scan(struct shrinker *shrink, unsigned long gfs2_qd_shrink_scan(struct shrinker *shrink,
struct shrink_control *sc) struct shrink_control *sc)
...@@ -87,7 +87,7 @@ unsigned long gfs2_qd_shrink_scan(struct shrinker *shrink, ...@@ -87,7 +87,7 @@ unsigned long gfs2_qd_shrink_scan(struct shrinker *shrink,
if (!(sc->gfp_mask & __GFP_FS)) if (!(sc->gfp_mask & __GFP_FS))
return SHRINK_STOP; return SHRINK_STOP;
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
while (nr_to_scan && !list_empty(&qd_lru_list)) { while (nr_to_scan && !list_empty(&qd_lru_list)) {
qd = list_entry(qd_lru_list.next, qd = list_entry(qd_lru_list.next,
struct gfs2_quota_data, qd_reclaim); struct gfs2_quota_data, qd_reclaim);
...@@ -106,13 +106,13 @@ unsigned long gfs2_qd_shrink_scan(struct shrinker *shrink, ...@@ -106,13 +106,13 @@ unsigned long gfs2_qd_shrink_scan(struct shrinker *shrink,
/* Delete it from the common reclaim list */ /* Delete it from the common reclaim list */
list_del_init(&qd->qd_reclaim); list_del_init(&qd->qd_reclaim);
atomic_dec(&qd_lru_count); atomic_dec(&qd_lru_count);
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
kmem_cache_free(gfs2_quotad_cachep, qd); kmem_cache_free(gfs2_quotad_cachep, qd);
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
nr_to_scan--; nr_to_scan--;
freed++; freed++;
} }
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
return freed; return freed;
} }
...@@ -179,7 +179,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid, ...@@ -179,7 +179,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid,
for (;;) { for (;;) {
found = 0; found = 0;
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
list_for_each_entry(qd, &sdp->sd_quota_list, qd_list) { list_for_each_entry(qd, &sdp->sd_quota_list, qd_list) {
if (qid_eq(qd->qd_id, qid)) { if (qid_eq(qd->qd_id, qid)) {
lockref_get(&qd->qd_lockref); lockref_get(&qd->qd_lockref);
...@@ -203,7 +203,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid, ...@@ -203,7 +203,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid,
new_qd = NULL; new_qd = NULL;
} }
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
if (qd) { if (qd) {
if (new_qd) { if (new_qd) {
...@@ -229,7 +229,7 @@ static void qd_hold(struct gfs2_quota_data *qd) ...@@ -229,7 +229,7 @@ static void qd_hold(struct gfs2_quota_data *qd)
static void qd_put(struct gfs2_quota_data *qd) static void qd_put(struct gfs2_quota_data *qd)
{ {
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
if (!lockref_put_or_lock(&qd->qd_lockref)) { if (!lockref_put_or_lock(&qd->qd_lockref)) {
...@@ -240,7 +240,7 @@ static void qd_put(struct gfs2_quota_data *qd) ...@@ -240,7 +240,7 @@ static void qd_put(struct gfs2_quota_data *qd)
spin_unlock(&qd->qd_lockref.lock); spin_unlock(&qd->qd_lockref.lock);
} }
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
} }
static int slot_get(struct gfs2_quota_data *qd) static int slot_get(struct gfs2_quota_data *qd)
...@@ -249,10 +249,10 @@ static int slot_get(struct gfs2_quota_data *qd) ...@@ -249,10 +249,10 @@ static int slot_get(struct gfs2_quota_data *qd)
unsigned int c, o = 0, b; unsigned int c, o = 0, b;
unsigned char byte = 0; unsigned char byte = 0;
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
if (qd->qd_slot_count++) { if (qd->qd_slot_count++) {
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
return 0; return 0;
} }
...@@ -276,13 +276,13 @@ static int slot_get(struct gfs2_quota_data *qd) ...@@ -276,13 +276,13 @@ static int slot_get(struct gfs2_quota_data *qd)
sdp->sd_quota_bitmap[c][o] |= 1 << b; sdp->sd_quota_bitmap[c][o] |= 1 << b;
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
return 0; return 0;
fail: fail:
qd->qd_slot_count--; qd->qd_slot_count--;
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
return -ENOSPC; return -ENOSPC;
} }
...@@ -290,10 +290,10 @@ static void slot_hold(struct gfs2_quota_data *qd) ...@@ -290,10 +290,10 @@ static void slot_hold(struct gfs2_quota_data *qd)
{ {
struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
gfs2_assert(sdp, qd->qd_slot_count); gfs2_assert(sdp, qd->qd_slot_count);
qd->qd_slot_count++; qd->qd_slot_count++;
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
} }
static void gfs2_icbit_munge(struct gfs2_sbd *sdp, unsigned char **bitmap, static void gfs2_icbit_munge(struct gfs2_sbd *sdp, unsigned char **bitmap,
...@@ -320,13 +320,13 @@ static void slot_put(struct gfs2_quota_data *qd) ...@@ -320,13 +320,13 @@ static void slot_put(struct gfs2_quota_data *qd)
{ {
struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
gfs2_assert(sdp, qd->qd_slot_count); gfs2_assert(sdp, qd->qd_slot_count);
if (!--qd->qd_slot_count) { if (!--qd->qd_slot_count) {
gfs2_icbit_munge(sdp, sdp->sd_quota_bitmap, qd->qd_slot, 0); gfs2_icbit_munge(sdp, sdp->sd_quota_bitmap, qd->qd_slot, 0);
qd->qd_slot = -1; qd->qd_slot = -1;
} }
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
} }
static int bh_get(struct gfs2_quota_data *qd) static int bh_get(struct gfs2_quota_data *qd)
...@@ -420,7 +420,7 @@ static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp) ...@@ -420,7 +420,7 @@ static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp)
if (sdp->sd_vfs->s_flags & MS_RDONLY) if (sdp->sd_vfs->s_flags & MS_RDONLY)
return 0; return 0;
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
list_for_each_entry(qd, &sdp->sd_quota_list, qd_list) { list_for_each_entry(qd, &sdp->sd_quota_list, qd_list) {
found = qd_check_sync(sdp, qd, &sdp->sd_quota_sync_gen); found = qd_check_sync(sdp, qd, &sdp->sd_quota_sync_gen);
...@@ -431,7 +431,7 @@ static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp) ...@@ -431,7 +431,7 @@ static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp)
if (!found) if (!found)
qd = NULL; qd = NULL;
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
if (qd) { if (qd) {
gfs2_assert_warn(sdp, qd->qd_change_sync); gfs2_assert_warn(sdp, qd->qd_change_sync);
...@@ -598,9 +598,9 @@ static void do_qc(struct gfs2_quota_data *qd, s64 change) ...@@ -598,9 +598,9 @@ static void do_qc(struct gfs2_quota_data *qd, s64 change)
x = be64_to_cpu(qc->qc_change) + change; x = be64_to_cpu(qc->qc_change) + change;
qc->qc_change = cpu_to_be64(x); qc->qc_change = cpu_to_be64(x);
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
qd->qd_change = x; qd->qd_change = x;
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
if (!x) { if (!x) {
gfs2_assert_warn(sdp, test_bit(QDF_CHANGE, &qd->qd_flags)); gfs2_assert_warn(sdp, test_bit(QDF_CHANGE, &qd->qd_flags));
...@@ -972,9 +972,9 @@ static int need_sync(struct gfs2_quota_data *qd) ...@@ -972,9 +972,9 @@ static int need_sync(struct gfs2_quota_data *qd)
if (!qd->qd_qb.qb_limit) if (!qd->qd_qb.qb_limit)
return 0; return 0;
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
value = qd->qd_change; value = qd->qd_change;
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
spin_lock(&gt->gt_spin); spin_lock(&gt->gt_spin);
num = gt->gt_quota_scale_num; num = gt->gt_quota_scale_num;
...@@ -1019,9 +1019,9 @@ void gfs2_quota_unlock(struct gfs2_inode *ip) ...@@ -1019,9 +1019,9 @@ void gfs2_quota_unlock(struct gfs2_inode *ip)
if (!sync) if (!sync)
continue; continue;
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
found = qd_check_sync(sdp, qd, NULL); found = qd_check_sync(sdp, qd, NULL);
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
if (!found) if (!found)
continue; continue;
...@@ -1083,9 +1083,9 @@ int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid) ...@@ -1083,9 +1083,9 @@ int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid)
continue; continue;
value = (s64)be64_to_cpu(qd->qd_qb.qb_value); value = (s64)be64_to_cpu(qd->qd_qb.qb_value);
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
value += qd->qd_change; value += qd->qd_change;
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
if (be64_to_cpu(qd->qd_qb.qb_limit) && (s64)be64_to_cpu(qd->qd_qb.qb_limit) < value) { if (be64_to_cpu(qd->qd_qb.qb_limit) && (s64)be64_to_cpu(qd->qd_qb.qb_limit) < value) {
print_message(qd, "exceeded"); print_message(qd, "exceeded");
...@@ -1276,11 +1276,11 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) ...@@ -1276,11 +1276,11 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
qd->qd_slot = slot; qd->qd_slot = slot;
qd->qd_slot_count = 1; qd->qd_slot_count = 1;
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
gfs2_icbit_munge(sdp, sdp->sd_quota_bitmap, slot, 1); gfs2_icbit_munge(sdp, sdp->sd_quota_bitmap, slot, 1);
list_add(&qd->qd_list, &sdp->sd_quota_list); list_add(&qd->qd_list, &sdp->sd_quota_list);
atomic_inc(&sdp->sd_quota_count); atomic_inc(&sdp->sd_quota_count);
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
found++; found++;
} }
...@@ -1306,7 +1306,7 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp) ...@@ -1306,7 +1306,7 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
struct gfs2_quota_data *qd; struct gfs2_quota_data *qd;
unsigned int x; unsigned int x;
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
while (!list_empty(head)) { while (!list_empty(head)) {
qd = list_entry(head->prev, struct gfs2_quota_data, qd_list); qd = list_entry(head->prev, struct gfs2_quota_data, qd_list);
...@@ -1320,9 +1320,9 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp) ...@@ -1320,9 +1320,9 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
(qd->qd_lockref.count && !test_bit(QDF_CHANGE, &qd->qd_flags))) { (qd->qd_lockref.count && !test_bit(QDF_CHANGE, &qd->qd_flags))) {
spin_unlock(&qd->qd_lockref.lock); spin_unlock(&qd->qd_lockref.lock);
list_move(&qd->qd_list, head); list_move(&qd->qd_list, head);
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
schedule(); schedule();
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
continue; continue;
} }
spin_unlock(&qd->qd_lockref.lock); spin_unlock(&qd->qd_lockref.lock);
...@@ -1334,7 +1334,7 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp) ...@@ -1334,7 +1334,7 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
atomic_dec(&qd_lru_count); atomic_dec(&qd_lru_count);
} }
atomic_dec(&sdp->sd_quota_count); atomic_dec(&sdp->sd_quota_count);
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
if (!qd->qd_lockref.count) { if (!qd->qd_lockref.count) {
gfs2_assert_warn(sdp, !qd->qd_change); gfs2_assert_warn(sdp, !qd->qd_change);
...@@ -1346,9 +1346,9 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp) ...@@ -1346,9 +1346,9 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
gfs2_glock_put(qd->qd_gl); gfs2_glock_put(qd->qd_gl);
kmem_cache_free(gfs2_quotad_cachep, qd); kmem_cache_free(gfs2_quotad_cachep, qd);
spin_lock(&qd_lru_lock); spin_lock(&qd_lock);
} }
spin_unlock(&qd_lru_lock); spin_unlock(&qd_lock);
gfs2_assert_warn(sdp, !atomic_read(&sdp->sd_quota_count)); gfs2_assert_warn(sdp, !atomic_read(&sdp->sd_quota_count));
......
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