[PATCH v2 0/2] xfs: skip redundant fsync cache flushes

From: Daejun Park via B4 Relay

Date: Tue Nov 10 2026 - 22:19:04 EST


Concurrent fsyncs often wait for an iclog that another task wrote out,
and then send their own cache flush. Patch 1 numbers the cache flushes
on each buftarg. Patch 2 uses the numbers to skip that flush when a
later flush has completed.

16 fio jobs of 4k append + fsync in a QEMU guest: 1111 -> 4498
fsyncs/s. fstests -g quick shows no change, and a dm-log-writes crash
test on an internal log lost no data (patch 2).

---
Changes in v2:
- Zero ic_flush_seq after the bio setup and take the flush number
where REQ_PREFLUSH is set
- Move the fio result into the commit log of patch 2, measured again
for both kernels on the new base, and add the single job result
- Rename the argument of xfs_buftarg_flushed_since() and the fsync
local to submit_seq, and describe the submit and completion ordering
in the comments
- Keep the fsync comment on why the flush is needed
- In patch 2, shorten the DAX text in the comment and the commit log,
and drop the commit log sentence on numbering the fsync's own flush
- Say below --- of patch 2 what changes for a failed flush on
bio-based dm
- Rebase onto the current for-next (v7.4-rc2)

---
Daejun Park (2):
xfs: number the cache flushes submitted to each buftarg
xfs: skip the fsync flush when a later flush has completed

fs/xfs/xfs_buf.c | 40 ++++++++++++++++++++++++++++++++++++++++
fs/xfs/xfs_buf.h | 43 +++++++++++++++++++++++++++++++++++++++++++
fs/xfs/xfs_file.c | 18 +++++++++++++++---
fs/xfs/xfs_log.c | 28 +++++++++++++++++++++-------
fs/xfs/xfs_log_priv.h | 1 +
5 files changed, 120 insertions(+), 10 deletions(-)
---
base-commit: 48326a2382d80715475d10ce98734ac65d2d2150
change-id: 20261105-xfs-fsync-flush-seq-83ae2cff6225

Best regards,
--
Daejun Park <daejun7.park@xxxxxxxxxxx>