gfs2 filesystem and dlm development
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: gfs2@lists.linux.dev
Cc: Andreas Gruenbacher <agruenba@redhat.com>
Subject: [PATCH 08/18] gfs2: Move gfs2_remove_from_journal to log.c
Date: Mon, 13 Apr 2026 16:52:01 +0200	[thread overview]
Message-ID: <20260413145211.881752-9-agruenba@redhat.com> (raw)
In-Reply-To: <20260413145211.881752-1-agruenba@redhat.com>

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     | 37 ++++++++++++++++++++++++++++++++++++-
 fs/gfs2/log.h     |  2 +-
 fs/gfs2/meta_io.c | 35 -----------------------------------
 fs/gfs2/meta_io.h |  1 -
 4 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 8a832eba1612..dde65f7d7437 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -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
diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h
index ca2cfadd7cce..10beda62427c 100644
--- a/fs/gfs2/log.h
+++ b/fs/gfs2/log.h
@@ -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);
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 814c86986b96..d407dd476e72 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -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
diff --git a/fs/gfs2/meta_io.h b/fs/gfs2/meta_io.h
index 2fe5dec193ed..ec76215bfb1a 100644
--- a/fs/gfs2/meta_io.h
+++ b/fs/gfs2/meta_io.h
@@ -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);
-- 
2.53.0


  parent reply	other threads:[~2026-04-13 14:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 14:51 [PATCH 00/18] gfs2 patches on for-next Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 01/18] gfs2: Call unlock_new_inode before d_instantiate Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 02/18] gfs2: Remove unnecessary check in gfs2_evict_inode Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 03/18] gfs2: Avoid unnecessary transactions in evict_linked_inode Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 04/18] gfs2: minor evict_[un]linked_inode cleanup Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 05/18] gfs2: Fix data loss during inode evict Andreas Gruenbacher
2026-04-13 14:51 ` [PATCH 06/18] gfs2: less aggressive low-memory log flushing Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 07/18] gfs2: Get rid of gfs2_log_[un]lock helpers Andreas Gruenbacher
2026-04-13 14:52 ` Andreas Gruenbacher [this message]
2026-04-13 14:52 ` [PATCH 09/18] gfs2: Remove trans_drain code duplication Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 10/18] gfs2: bufdata allocation race Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 11/18] gfs2: drain ail under sd_log_flush_lock Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 12/18] gfs2: fix address space truncation during withdraw Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 13/18] gfs2: add some missing log locking Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 14/18] gfs2: gfs2_log_flush withdraw fixes Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 15/18] gfs2: inode directory consistency checks Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 16/18] gfs2: wait for withdraw earlier during unmount Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 17/18] gfs2: hide error messages after withdraw Andreas Gruenbacher
2026-04-13 14:52 ` [PATCH 18/18] gfs2: prevent NULL pointer dereference during unmount Andreas Gruenbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260413145211.881752-9-agruenba@redhat.com \
    --to=agruenba@redhat.com \
    --cc=gfs2@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox