Why does BSD Fast File System call syncip from itrunc?

John J. Wallace jjw at palladium.UUCP
Fri Jul 8 05:20:37 AEST 1988


Wizard-level question:

	In the FFS implementation, why does itrunc() call syncip() when
	it wants to synch the inode to disk instead of simply calling
	iupdat()?

Explanation of question:

	Itrunc(ip, new_size) truncates an inode to a new size,
	typically zero.  New_size can be non-zero when some program
	uses one of the ftruncate family of system calls.

	When itrunc() wants to synch the inode to disk it calls
	syncip(), not iupdat().  The difference is that syncip makes
	sure all *data blocks* for the file are synched to disk
	(synchronously, I believe) before writing the inode to disk
	(also synchronously).  Iupdat() just does the inode, which
	would be quicker.

	So... why is this so.  Is there some implication that
	ftruncate() also does an fsync()?  I hope not.  Is it some
	crash-resistant concern?  Unix is not careful about writing
	data blocks before the inode, so why should this be any
	different?  Or is this another example of ... (byte my
	tongue).


Thanks, I will summarize if any interest.



More information about the Comp.unix.wizards mailing list