]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gfs2: Simplify gfs2_log_pointers_init
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 16 May 2025 03:34:20 +0000 (05:34 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 22 May 2025 07:12:27 +0000 (09:12 +0200)
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>
fs/gfs2/glops.c
fs/gfs2/recovery.c
fs/gfs2/recovery.h
fs/gfs2/super.c

index 116efe335c321282b575b05e7f7b420a509341ed..e153db45bbd9c26c3f924ba09fc66d419491051f 100644 (file)
@@ -607,8 +607,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl)
                if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags &
                                                 GFS2_LOG_HEAD_UNMOUNT))
                        return -EIO;
-               sdp->sd_log_sequence = head.lh_sequence + 1;
-               gfs2_log_pointers_init(sdp, head.lh_blkno);
+               gfs2_log_pointers_init(sdp, &head);
        }
        return 0;
 }
index 7776d2092b9b5c5810ec752f656b6e5d12ea21c1..db1238480e91bbe3db588edde502c8a82337dff7 100644 (file)
@@ -270,10 +270,6 @@ static void clean_journal(struct gfs2_jdesc *jd,
        gfs2_write_log_header(sdp, jd, head->lh_sequence + 1, 0, lblock,
                              GFS2_LOG_HEAD_UNMOUNT | GFS2_LOG_HEAD_RECOVERY,
                              REQ_PREFLUSH | REQ_FUA | REQ_META | REQ_SYNC);
-       if (jd->jd_jid == sdp->sd_lockstruct.ls_jid) {
-               sdp->sd_log_flush_head = lblock;
-               gfs2_log_incr_head(sdp);
-       }
 }
 
 
@@ -581,12 +577,13 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd, bool wait)
        return wait ? jd->jd_recover_error : 0;
 }
 
-void gfs2_log_pointers_init(struct gfs2_sbd *sdp, unsigned int value)
+void gfs2_log_pointers_init(struct gfs2_sbd *sdp,
+                           struct gfs2_log_header_host *head)
 {
-       if (++value == sdp->sd_jdesc->jd_blocks) {
-               value = 0;
-       }
-       sdp->sd_log_tail = value;
-       sdp->sd_log_flush_tail = value;
-       sdp->sd_log_head = value;
+       sdp->sd_log_sequence = head->lh_sequence + 1;
+       gfs2_replay_incr_blk(sdp->sd_jdesc, &head->lh_blkno);
+       sdp->sd_log_tail = head->lh_blkno;
+       sdp->sd_log_flush_head = head->lh_blkno;
+       sdp->sd_log_flush_tail = head->lh_blkno;
+       sdp->sd_log_head = head->lh_blkno;
 }
index 630ac490948d8bdfd26619af1e23157b0c47f662..5a5ba72ecd756e2b57f63b2f2a1e9a7b3524f278 100644 (file)
@@ -29,7 +29,8 @@ void gfs2_recover_func(struct work_struct *work);
 int __get_log_header(struct gfs2_sbd *sdp,
                     const struct gfs2_log_header *lh, unsigned int blkno,
                     struct gfs2_log_header_host *head);
-void gfs2_log_pointers_init(struct gfs2_sbd *sdp, unsigned int value);
+void gfs2_log_pointers_init(struct gfs2_sbd *sdp,
+                           struct gfs2_log_header_host *head);
 
 #endif /* __RECOVERY_DOT_H__ */
 
index 54f1efd47a3e5fe213d251998124d7a5917d4c65..b55aa38a485a239244db17b563937bc5dbba4e3e 100644 (file)
@@ -153,8 +153,7 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
        }
 
        /*  Initialize some head of the log stuff  */
-       sdp->sd_log_sequence = head.lh_sequence + 1;
-       gfs2_log_pointers_init(sdp, head.lh_blkno);
+       gfs2_log_pointers_init(sdp, &head);
 
        error = gfs2_quota_init(sdp);
        if (!error && gfs2_withdrawing_or_withdrawn(sdp))