Commit 130cf526 authored by Bob Peterson's avatar Bob Peterson Committed by Andreas Gruenbacher

gfs2: Use gfs2_holder_initialized for jindex

Before this patch function init_journal() used a local variable jindex to
keep track of whether it needed to dequeue the jindex holder when errors
were found. It also uselessly set the variable just before returning from
the function. This patch simplifies the code by eliminatinng the local
variable in favor of using function gfs2_holder_initialized.
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent 7d1b3778
...@@ -734,13 +734,11 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) ...@@ -734,13 +734,11 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
struct inode *master = d_inode(sdp->sd_master_dir); struct inode *master = d_inode(sdp->sd_master_dir);
struct gfs2_holder ji_gh; struct gfs2_holder ji_gh;
struct gfs2_inode *ip; struct gfs2_inode *ip;
int jindex = 1;
int error = 0; int error = 0;
if (undo) { gfs2_holder_mark_uninitialized(&ji_gh);
jindex = 0; if (undo)
goto fail_statfs; goto fail_statfs;
}
sdp->sd_jindex = gfs2_lookup_simple(master, "jindex"); sdp->sd_jindex = gfs2_lookup_simple(master, "jindex");
if (IS_ERR(sdp->sd_jindex)) { if (IS_ERR(sdp->sd_jindex)) {
...@@ -852,7 +850,6 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) ...@@ -852,7 +850,6 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
sdp->sd_log_idle = 1; sdp->sd_log_idle = 1;
set_bit(SDF_JOURNAL_CHECKED, &sdp->sd_flags); set_bit(SDF_JOURNAL_CHECKED, &sdp->sd_flags);
gfs2_glock_dq_uninit(&ji_gh); gfs2_glock_dq_uninit(&ji_gh);
jindex = 0;
INIT_WORK(&sdp->sd_freeze_work, gfs2_freeze_func); INIT_WORK(&sdp->sd_freeze_work, gfs2_freeze_func);
return 0; return 0;
...@@ -869,7 +866,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo) ...@@ -869,7 +866,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
gfs2_glock_dq_uninit(&sdp->sd_journal_gh); gfs2_glock_dq_uninit(&sdp->sd_journal_gh);
fail_jindex: fail_jindex:
gfs2_jindex_free(sdp); gfs2_jindex_free(sdp);
if (jindex) if (gfs2_holder_initialized(&ji_gh))
gfs2_glock_dq_uninit(&ji_gh); gfs2_glock_dq_uninit(&ji_gh);
fail: fail:
iput(sdp->sd_jindex); iput(sdp->sd_jindex);
......
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