View Full Version : Any point in using O_FSYNC on open()?
jostrowski
January 24th, 2009, 23:13
Can anyone tell me if there is any point in using the O_FSYNC flag when opening files on disks in FreeBSD since FreeBSD sees disks as character devices rather than block devices? I see the flag is still available.
From what I've read, the buffer cache for disks was removed in FreeBSD post ver 3.x.
Maledictus
January 25th, 2009, 00:46
What should it have to do with block devices? Just expect that it works as documented regardless of the underlying type in the fs.
Djn
January 25th, 2009, 04:49
There are other caches in the system, so I'd assume it still does something. (For one thing, I believe writes are kept in memory a bit to allow gathering them into more effective disk operations.)
Maledictus
January 25th, 2009, 12:38
afaik that's not allowed with O_FSYNC. What the system does depends on the underlying FS. So there are differences for UFS or UFS+Softupdates or ZFS.
Djn
January 25th, 2009, 14:59
afaik that's not allowed with O_FSYNC.
My point exactly. ;)
jostrowski
January 26th, 2009, 00:15
Thanks for the responses. Yeah those are my thoughts, too. I was just trying to reconcile it with what I was reading in the Developer's Handbook:
http://freebsd.active-venture.com/arch-handbook/driverbasics-block.html
After reading that, I wondered what part of the kernel the "buffer cache" is referring to. Perhaps there are a couple of different caches, and just one was eliminated.
trasz@
January 27th, 2009, 14:52
@jostrowski: Exactly. What was removed was buffer cache, which was a cache below the filesystem. What is left is page cache, which is a cache above the filesystem. So, data is still being buffered in memory. The buffer cache was just redundant, so got removed.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.