Re: [PATCH v3] xfs: skip the fsync flush when a later flush has completed

From: Daejun Park

Date: Fri Dec 04 2026 - 02:24:23 EST


On Mon, Nov 30, 2026 at 01:58:41PM +0100, Christoph Hellwig wrote:
> > 32 AGs, 512 clients: 4812 -> 3256, 0.5 -> 21.6 s
[...]
> The 32 AGs, 512 default number looks a bit worrysome. What is the
> file system and log size in this case?

80 GiB with a 64 MiB internal log. The log is the mkfs.xfs 6.6.0
default; I set agcount=32 by hand. With 8 CPUs, mkfs.xfs 7.1.1 gives
this device 4 AGs, or 8 if it is non-rotational. With 8 AGs, the 64 MiB
log and a write back cache, 6 boots per kernel:

clients MB/s base -> v3 v3 vs base, 95% CI max latency (median)
128 1786 -> 6587 +269% [+261, +276] 0.4 -> 0.4 s
256 3090 -> 4650 +51% [+47, +54] 0.3 -> 4.1 s
512 4202 -> 4638 +10% [+7, +14] 0.4 -> 24.9 s
1024 4358 -> 4532 +4% [+0, +8] 10.2 -> 27.1 s

With the default AG count, v3 shows no throughput loss, but the long
latencies remain.

[...]
> And this looks really weird. The changes are fairly minimal, but
> if reproducible something is wrong as we should not slow down
> workloads that do not have a volatile write cache.

Thanks. On a write through device, with 24 runs per kernel instead of 3
over 6 boots, the slowdown did not reproduce:

v3 vs base, 95% CI
4 AGs, 256 clients +0.6% [-1.3, +2.6]
32 AGs, 512 clients 0.0% [-1.1, +1.1]

> Is this just the extra atomics? Can you check if the overhead
> disappears if you only maintain the counters if data or rt device
> cache flushes are needed)?

In the dbench runs above, gating the counters on bdev_write_cache()
showed no gain. With the CPU as the limit, the counters seem to cost
about 2.5% at 8 and 16 jobs: fio 4 KiB overwrites with fdatasync on a
write through null_blk, 6 boots per kernel:

jobs v3 vs base, 95% CI gated vs base
1 -0.4% [-1.2, +0.5] -0.5% [-1.5, +0.6]
8 -2.6% [-5.2, +0.0] 0.0% [-2.0, +2.0]
16 -2.4% [-5.6, +0.8] -0.9% [-2.8, +0.9]

So v4 will keep the counters only for a device with a volatile write
cache.

[...]
> So the default log about is 64MiB?

Yes, up to 128 GiB. For a larger file system, mkfs.xfs 7.1.1 makes the
log 1/2048 of it. On a non-rotational device, many CPUs can make it
larger.

Best regards,
Daejun