Skip to content

Commit 8a43d21

Browse files
author
Andreas Gruenbacher
committed
gfs2: Simplify gfs2_log_pointers_init
Move the initialization of sdp->sd_log_sequence and sdp->sd_log_flush_head inside gfs2_log_pointers_init(). Use gfs2_replay_incr_blk(). Before this change, the log head lookup code in freeze_go_xmote_bh() didn't update sdp->sd_log_flush_head. This is now fixed, but the code in freeze_go_xmote_bh() appears to be pretty useless in the first place: on a frozen filesystem, the log head will not change. Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 703a4af commit 8a43d21

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

fs/gfs2/glops.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl)
607607
if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags &
608608
GFS2_LOG_HEAD_UNMOUNT))
609609
return -EIO;
610-
sdp->sd_log_sequence = head.lh_sequence + 1;
611-
gfs2_log_pointers_init(sdp, head.lh_blkno);
610+
gfs2_log_pointers_init(sdp, &head);
612611
}
613612
return 0;
614613
}

fs/gfs2/recovery.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,6 @@ static void clean_journal(struct gfs2_jdesc *jd,
270270
gfs2_write_log_header(sdp, jd, head->lh_sequence + 1, 0, lblock,
271271
GFS2_LOG_HEAD_UNMOUNT | GFS2_LOG_HEAD_RECOVERY,
272272
REQ_PREFLUSH | REQ_FUA | REQ_META | REQ_SYNC);
273-
if (jd->jd_jid == sdp->sd_lockstruct.ls_jid) {
274-
sdp->sd_log_flush_head = lblock;
275-
gfs2_log_incr_head(sdp);
276-
}
277273
}
278274

279275

@@ -581,12 +577,13 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, bool wait)
581577
return wait ? jd->jd_recover_error : 0;
582578
}
583579

584-
void gfs2_log_pointers_init(struct gfs2_sbd *sdp, unsigned int value)
580+
void gfs2_log_pointers_init(struct gfs2_sbd *sdp,
581+
struct gfs2_log_header_host *head)
585582
{
586-
if (++value == sdp->sd_jdesc->jd_blocks) {
587-
value = 0;
588-
}
589-
sdp->sd_log_tail = value;
590-
sdp->sd_log_flush_tail = value;
591-
sdp->sd_log_head = value;
583+
sdp->sd_log_sequence = head->lh_sequence + 1;
584+
gfs2_replay_incr_blk(sdp->sd_jdesc, &head->lh_blkno);
585+
sdp->sd_log_tail = head->lh_blkno;
586+
sdp->sd_log_flush_head = head->lh_blkno;
587+
sdp->sd_log_flush_tail = head->lh_blkno;
588+
sdp->sd_log_head = head->lh_blkno;
592589
}

fs/gfs2/recovery.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ void gfs2_recover_func(struct work_struct *work);
2929
int __get_log_header(struct gfs2_sbd *sdp,
3030
const struct gfs2_log_header *lh, unsigned int blkno,
3131
struct gfs2_log_header_host *head);
32-
void gfs2_log_pointers_init(struct gfs2_sbd *sdp, unsigned int value);
32+
void gfs2_log_pointers_init(struct gfs2_sbd *sdp,
33+
struct gfs2_log_header_host *head);
3334

3435
#endif /* __RECOVERY_DOT_H__ */
3536

fs/gfs2/super.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
153153
}
154154

155155
/* Initialize some head of the log stuff */
156-
sdp->sd_log_sequence = head.lh_sequence + 1;
157-
gfs2_log_pointers_init(sdp, head.lh_blkno);
156+
gfs2_log_pointers_init(sdp, &head);
158157

159158
error = gfs2_quota_init(sdp);
160159
if (!error && gfs2_withdrawing_or_withdrawn(sdp))

0 commit comments

Comments
 (0)