Commit 481f6e7d authored by Bob Peterson's avatar Bob Peterson Committed by Andreas Gruenbacher

gfs2: Use qd_sbd more consequently

Before this patch many of the functions in quota.c got their superblock
pointer, sdp, from the quota_data's glock pointer. That's silly because
the qd already has its own pointer to the superblock (qd_sbd).

This patch changes references to use that instead, eliminating a level
of indirection.
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent db77789b
...@@ -119,7 +119,7 @@ static void gfs2_qd_dispose(struct list_head *list) ...@@ -119,7 +119,7 @@ static void gfs2_qd_dispose(struct list_head *list)
while (!list_empty(list)) { while (!list_empty(list)) {
qd = list_first_entry(list, struct gfs2_quota_data, qd_lru); qd = list_first_entry(list, struct gfs2_quota_data, qd_lru);
sdp = qd->qd_gl->gl_name.ln_sbd; sdp = qd->qd_sbd;
list_del(&qd->qd_lru); list_del(&qd->qd_lru);
...@@ -302,7 +302,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid, ...@@ -302,7 +302,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid,
static void qd_hold(struct gfs2_quota_data *qd) static void qd_hold(struct gfs2_quota_data *qd)
{ {
struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd; struct gfs2_sbd *sdp = qd->qd_sbd;
gfs2_assert(sdp, !__lockref_is_dead(&qd->qd_lockref)); gfs2_assert(sdp, !__lockref_is_dead(&qd->qd_lockref));
lockref_get(&qd->qd_lockref); lockref_get(&qd->qd_lockref);
} }
...@@ -367,7 +367,7 @@ static void slot_put(struct gfs2_quota_data *qd) ...@@ -367,7 +367,7 @@ static void slot_put(struct gfs2_quota_data *qd)
static int bh_get(struct gfs2_quota_data *qd) static int bh_get(struct gfs2_quota_data *qd)
{ {
struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd; struct gfs2_sbd *sdp = qd->qd_sbd;
struct inode *inode = sdp->sd_qc_inode; struct inode *inode = sdp->sd_qc_inode;
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
unsigned int block, offset; unsigned int block, offset;
...@@ -421,7 +421,7 @@ static int bh_get(struct gfs2_quota_data *qd) ...@@ -421,7 +421,7 @@ static int bh_get(struct gfs2_quota_data *qd)
static void bh_put(struct gfs2_quota_data *qd) static void bh_put(struct gfs2_quota_data *qd)
{ {
struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd; struct gfs2_sbd *sdp = qd->qd_sbd;
mutex_lock(&sdp->sd_quota_mutex); mutex_lock(&sdp->sd_quota_mutex);
gfs2_assert(sdp, qd->qd_bh_count); gfs2_assert(sdp, qd->qd_bh_count);
...@@ -489,8 +489,7 @@ static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp) ...@@ -489,8 +489,7 @@ static int qd_fish(struct gfs2_sbd *sdp, struct gfs2_quota_data **qdp)
static void qd_unlock(struct gfs2_quota_data *qd) static void qd_unlock(struct gfs2_quota_data *qd)
{ {
gfs2_assert_warn(qd->qd_gl->gl_name.ln_sbd, gfs2_assert_warn(qd->qd_sbd, test_bit(QDF_LOCKED, &qd->qd_flags));
test_bit(QDF_LOCKED, &qd->qd_flags));
clear_bit(QDF_LOCKED, &qd->qd_flags); clear_bit(QDF_LOCKED, &qd->qd_flags);
bh_put(qd); bh_put(qd);
slot_put(qd); slot_put(qd);
...@@ -666,7 +665,7 @@ static int sort_qd(const void *a, const void *b) ...@@ -666,7 +665,7 @@ static int sort_qd(const void *a, const void *b)
static void do_qc(struct gfs2_quota_data *qd, s64 change, int qc_type) static void do_qc(struct gfs2_quota_data *qd, s64 change, int qc_type)
{ {
struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd; struct gfs2_sbd *sdp = qd->qd_sbd;
struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
struct gfs2_quota_change *qc = qd->qd_bh_qc; struct gfs2_quota_change *qc = qd->qd_bh_qc;
s64 x; s64 x;
...@@ -881,7 +880,7 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, ...@@ -881,7 +880,7 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
{ {
struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_name.ln_sbd; struct gfs2_sbd *sdp = (*qda)->qd_sbd;
struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode); struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
struct gfs2_alloc_parms ap = { .aflags = 0, }; struct gfs2_alloc_parms ap = { .aflags = 0, };
unsigned int data_blocks, ind_blocks; unsigned int data_blocks, ind_blocks;
...@@ -1009,11 +1008,12 @@ static int update_qd(struct gfs2_sbd *sdp, struct gfs2_quota_data *qd) ...@@ -1009,11 +1008,12 @@ static int update_qd(struct gfs2_sbd *sdp, struct gfs2_quota_data *qd)
static int do_glock(struct gfs2_quota_data *qd, int force_refresh, static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
struct gfs2_holder *q_gh) struct gfs2_holder *q_gh)
{ {
struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd; struct gfs2_sbd *sdp = qd->qd_sbd;
struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode); struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
struct gfs2_holder i_gh; struct gfs2_holder i_gh;
int error; int error;
gfs2_assert_warn(sdp, sdp == qd->qd_gl->gl_name.ln_sbd);
restart: restart:
error = gfs2_glock_nq_init(qd->qd_gl, LM_ST_SHARED, 0, q_gh); error = gfs2_glock_nq_init(qd->qd_gl, LM_ST_SHARED, 0, q_gh);
if (error) if (error)
...@@ -1091,7 +1091,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid) ...@@ -1091,7 +1091,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid)
static int need_sync(struct gfs2_quota_data *qd) static int need_sync(struct gfs2_quota_data *qd)
{ {
struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd; struct gfs2_sbd *sdp = qd->qd_sbd;
struct gfs2_tune *gt = &sdp->sd_tune; struct gfs2_tune *gt = &sdp->sd_tune;
s64 value; s64 value;
unsigned int num, den; unsigned int num, den;
...@@ -1178,7 +1178,7 @@ void gfs2_quota_unlock(struct gfs2_inode *ip) ...@@ -1178,7 +1178,7 @@ void gfs2_quota_unlock(struct gfs2_inode *ip)
static int print_message(struct gfs2_quota_data *qd, char *type) static int print_message(struct gfs2_quota_data *qd, char *type)
{ {
struct gfs2_sbd *sdp = qd->qd_gl->gl_name.ln_sbd; struct gfs2_sbd *sdp = qd->qd_sbd;
fs_info(sdp, "quota %s for %s %u\n", fs_info(sdp, "quota %s for %s %u\n",
type, type,
......
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