[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230206095543.539186-2-chenxiaosong2@huawei.com>
Date: Mon, 6 Feb 2023 17:55:42 +0800
From: ChenXiaoSong <chenxiaosong2@...wei.com>
To: <rpeterso@...hat.com>, <agruenba@...hat.com>
CC: <cluster-devel@...hat.com>, <linux-kernel@...r.kernel.org>,
<chenxiaosong2@...wei.com>
Subject: [PATCH 1/2] gfs2: factor out __gfs2_ail1_empty() and gfs2_ail1_withdraw()
Factor out __gfs2_ail1_empty() and gfs2_ail1_withdraw() from
gfs2_ail1_empty(). No functional change.
Signed-off-by: ChenXiaoSong <chenxiaosong2@...wei.com>
---
fs/gfs2/log.c | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 61323deb80bc..c62c914702ba 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -347,15 +347,7 @@ static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_trans *tr,
return active_count;
}
-/**
- * gfs2_ail1_empty - Try to empty the ail1 lists
- * @sdp: The superblock
- * @max_revokes: If non-zero, add revokes where appropriate
- *
- * Tries to empty the ail1 lists, starting with the oldest first
- */
-
-static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes)
+static int __gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes)
{
struct gfs2_trans *tr, *s;
int oldest_tr = 1;
@@ -372,10 +364,31 @@ static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes)
ret = list_empty(&sdp->sd_ail1_list);
spin_unlock(&sdp->sd_ail_lock);
+ return ret;
+}
+
+static void gfs2_ail1_withdraw(struct gfs2_sbd *sdp)
+{
if (test_bit(SDF_WITHDRAWING, &sdp->sd_flags)) {
gfs2_lm(sdp, "fatal: I/O error(s)\n");
gfs2_withdraw(sdp);
}
+}
+
+/**
+ * gfs2_ail1_empty - Try to empty the ail1 lists
+ * @sdp: The superblock
+ * @max_revokes: If non-zero, add revokes where appropriate
+ *
+ * Tries to empty the ail1 lists, starting with the oldest first
+ */
+
+static int gfs2_ail1_empty(struct gfs2_sbd *sdp, int max_revokes)
+{
+ int ret;
+
+ ret = __gfs2_ail1_empty(sdp, max_revokes);
+ gfs2_ail1_withdraw(sdp);
return ret;
}
--
2.31.1
Powered by blists - more mailing lists