]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gfs2: No more gfs2_find_jhead caching
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 16 May 2025 00:58:02 +0000 (02:58 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Thu, 22 May 2025 07:12:27 +0000 (09:12 +0200)
We are no longer calling gfs2_find_jhead() on the same log twice, so
there is no more reason for keeping the log contents cached across those
calls.  In addition, log head lookup and log header writing didn't go
through the same address space and so the caching wasn't even fully
working, anyway.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/glops.c
fs/gfs2/lops.c
fs/gfs2/lops.h
fs/gfs2/recovery.c
fs/gfs2/super.c
fs/gfs2/util.c

index e153db45bbd9c26c3f924ba09fc66d419491051f..cebd66b22694c47e04ea6848f275926937d18333 100644 (file)
@@ -601,7 +601,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl)
        if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
                j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
 
-               error = gfs2_find_jhead(sdp->sd_jdesc, &head, false);
+               error = gfs2_find_jhead(sdp->sd_jdesc, &head);
                if (gfs2_assert_withdraw_delayed(sdp, !error))
                        return error;
                if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags &
index ba97e97d3eee454f7110021e723b2ea67b9476d0..9c8c305a75c46853eefbd0e86efc66250276a4c9 100644 (file)
@@ -496,15 +496,13 @@ static struct bio *gfs2_chain_bio(struct bio *prev, unsigned int nr_iovecs)
  * gfs2_find_jhead - find the head of a log
  * @jd: The journal descriptor
  * @head: The log descriptor for the head of the log is returned here
- * @keep_cache: If set inode pages will not be truncated
  *
  * Do a search of a journal by reading it in large chunks using bios and find
  * the valid log entry with the highest sequence number.  (i.e. the log head)
  *
  * Returns: 0 on success, errno otherwise
  */
-int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
-                   bool keep_cache)
+int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head)
 {
        struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
        struct address_space *mapping = jd->jd_inode->i_mapping;
@@ -593,8 +591,7 @@ out:
        if (!ret)
                ret = filemap_check_wb_err(mapping, since);
 
-       if (!keep_cache)
-               truncate_inode_pages(mapping, 0);
+       truncate_inode_pages(mapping, 0);
 
        return ret;
 }
index 07890c7b145d8b9263bf2531392d2772948e2fc4..be740bf33666461a803edbcec940a1b6b478e561 100644 (file)
@@ -20,7 +20,7 @@ void gfs2_log_write(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
 void gfs2_log_submit_bio(struct bio **biop, blk_opf_t opf);
 void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
 int gfs2_find_jhead(struct gfs2_jdesc *jd,
-                   struct gfs2_log_header_host *head, bool keep_cache);
+                   struct gfs2_log_header_host *head);
 void gfs2_drain_revokes(struct gfs2_sbd *sdp);
 
 static inline unsigned int buf_limit(struct gfs2_sbd *sdp)
index b3a11105df7c08752b59c462deea7015eef86494..24250478b085d8f6aa2994c7af2ed62244146e1a 100644 (file)
@@ -454,7 +454,7 @@ void gfs2_recover_func(struct work_struct *work)
        if (error)
                goto fail_gunlock_ji;
 
-       error = gfs2_find_jhead(jd, &head, true);
+       error = gfs2_find_jhead(jd, &head);
        if (error)
                goto fail_gunlock_ji;
        t_jhd = ktime_get();
index a9af02ef580d8a39bb7724924539602202c84e4b..dbc119f8c76217499f97f71e90949c50621dc1d7 100644 (file)
@@ -360,7 +360,7 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp)
                error = gfs2_jdesc_check(jd);
                if (error)
                        break;
-               error = gfs2_find_jhead(jd, &lh, false);
+               error = gfs2_find_jhead(jd, &lh);
                if (error)
                        break;
                if (!(lh.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
index 13be8d1d228b8fa9079a6fcf91b778475569648a..d5a1e63fa257e042234637eba7f10beef9ea1bff 100644 (file)
@@ -73,7 +73,7 @@ int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
                               "mount.\n");
                goto out_unlock;
        }
-       error = gfs2_find_jhead(jd, &head, false);
+       error = gfs2_find_jhead(jd, &head);
        if (error) {
                if (verbose)
                        fs_err(sdp, "Error parsing journal for spectator "