Theodore Tso wrote:I haven't read the code and don't use MacOS myself. From its fcntl() man page: Note that while fsync() will flush all data from the host to the drive (i.e. the "permanent storage device"), the drive itself may not physically write the data to the platters for quite some time and it may be written in an out-of-order sequence. Specifically, if the drive loses power or the OS crashes, the application may find that only some or none of their data was written. The disk drive may also re-order the data so that later writes may be present while earlier writes are not. This is not a theoretical edge case. This scenario is easily reproduced with real world workloads and drive power failures. For applications that require tighter guarantess about the integrity of their data, MacOS X provides the F_FULLFSYNC fcntl. The F_FULLFSYNC fcntl asks the drive to flush all buffered data to permanent storage. Applications such as databases that require a strict ordering of writes should use F_FULLFSYNC to ensure their data is written in the order they expect. Please see fcntl(2) for more detail. Some notable things: 1. Para 2 says "if the drive loses power __or the OS crashes__". Does this mean some drives will abandon cached writes when reset despite retaining power? 2. Para 3 to be re-read by the skeptical. 3. Para 4 perpetuates the confused idea that write ordering is what it's all about, for things like databases. In fact, sometimes ordering barriers are all that's needed and flush is unnecessary performance baggage. But sometimes an fsync() which only guarantees ordering is insufficient. An "ideal" database-friendly block layer would offer both. I doubt if common unix mail transports use F_FULLSYNC on Darwin instead of fsync(), before reporting a mail received safely, but they probably should. I recall SQLite does use it (unless I'm confusing it with some other database). -- Jamie --
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| David Miller | Slow DOWN, please!!! |
| Peter Zijlstra | [PATCH 00/23] per device dirty throttling -v8 |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| Natalie Protasevich | [BUG] New Kernel Bugs |
git: | |
