>>Doesn't Windows support O_SYNC (or even better O_DSYNC) flag >to open()? >>That should be the Posixy spelling of FILE_FLAG_WRITE_THROUGH, if the >>latter means what I suppose it does. > >They should, but someone said it didn't work. I haven't >followed up on it, though, so it is quite possible it works. >If so, it is definitly worth trying.
Update on that. There is no O_SYNC nor O_DSYNC. They just aren't there. However, we already have win32_open (in port/open.c) which is used to open these files. We could probably add code there to check for O_SYNC and map it to the correct win32 flags for CreateFile (because the support certainly is there). To make this happen, is it enough to define O_DSYNC in the win32 port include file, and then implement it in the open call? Or do I need to hack xlog.c? The comment claims it's hackery ;-), so I figured I should verify that before actually testing things. Oh, and finally. The win32 commands have the following options: FILE_FLAG_NO_BUFFERING. This disables the cache completely. It also has lots of limits, like every read and write has to be on a sector boundary etc. It gives great performance with async I/O, because it bypasses the memory manager. It appears to be like O_DIRECT on linux? FILE_FLAG_WRITE_THROUGH: " Instructs the system to write through any intermediate cache and go directly to disk. If FILE_FLAG_NO_BUFFERING is not also specified, so that system caching is in effect, then the data is written to the system cache, but is flushed to disk without delay. If FILE_FLAG_NO_BUFFERING is also specified, so that system caching is not in effect, then the data is immediately flushed to disk without going through the system cache. The operating system also requests a write-through the hard disk cache to persistent media. However, not all hardware supports this write-through capability. " It seems to me FILE_FLAG_NO_BUFFERING is the same as O_DSYNC. (A different place in the docs says "Also, the file metadata may still be cached. To flush the metadata to disk, use the FlushFileBuffers function.", so it seems it's more DSYNC than SYNC) //Magnus ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])