cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 06/12] gfs2: Clean up ail2_empty
Date: Mon, 14 Dec 2020 09:54:36 +0100	[thread overview]
Message-ID: <20201214085442.45467-7-agruenba@redhat.com> (raw)
In-Reply-To: <20201214085442.45467-1-agruenba@redhat.com>

Clean up the logic in ail2_empty (no functional change).

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/gfs2/log.c | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index f7c225520c38..33f7b1544958 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -367,29 +367,33 @@ static void gfs2_ail_empty_tr(struct gfs2_sbd *sdp, struct gfs2_trans *tr,
 	}
 }
 
+static void __ail2_empty(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
+{
+	gfs2_ail_empty_tr(sdp, tr, &tr->tr_ail2_list);
+	list_del(&tr->tr_list);
+	gfs2_assert_warn(sdp, list_empty(&tr->tr_ail1_list));
+	gfs2_assert_warn(sdp, list_empty(&tr->tr_ail2_list));
+	gfs2_trans_free(sdp, tr);
+}
+
 static void ail2_empty(struct gfs2_sbd *sdp, unsigned int new_tail)
 {
-	struct gfs2_trans *tr, *safe;
+	struct list_head *ail2_list = &sdp->sd_ail2_list;
 	unsigned int old_tail = sdp->sd_log_tail;
-	int wrap = (new_tail < old_tail);
-	int a, b, rm;
+	struct gfs2_trans *tr, *safe;
 
 	spin_lock(&sdp->sd_ail_lock);
-
-	list_for_each_entry_safe(tr, safe, &sdp->sd_ail2_list, tr_list) {
-		a = (old_tail <= tr->tr_first);
-		b = (tr->tr_first < new_tail);
-		rm = (wrap) ? (a || b) : (a && b);
-		if (!rm)
-			continue;
-
-		gfs2_ail_empty_tr(sdp, tr, &tr->tr_ail2_list);
-		list_del(&tr->tr_list);
-		gfs2_assert_warn(sdp, list_empty(&tr->tr_ail1_list));
-		gfs2_assert_warn(sdp, list_empty(&tr->tr_ail2_list));
-		gfs2_trans_free(sdp, tr);
+	if (old_tail <= new_tail) {
+		list_for_each_entry_safe(tr, safe, ail2_list, tr_list) {
+			if (old_tail <= tr->tr_first && tr->tr_first < new_tail)
+				__ail2_empty(sdp, tr);
+		}
+	} else {
+		list_for_each_entry_safe(tr, safe, ail2_list, tr_list) {
+			if (old_tail <= tr->tr_first || tr->tr_first < new_tail)
+				__ail2_empty(sdp, tr);
+		}
 	}
-
 	spin_unlock(&sdp->sd_ail_lock);
 }
 
-- 
2.26.2



  parent reply	other threads:[~2020-12-14  8:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14  8:54 [Cluster-devel] [RFC PATCH 00/12] Some log space management cleanups Andreas Gruenbacher
2020-12-14  8:54 ` [Cluster-devel] [PATCH 01/12] gfs2: Deobfuscate function jdesc_find_i Andreas Gruenbacher
2020-12-14  8:54 ` [Cluster-devel] [PATCH 02/12] gfs2: Simplify the buf_limit and databuf_limit definitions Andreas Gruenbacher
2020-12-14  8:54 ` [Cluster-devel] [PATCH 03/12] gfs2: Minor gfs2_write_revokes cleanups Andreas Gruenbacher
2020-12-14  8:54 ` [Cluster-devel] [PATCH 04/12] gfs2: Some documentation clarifications Andreas Gruenbacher
2020-12-14  8:54 ` [Cluster-devel] [PATCH 05/12] gfs2: A minor debugging improvement Andreas Gruenbacher
2020-12-14  8:54 ` Andreas Gruenbacher [this message]
2020-12-14  8:54 ` [Cluster-devel] [PATCH 07/12] gfs2: Get rid of on-stack transactions Andreas Gruenbacher
2020-12-14 14:02   ` Bob Peterson
2020-12-14 14:05     ` Steven Whitehouse
2020-12-14 17:08       ` Andreas Gruenbacher
2020-12-14  8:54 ` [Cluster-devel] [PATCH 08/12] gfs2: Get rid of sd_reserving_log Andreas Gruenbacher
2020-12-14  8:54 ` [Cluster-devel] [PATCH 09/12] gfs2: Move lock flush locking to gfs2_trans_{begin, end} Andreas Gruenbacher
2020-12-14  8:54 ` [Cluster-devel] [PATCH 10/12] gfs2: Don't wait for journal flush in clean_journal Andreas Gruenbacher
2020-12-14  8:54 ` [Cluster-devel] [PATCH 11/12] gfs2: Clean up gfs2_log_reserve Andreas Gruenbacher
2020-12-14  8:54 ` [Cluster-devel] [PATCH 12/12] gfs2: Use a tighter bound in gfs2_trans_begin 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=20201214085442.45467-7-agruenba@redhat.com \
    --to=agruenba@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).