]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gfs2: Move gfs2_remove_from_journal to log.c
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 13 Mar 2026 16:10:19 +0000 (17:10 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 23 Mar 2026 19:55:28 +0000 (20:55 +0100)
Move gfs2_remove_from_journal() from meta_io.c to log.c and fix a minor
indentation glitch.

With that, gfs2_remove_from_ail() is now only used inside log.c, so it
can be made static.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/log.c
fs/gfs2/log.h
fs/gfs2/meta_io.c
fs/gfs2/meta_io.h

index 8a832eba1612444ec5242ebb73b06858a8f59e4c..dde65f7d743720f3a2069c7f564e0da6fd697504 100644 (file)
@@ -72,7 +72,7 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct)
  *
  */
 
-void gfs2_remove_from_ail(struct gfs2_bufdata *bd)
+static void gfs2_remove_from_ail(struct gfs2_bufdata *bd)
 {
        bd->bd_tr = NULL;
        list_del_init(&bd->bd_ail_st_list);
@@ -1017,6 +1017,41 @@ static void trans_drain(struct gfs2_trans *tr)
        }
 }
 
+void gfs2_remove_from_journal(struct buffer_head *bh, int meta)
+{
+       struct address_space *mapping = bh->b_folio->mapping;
+       struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping);
+       struct gfs2_bufdata *bd = bh->b_private;
+       struct gfs2_trans *tr = current->journal_info;
+       int was_pinned = 0;
+
+       if (test_clear_buffer_pinned(bh)) {
+               trace_gfs2_pin(bd, 0);
+               atomic_dec(&sdp->sd_log_pinned);
+               list_del_init(&bd->bd_list);
+               if (meta == REMOVE_META)
+                       tr->tr_num_buf_rm++;
+               else
+                       tr->tr_num_databuf_rm++;
+               set_bit(TR_TOUCHED, &tr->tr_flags);
+               was_pinned = 1;
+               brelse(bh);
+       }
+       if (bd) {
+               if (bd->bd_tr) {
+                       gfs2_trans_add_revoke(sdp, bd);
+               } else if (was_pinned) {
+                       bh->b_private = NULL;
+                       kmem_cache_free(gfs2_bufdata_cachep, bd);
+               } else if (!list_empty(&bd->bd_ail_st_list) &&
+                          !list_empty(&bd->bd_ail_gl_list)) {
+                       gfs2_remove_from_ail(bd);
+               }
+       }
+       clear_buffer_dirty(bh);
+       clear_buffer_uptodate(bh);
+}
+
 /**
  * gfs2_log_flush - flush incore transaction(s)
  * @sdp: The filesystem
index ca2cfadd7cce1887e82f640ae6fc00aef6c5288e..10beda62427c4787b03845864605e3331d011fb1 100644 (file)
@@ -37,7 +37,6 @@ static inline void gfs2_ordered_add_inode(struct gfs2_inode *ip)
 
 void gfs2_ordered_del_inode(struct gfs2_inode *ip);
 unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct);
-void gfs2_remove_from_ail(struct gfs2_bufdata *bd);
 bool gfs2_log_is_empty(struct gfs2_sbd *sdp);
 void gfs2_log_release_revokes(struct gfs2_sbd *sdp, unsigned int revokes);
 void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks);
@@ -48,6 +47,7 @@ void gfs2_log_reserve(struct gfs2_sbd *sdp, struct gfs2_trans *tr,
 void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
                           u64 seq, u32 tail, u32 lblock, u32 flags,
                           blk_opf_t op_flags);
+void gfs2_remove_from_journal(struct buffer_head *bh, int meta);
 void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl,
                    u32 type);
 void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans);
index 814c86986b96f12188c0d4cdf6cef6408ae0fdb8..d407dd476e72035a5f87bb8529d1ca2bebda86d7 100644 (file)
@@ -338,41 +338,6 @@ int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
        return 0;
 }
 
-void gfs2_remove_from_journal(struct buffer_head *bh, int meta)
-{
-       struct address_space *mapping = bh->b_folio->mapping;
-       struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping);
-       struct gfs2_bufdata *bd = bh->b_private;
-       struct gfs2_trans *tr = current->journal_info;
-       int was_pinned = 0;
-
-       if (test_clear_buffer_pinned(bh)) {
-               trace_gfs2_pin(bd, 0);
-               atomic_dec(&sdp->sd_log_pinned);
-               list_del_init(&bd->bd_list);
-               if (meta == REMOVE_META)
-                       tr->tr_num_buf_rm++;
-               else
-                       tr->tr_num_databuf_rm++;
-               set_bit(TR_TOUCHED, &tr->tr_flags);
-               was_pinned = 1;
-               brelse(bh);
-       }
-       if (bd) {
-               if (bd->bd_tr) {
-                       gfs2_trans_add_revoke(sdp, bd);
-               } else if (was_pinned) {
-                       bh->b_private = NULL;
-                       kmem_cache_free(gfs2_bufdata_cachep, bd);
-               } else if (!list_empty(&bd->bd_ail_st_list) &&
-                                       !list_empty(&bd->bd_ail_gl_list)) {
-                       gfs2_remove_from_ail(bd);
-               }
-       }
-       clear_buffer_dirty(bh);
-       clear_buffer_uptodate(bh);
-}
-
 /**
  * gfs2_ail1_wipe - remove deleted/freed buffers from the ail1 list
  * @sdp: superblock
index 2fe5dec193eda37e314b59fe0e53f0ade757c0cc..ec76215bfb1ac10e6f2559037025b25d6fc11d58 100644 (file)
@@ -59,7 +59,6 @@ enum {
        REMOVE_META = 1,
 };
 
-void gfs2_remove_from_journal(struct buffer_head *bh, int meta);
 void gfs2_journal_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen);
 int gfs2_meta_buffer(struct gfs2_inode *ip, u32 mtype, u64 num,
                     struct buffer_head **bhp);