where did all my memory go? (file system cache)

Chuck Swiger cswiger at mac.com
Thu Feb 17 20:24:39 GMT 2005


Joseph Koshy wrote:
>> what I want is:
>>
>> int fd = open("myfile",...);
>> write1GBfiletodisk(fd, data);
>> ioctl(fd, PURGEFROMCACHE);
>> perform_md5(fd);
>>
>>and be sure that teh MD5 is that of what is on the disk.
>>not what is in RAM.
> 
> unmount(file-system-of("myfile")) (even if it fails) ?

That's actually a pretty good suggestion, and is less intrusive than, say 
rebooting, which is probably the only way to be entirely sure that the write 
cache on the drive itself has been flushed.  If the write cache is off, Julian 
probably ought to be able to trust fsync(2)...?

-- 
-Chuck



More information about the freebsd-current mailing list