Comment by StillBored
4 years ago
Hmm as slow as that is, does the controller support VERIFY? Because there is FUA in verify which forces the range to flush as well, and it could be used as a range flush. Depending on how they implement the disk cache its possible that is faster than a full cache walk (which is likely what they are doing).
This is one of those things that SCSI was much better at, SYNC CACHE had a range option which could be used to flush say particular files/database tables/objects/whatever to nonvolatile storage. Of course out of the box Linux (and most other OSs) don't track their page/buffer caches closely enough to pull this off, so that fsync(fileno) is closer to sync(). So, few storage systems implemented it properly anyway.
The choice of ignoring flushes vaguely makes sense if you assume the mac's SSD is in a laptop with a battery. In theory then the disk cache is non-volatile (and this assumption is made on various enterprise storage arrays with battery backup as well, although frequently its a controller setting). But i'm guessing someone just ignored the case of the mac mini without a battery.
I assumed the barrier was doing something like that, but marcan was able to inspect the actual nvme commands issued and has confirmed thats not the case.
But that would be awesome, especially with these ever growing cache capacities.