linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH v2 2/9] xfs: lift writable fs check up into log worker task
Date: Thu, 21 Jan 2021 10:45:19 -0500	[thread overview]
Message-ID: <20210121154526.1852176-3-bfoster@redhat.com> (raw)
In-Reply-To: <20210121154526.1852176-1-bfoster@redhat.com>

The log covering helper checks whether the filesystem is writable to
determine whether to cover the log. The helper is currently only
called from the background log worker. In preparation to reuse the
helper from freezing contexts, lift the check into xfs_log_worker().

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_log.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index b445e63cbc3c..7280d99aa19c 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1049,14 +1049,12 @@ xfs_log_space_wake(
  * there's no point in running a dummy transaction at this point because we
  * can't start trying to idle the log until both the CIL and AIL are empty.
  */
-static int
-xfs_log_need_covered(xfs_mount_t *mp)
+static bool
+xfs_log_need_covered(
+	struct xfs_mount	*mp)
 {
-	struct xlog	*log = mp->m_log;
-	int		needed = 0;
-
-	if (!xfs_fs_writable(mp, SB_FREEZE_WRITE))
-		return 0;
+	struct xlog		*log = mp->m_log;
+	bool			needed = false;
 
 	if (!xlog_cil_empty(log))
 		return 0;
@@ -1074,14 +1072,14 @@ xfs_log_need_covered(xfs_mount_t *mp)
 		if (!xlog_iclogs_empty(log))
 			break;
 
-		needed = 1;
+		needed = true;
 		if (log->l_covered_state == XLOG_STATE_COVER_NEED)
 			log->l_covered_state = XLOG_STATE_COVER_DONE;
 		else
 			log->l_covered_state = XLOG_STATE_COVER_DONE2;
 		break;
 	default:
-		needed = 1;
+		needed = true;
 		break;
 	}
 	spin_unlock(&log->l_icloglock);
@@ -1271,7 +1269,7 @@ xfs_log_worker(
 	struct xfs_mount	*mp = log->l_mp;
 
 	/* dgc: errors ignored - not fatal and nowhere to report them */
-	if (xfs_log_need_covered(mp)) {
+	if (xfs_fs_writable(mp, SB_FREEZE_WRITE) && xfs_log_need_covered(mp)) {
 		/*
 		 * Dump a transaction into the log that contains no real change.
 		 * This is needed to stamp the current tail LSN into the log
-- 
2.26.2


  parent reply	other threads:[~2021-01-21 15:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 15:45 [PATCH v2 0/9] xfs: rework log quiesce to cover the log Brian Foster
2021-01-21 15:45 ` [PATCH v2 1/9] xfs: sync lazy sb accounting on quiesce of read-only mounts Brian Foster
2021-01-21 15:45 ` Brian Foster [this message]
2021-01-21 18:43   ` [PATCH v2 2/9] xfs: lift writable fs check up into log worker task Darrick J. Wong
2021-01-21 15:45 ` [PATCH v2 3/9] xfs: separate log cleaning from log quiesce Brian Foster
2021-01-21 15:45 ` [PATCH v2 4/9] xfs: cover the log during " Brian Foster
2021-01-21 18:44   ` Darrick J. Wong
2021-01-22  3:16   ` Allison Henderson
2021-01-21 15:45 ` [PATCH v2 5/9] xfs: don't reset log idle state on covering checkpoints Brian Foster
2021-01-22  3:48   ` Allison Henderson
2021-01-21 15:45 ` [PATCH v2 6/9] xfs: fold sbcount quiesce logging into log covering Brian Foster
2021-01-22  3:13   ` Allison Henderson
2021-01-21 15:45 ` [PATCH v2 7/9] xfs: remove duplicate wq cancel and log force from attr quiesce Brian Foster
2021-01-22  3:13   ` Allison Henderson
2021-01-21 15:45 ` [PATCH v2 8/9] xfs: remove xfs_quiesce_attr() Brian Foster
2021-01-22  3:13   ` Allison Henderson
2021-01-21 15:45 ` [PATCH v2 9/9] xfs: cover the log on freeze instead of cleaning it Brian Foster
2021-01-22  3:13   ` Allison Henderson

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=20210121154526.1852176-3-bfoster@redhat.com \
    --to=bfoster@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /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).