Skip to contentSkip to conversation

Why do we update ctime in generic_file_write?

DISCUSSION Andreas Dilger 2 participants 2 messages Jan 22, 2003 VFS

lore
Share & tools
lore
#0 lore raw

I was looking at the code in generic file write (both 2.4 and 2.5) and in both cases we update the ctime always. My understanding here is that the mtime reflects the data modification time, while the ctime reflects the inode change time, so we should only be updating the ctime (at most) if the file size was increased, and not if we are overwriting data.

Anyone have any good rationale for the current behaviour?

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

" " == Andreas Dilger <[email protected]> writes:

> I was looking at the code in generic file write (both 2.4 and > 2.5) and in both cases we update the ctime always. My > understanding here is that the mtime reflects the data > modification time, while the ctime reflects the inode change > time, so we should only be updating the ctime (at most) if the > file size was increased, and not if we are overwriting data.

See the Single UNIX Specification on
http://www.opengroup.org/cgi-bin/sussearch.pl

st_ctime is always supposed to be updated whenever st_mtime is (although the converse is not true).

Cheers,
Trond