Commit 51316523 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher

gfs2: Minor gfs2_quota_init error path cleanup

Add a fail_brelse label and use it where useful.  Move variable bh out
of the loop to extend its visibility to the new label.  No functional
change.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 713f8834
...@@ -1407,6 +1407,7 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) ...@@ -1407,6 +1407,7 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
unsigned int found = 0; unsigned int found = 0;
unsigned int hash; unsigned int hash;
unsigned int bm_size; unsigned int bm_size;
struct buffer_head *bh;
u64 dblock; u64 dblock;
u32 extlen = 0; u32 extlen = 0;
int error; int error;
...@@ -1426,7 +1427,6 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) ...@@ -1426,7 +1427,6 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
return error; return error;
for (x = 0; x < blocks; x++) { for (x = 0; x < blocks; x++) {
struct buffer_head *bh;
const struct gfs2_quota_change *qc; const struct gfs2_quota_change *qc;
unsigned int y; unsigned int y;
...@@ -1440,10 +1440,8 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) ...@@ -1440,10 +1440,8 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
bh = gfs2_meta_ra(ip->i_gl, dblock, extlen); bh = gfs2_meta_ra(ip->i_gl, dblock, extlen);
if (!bh) if (!bh)
goto fail; goto fail;
if (gfs2_metatype_check(sdp, bh, GFS2_METATYPE_QC)) { if (gfs2_metatype_check(sdp, bh, GFS2_METATYPE_QC))
brelse(bh); goto fail_brelse;
goto fail;
}
qc = (const struct gfs2_quota_change *)(bh->b_data + sizeof(struct gfs2_meta_header)); qc = (const struct gfs2_quota_change *)(bh->b_data + sizeof(struct gfs2_meta_header));
for (y = 0; y < sdp->sd_qc_per_block && slot < sdp->sd_quota_slots; for (y = 0; y < sdp->sd_qc_per_block && slot < sdp->sd_quota_slots;
...@@ -1461,10 +1459,8 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) ...@@ -1461,10 +1459,8 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
hash = gfs2_qd_hash(sdp, qc_id); hash = gfs2_qd_hash(sdp, qc_id);
qd = qd_alloc(hash, sdp, qc_id); qd = qd_alloc(hash, sdp, qc_id);
if (qd == NULL) { if (qd == NULL)
brelse(bh); goto fail_brelse;
goto fail;
}
set_bit(QDF_CHANGE, &qd->qd_flags); set_bit(QDF_CHANGE, &qd->qd_flags);
qd->qd_change = qc_change; qd->qd_change = qc_change;
...@@ -1494,6 +1490,8 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) ...@@ -1494,6 +1490,8 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
return 0; return 0;
fail_brelse:
brelse(bh);
fail: fail:
gfs2_quota_cleanup(sdp); gfs2_quota_cleanup(sdp);
return error; return error;
......
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