Re: [PATCH 1/2] xfs: number the cache flushes submitted to each buftarg
From: Brian Foster
Date: Mon Nov 09 2026 - 12:48:40 EST
On Thu, Nov 05, 2026 at 11:49:12AM +0900, Daejun Park via B4 Relay wrote:
> From: Daejun Park <daejun7.park@xxxxxxxxxxx>
>
> fsync can only skip its own cache flush when its log force wrote out
> the iclog. It cannot tell whether a flush that another task submitted
> covers its data.
>
> Number the cache flushes that the log code submits to each buftarg,
> and record the highest number that completed without error. Nothing
> reads the numbers yet.
>
> Signed-off-by: Daejun Park <daejun7.park@xxxxxxxxxxx>
> ---
> fs/xfs/xfs_buf.c | 13 +++++++++++++
> fs/xfs/xfs_buf.h | 21 +++++++++++++++++++++
> fs/xfs/xfs_log.c | 25 +++++++++++++++++++------
> fs/xfs/xfs_log_priv.h | 1 +
> 4 files changed, 54 insertions(+), 6 deletions(-)
>
...
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 74b324f915a..734daa4e99b 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
...
> @@ -1688,6 +1698,9 @@ xlog_write_iclog(
> iclog->ic_bio.bi_opf |= REQ_PREFLUSH;
> if (iclog->ic_flags & XLOG_ICL_NEED_FUA)
> iclog->ic_bio.bi_opf |= REQ_FUA;
> + iclog->ic_flush_seq = 0;
> + if (iclog->ic_bio.bi_opf & REQ_PREFLUSH)
> + iclog->ic_flush_seq = xfs_buftarg_flush_start(log->l_targ);
Bit of a nit, but it looks like this would be cleaner if we moved both
of these a bit further up. I.e., zero ->ic_flush_seq right after where
we init the iclog->ic_bio fields, and then move the assignment under the
same block where we set the PREFLUSH flag. Hm?
Brian
>
> iclog->ic_flags &= ~(XLOG_ICL_NEED_FLUSH | XLOG_ICL_NEED_FLUSH_LOG |
> XLOG_ICL_NEED_FUA);
> diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
> index 529720a4984..df0f13c4e04 100644
> --- a/fs/xfs/xfs_log_priv.h
> +++ b/fs/xfs/xfs_log_priv.h
> @@ -222,6 +222,7 @@ struct xlog_in_core {
> #endif
> struct semaphore ic_sema;
> struct work_struct ic_end_io_work;
> + s64 ic_flush_seq; /* buftarg flush number */
> struct bio ic_bio;
> struct bio_vec ic_bvec[];
> };
>
> --
> 2.43.0
>
>
>