Les Mikesell wrote on Thu, Jun 30, 2011 at 13:56:27 -0500: > On 6/30/2011 1:15 PM, Andreas Krey wrote: > >On Thu, 30 Jun 2011 11:35:17 +0000, Les Mikesell wrote: > >... > >>I think you are being way too optimistic about real-world filesystems > >>and disk and controller caches. It is possible to make a system that > >>behaves with the ideal behavior you describe - and maybe many do in > >>terms of the filenames and directory entries. > > > >Actually, more like for reads and writes into/from a single file; > >a full sync() tends to be a bit expensive. > > At least for older versions of linux and some of its filesystems > there is no difference between an fsync() and a sync() because it > didn't really track the per-file dirty cache. I assume that is > fixed in current versions but don't really know. Even now, I don't > think it always propagates through the LVM and filesystem layers > reliably. And if your raid controller has a cache without a battery > backup. >
There is this bit of Linux-specific code in FSFS: /* Linux has the unusual feature that fsync() on a file is not enough to ensure that a file's directory entries have been flushed to disk; you have to fsync the directory as well. On other operating systems, we'd only be asking for trouble by trying to open and fsync a directory. */