From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 5/6] xfs: optimize cache flushing for CIL commits on multi-device file systems
Date: Wed, 2 Sep 2026 09:15:51 -0700 [thread overview]
Message-ID: <20260902161551.GS1933798@frogsfrogsfrogs> (raw)
In-Reply-To: <20260902054942.111988-6-hch@lst.de>
On Wed, Sep 02, 2026 at 08:49:19AM +0300, Christoph Hellwig wrote:
> While the flush before writing a start record needs to cover data on the
> data and possibly RT devices, the flush before writing the commit record
> iclog only needs to ensure previous iclogs are stable on disk.
>
> Split out a new XLOG_ICL_NEED_FLUSH_LOG flag out of XLOG_ICL_NEED_FLUSH
> to signal that only the log device needs to be flushed.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/xfs/xfs_log.c | 6 ++++--
> fs/xfs/xfs_log_cil.c | 9 ++++++---
> fs/xfs/xfs_log_priv.h | 10 ++++++----
> 3 files changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 8079f2e003db..a5870877baed 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -1613,12 +1613,14 @@ xlog_write_iclog(
> if (iclog->ic_flags & XLOG_ICL_NEED_FLUSH) {
> if (xlog_flush_data_caches(log))
> goto shutdown;
> - iclog->ic_bio.bi_opf |= REQ_PREFLUSH;
> }
> + if (iclog->ic_flags & (XLOG_ICL_NEED_FLUSH | XLOG_ICL_NEED_FLUSH_LOG))
> + iclog->ic_bio.bi_opf |= REQ_PREFLUSH;
> if (iclog->ic_flags & XLOG_ICL_NEED_FUA)
> iclog->ic_bio.bi_opf |= REQ_FUA;
>
> - iclog->ic_flags &= ~(XLOG_ICL_NEED_FLUSH | XLOG_ICL_NEED_FUA);
> + iclog->ic_flags &= ~(XLOG_ICL_NEED_FLUSH | XLOG_ICL_NEED_FLUSH_LOG |
> + XLOG_ICL_NEED_FUA);
>
> if (is_vmalloc_addr(iclog->ic_header)) {
> if (!bio_add_vmalloc(&iclog->ic_bio, iclog->ic_header, count))
> diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
> index 3d159b1350df..e05b77fbfc3d 100644
> --- a/fs/xfs/xfs_log_cil.c
> +++ b/fs/xfs/xfs_log_cil.c
> @@ -1562,10 +1562,13 @@ xlog_cil_push_work(
> }
>
> /*
> - * We need to issue a pre-flush so that the ordering for this
> - * checkpoint is correctly preserved down to stable storage.
> + * We need to issue a pre-flush on the device containing the log
> + * so that the ordering for this checkpoint is correctly
> + * preserved down to stable storage.
> + * There is no need for an extra flush on devices that only
> + * contain data or non-log metadata.
> */
> - ctx->commit_iclog->ic_flags |= XLOG_ICL_NEED_FLUSH;
> + ctx->commit_iclog->ic_flags |= XLOG_ICL_NEED_FLUSH_LOG;
This is the "wait for all previous iclogs" case, so yes, we only need to
flush the log device.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> }
>
> /*
> diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
> index cf1e4ce61a8c..7c72c3b3ffe1 100644
> --- a/fs/xfs/xfs_log_priv.h
> +++ b/fs/xfs/xfs_log_priv.h
> @@ -71,12 +71,14 @@ enum xlog_iclog_state {
> /*
> * In core log flags
> */
> -#define XLOG_ICL_NEED_FLUSH (1u << 0) /* iclog needs REQ_PREFLUSH */
> -#define XLOG_ICL_NEED_FUA (1u << 1) /* iclog needs REQ_FUA */
> +#define XLOG_ICL_NEED_FLUSH (1u << 0) /* all devs need REQ_PREFLUSH */
> +#define XLOG_ICL_NEED_FLUSH_LOG (1u << 0) /* logdev needs REQ_PREFLUSH */
> +#define XLOG_ICL_NEED_FUA (1u << 2) /* iclog needs REQ_FUA */
>
> #define XLOG_ICL_STRINGS \
> - { XLOG_ICL_NEED_FLUSH, "XLOG_ICL_NEED_FLUSH" }, \
> - { XLOG_ICL_NEED_FUA, "XLOG_ICL_NEED_FUA" }
> + { XLOG_ICL_NEED_FLUSH, "XLOG_ICL_NEED_FLUSH" }, \
> + { XLOG_ICL_NEED_FLUSH_LOG, "XLOG_ICL_NEED_FLUSH_LOG" }, \
> + { XLOG_ICL_NEED_FUA, "XLOG_ICL_NEED_FUA" }
>
>
> /*
> --
> 2.53.0
>
>
next prev parent reply other threads:[~2026-09-02 16:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 5:49 fix and then optimize cache flushes for the RT device Christoph Hellwig
2026-09-02 5:49 ` [PATCH 1/6] xfs: also flush the RT device cache in xlog_write_iclog Christoph Hellwig
2026-09-02 16:01 ` Darrick J. Wong
2026-09-02 5:49 ` [PATCH 2/6] xfs: don't continue on error in xfs_fsync Christoph Hellwig
2026-09-02 16:07 ` Darrick J. Wong
2026-09-02 5:49 ` [PATCH 3/6] xfs: clean up xfs_fsync_flush_log a bit Christoph Hellwig
2026-09-02 16:07 ` Darrick J. Wong
2026-09-02 5:49 ` [PATCH 4/6] xfs: avoid extra cache flushes for multi-device file systems in xfs_fsync Christoph Hellwig
2026-09-02 16:12 ` Darrick J. Wong
2026-09-02 5:49 ` [PATCH 5/6] xfs: optimize cache flushing for CIL commits on multi-device file systems Christoph Hellwig
2026-09-02 16:15 ` Darrick J. Wong [this message]
2026-09-02 5:49 ` [PATCH 6/6] xfs: flush multiple device caches in parallel in xlog_write_iclog Christoph Hellwig
2026-09-02 16:18 ` Darrick J. Wong
2026-09-03 5:44 ` Christoph Hellwig
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=20260902161551.GS1933798@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=hch@lst.de \
--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