Skip to content

Commit 130cf52

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
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: Bob Peterson <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 7d1b377 commit 130cf52

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

fs/gfs2/ops_fstype.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -734,13 +734,11 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
734734
struct inode *master = d_inode(sdp->sd_master_dir);
735735
struct gfs2_holder ji_gh;
736736
struct gfs2_inode *ip;
737-
int jindex = 1;
738737
int error = 0;
739738

740-
if (undo) {
741-
jindex = 0;
739+
gfs2_holder_mark_uninitialized(&ji_gh);
740+
if (undo)
742741
goto fail_statfs;
743-
}
744742

745743
sdp->sd_jindex = gfs2_lookup_simple(master, "jindex");
746744
if (IS_ERR(sdp->sd_jindex)) {
@@ -852,7 +850,6 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
852850
sdp->sd_log_idle = 1;
853851
set_bit(SDF_JOURNAL_CHECKED, &sdp->sd_flags);
854852
gfs2_glock_dq_uninit(&ji_gh);
855-
jindex = 0;
856853
INIT_WORK(&sdp->sd_freeze_work, gfs2_freeze_func);
857854
return 0;
858855

@@ -869,7 +866,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
869866
gfs2_glock_dq_uninit(&sdp->sd_journal_gh);
870867
fail_jindex:
871868
gfs2_jindex_free(sdp);
872-
if (jindex)
869+
if (gfs2_holder_initialized(&ji_gh))
873870
gfs2_glock_dq_uninit(&ji_gh);
874871
fail:
875872
iput(sdp->sd_jindex);

0 commit comments

Comments
 (0)