Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <agruenba@redhat.com>

+12 -16
+1 -2
fs/gfs2/glops.c
··· 607 607 if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags & 608 608 GFS2_LOG_HEAD_UNMOUNT)) 609 609 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); 612 611 } 613 612 return 0; 614 613 }
+8 -11
fs/gfs2/recovery.c
··· 270 270 gfs2_write_log_header(sdp, jd, head->lh_sequence + 1, 0, lblock, 271 271 GFS2_LOG_HEAD_UNMOUNT | GFS2_LOG_HEAD_RECOVERY, 272 272 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 - } 277 273 } 278 274 279 275 ··· 577 581 return wait ? jd->jd_recover_error : 0; 578 582 } 579 583 580 - void gfs2_log_pointers_init(struct gfs2_sbd *sdp, unsigned int value) 584 + void gfs2_log_pointers_init(struct gfs2_sbd *sdp, 585 + struct gfs2_log_header_host *head) 581 586 { 582 - if (++value == sdp->sd_jdesc->jd_blocks) { 583 - value = 0; 584 - } 585 - sdp->sd_log_tail = value; 586 - sdp->sd_log_flush_tail = value; 587 - sdp->sd_log_head = value; 587 + sdp->sd_log_sequence = head->lh_sequence + 1; 588 + gfs2_replay_incr_blk(sdp->sd_jdesc, &head->lh_blkno); 589 + sdp->sd_log_tail = head->lh_blkno; 590 + sdp->sd_log_flush_head = head->lh_blkno; 591 + sdp->sd_log_flush_tail = head->lh_blkno; 592 + sdp->sd_log_head = head->lh_blkno; 588 593 }
+2 -1
fs/gfs2/recovery.h
··· 29 29 int __get_log_header(struct gfs2_sbd *sdp, 30 30 const struct gfs2_log_header *lh, unsigned int blkno, 31 31 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); 33 34 34 35 #endif /* __RECOVERY_DOT_H__ */ 35 36
+1 -2
fs/gfs2/super.c
··· 153 153 } 154 154 155 155 /* 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); 158 157 159 158 error = gfs2_quota_init(sdp); 160 159 if (!error && gfs2_withdrawing_or_withdrawn(sdp))