fdatasync behaviour in macOS

Anil Sharma <[email protected]> Wed, 10 Dec 2025 17:06:51 +1100
Newsgroups org.kernel.vger.fio
Message-ID <CAAJpEdjfZgqpyYDH4TWS3siCRca5rgy+Dj-a7dqCSaX0BObrjw@mail.gmail.com>
Hi,

I am using fio to benchmark serial fsync in macOS. From what I could
understand, both fsync and fdatasync are linked to F_FULLSYNC in macOS. But
the output is very different. fsync=1 can only get 110 tps where
fdatasync=1 option can get 5.5K tps. Which seems like we are only writing
to OS Page Cache.

Question:
Can we get a confirmation whether the fdatasync option is mapped to
F_FULLSYNC?

Commands:
# fsync=1
fio --name=wal_psync_fsync --filename=testfile --size=1G --rw=write \
      --bs=8k --ioengine=psync --fsync=1 --direct=1 --iodepth=1 \
      --numjobs=1 --time_based --runtime=60 --output=1_psync_fsync.txt

  # 2. fdatasync =1
  fio --name=wal_psync_fdatasync --filename=testfile --size=1G --rw=write \
      --bs=8k --ioengine=psync --fdatasync=1 --direct=1 --iodepth=1 \
      --numjobs=1 --time_based --runtime=60 --output=2_psync_fdatasync.txt



fio --version -> fio-3.41
OS/Machine details: Apple M1 Max, macOS Tahoe version 26.1


Please let me know if this needs to go in github issues.

-- 
Thanks & Regards
Anil
Contact # : 0420412630
1_psync_fsync.txt (text/plain, 2.1 KB)
wal_psync_fsync: (g=0): rw=write, bs=(R) 8192B-8192B, (W) 8192B-8192B, (T) 8192B-8192B, ioengine=psync, iodepth=1
fio-3.41
Starting 1 process

wal_psync_fsync: (groupid=0, jobs=1): err= 0: pid=74647: Wed Dec 10 16:45:49 2025
  write: IOPS=105, BW=842KiB/s (862kB/s)(49.3MiB/60003msec); 0 zone resets
    clat (usec): min=9, max=16227, avg=399.81, stdev=468.64
     lat (usec): min=9, max=16227, avg=400.86, stdev=468.70
    clat percentiles (usec):
     |  1.00th=[  192],  5.00th=[  225], 10.00th=[  249], 20.00th=[  281],
     | 30.00th=[  297], 40.00th=[  318], 50.00th=[  334], 60.00th=[  351],
     | 70.00th=[  375], 80.00th=[  412], 90.00th=[  529], 95.00th=[  668],
     | 99.00th=[ 1450], 99.50th=[ 2769], 99.90th=[ 7898], 99.95th=[ 8455],
     | 99.99th=[16188]
   bw (  KiB/s): min=  554, max= 1197, per=99.92%, avg=841.97, stdev=139.09, samples=119
   iops        : min=   69, max=  149, avg=104.77, stdev=17.35, samples=119
  lat (usec)   : 10=0.02%, 20=0.02%, 250=10.50%, 500=78.01%, 750=7.71%
  lat (usec)   : 1000=1.66%
  lat (msec)   : 2=1.44%, 4=0.30%, 10=0.30%, 20=0.03%
  fsync/fdatasync/sync_file_range:
    sync (usec): min=3545, max=84148, avg=9091.53, stdev=4324.35
    sync percentiles (usec):
     |  1.00th=[ 3851],  5.00th=[ 4146], 10.00th=[ 4490], 20.00th=[ 5407],
     | 30.00th=[ 6718], 40.00th=[ 7570], 50.00th=[ 8455], 60.00th=[ 9503],
     | 70.00th=[10683], 80.00th=[12256], 90.00th=[14222], 95.00th=[15795],
     | 99.00th=[18482], 99.50th=[20055], 99.90th=[68682], 99.95th=[74974],
     | 99.99th=[84411]
  cpu          : usr=0.16%, sys=2.29%, ctx=33892, majf=0, minf=10
  IO depths    : 1=200.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=0,6313,0,6313 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
  WRITE: bw=842KiB/s (862kB/s), 842KiB/s-842KiB/s (862kB/s-862kB/s), io=49.3MiB (51.7MB), run=60003-60003msec
2_psync_fdatasync.txt (text/plain, 2.1 KB)
wal_psync_fdatasync: (g=0): rw=write, bs=(R) 8192B-8192B, (W) 8192B-8192B, (T) 8192B-8192B, ioengine=psync, iodepth=1
fio-3.41
Starting 1 process

wal_psync_fdatasync: (groupid=0, jobs=1): err= 0: pid=76325: Wed Dec 10 16:50:03 2025
  write: IOPS=5574, BW=43.6MiB/s (45.7MB/s)(2613MiB/60001msec); 0 zone resets
    clat (usec): min=19, max=5345, avg=155.51, stdev=351.32
     lat (usec): min=19, max=5345, avg=155.55, stdev=351.32
    clat percentiles (usec):
     |  1.00th=[   22],  5.00th=[   22], 10.00th=[   22], 20.00th=[   26],
     | 30.00th=[   30], 40.00th=[   36], 50.00th=[   94], 60.00th=[  116],
     | 70.00th=[  122], 80.00th=[  129], 90.00th=[  143], 95.00th=[ 1500],
     | 99.00th=[ 1729], 99.50th=[ 1795], 99.90th=[ 1926], 99.95th=[ 2147],
     | 99.99th=[ 2311]
   bw (  KiB/s): min=36548, max=49197, per=100.00%, avg=44626.37, stdev=2698.19, samples=119
   iops        : min= 4568, max= 6149, avg=5577.92, stdev=337.31, samples=119
  lat (usec)   : 20=0.03%, 50=48.00%, 100=2.23%, 250=44.59%, 500=0.05%
  lat (usec)   : 750=0.02%, 1000=0.01%
  lat (msec)   : 2=5.01%, 4=0.06%, 10=0.01%
  fsync/fdatasync/sync_file_range:
    sync (usec): min=15, max=29383, avg=23.30, stdev=99.07
    sync percentiles (usec):
     |  1.00th=[   17],  5.00th=[   18], 10.00th=[   18], 20.00th=[   19],
     | 30.00th=[   19], 40.00th=[   20], 50.00th=[   22], 60.00th=[   24],
     | 70.00th=[   24], 80.00th=[   25], 90.00th=[   30], 95.00th=[   33],
     | 99.00th=[   39], 99.50th=[   43], 99.90th=[   67], 99.95th=[   89],
     | 99.99th=[ 3851]
  cpu          : usr=0.67%, sys=8.91%, ctx=671639, majf=0, minf=10
  IO depths    : 1=200.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=0,334478,0,0 short=334478,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
  WRITE: bw=43.6MiB/s (45.7MB/s), 43.6MiB/s-43.6MiB/s (45.7MB/s-45.7MB/s), io=2613MiB (2740MB), run=60001-60001msec