On Tue, Mar 11, 2025 at 11:47 PM Warner Losh <imp(a)bsdimp.com> wrote:
So I think I have to disagree about what it means in
v7, comments notwithstanding.
I'm not sure which part you're disagreeing with; I think Ted had it
right. The comment is just wrong, but that's what he said, if I
understood correctly.
iupdat() has:
if(ip->i_flag&ICHG)
dp->di_ctime = time;
ICHG is set in unlink(), chmod(), chown() and utime() (maybe a few others, this was a
quick peek).
So even in v7, ctime means any changes to metadata / inode data. At least for some
definition of "any".
Btw, it looks like this was named IUPD in v6 and did similar things. In v6 it is updated
in iput when IUPD is set. But it looks like ctime and mtime are folded together. So v7 is
the first edition that has ctime and the code implements any change to metadata from my
reading.
In both 6th and 7th edition (and later? Certainly into early BSD),
IUPD governs updates to mtime. 6th Edition doesn't have ctime at all,
and uses mtime for everything that the combination of mtime and ctime
is used for in later systems (modulo things only added later, of
course). I'd rephrase what you wrote as saying that what mtime
represented in the 6th edition is split between ctime and mtime in 7th
edition and later; IUPD is retained but is specific to updating the
file contents, while ICHG represents any change to the file, whether
contents or metadata.
- Dan C.
On Tue, Mar 11, 2025 at 8:19 PM Theodore Ts'o
<tytso(a)mit.edu> wrote:
>
> As part of a discusion on the Linux kernel mailing list, there was an
> assertion that ctime was orginally "creation time".
>
> From the v7 sources in TUHS, we can see:
>
> struct dinode
> {
> unsigned short di_mode; /* mode and type of file */
> short di_nlink; /* number of links to file */
> short di_uid; /* owner's user id */
> short di_gid; /* owner's group id */
> off_t di_size; /* number of bytes in file */
> char di_addr[40]; /* disk block addresses */
> time_t di_atime; /* time last accessed */
> time_t di_mtime; /* time last modified */
> time_t di_ctime; /* time created */
> };
>
> ... although the v7 kernel sources does seem to update ctime when the
> inode metadata changes, regardless of what the coment in
> /usr/src/sys/h/ino.h might say.
>
> More interestingly, this comment seems to continue in newer versions
> up to 3BSD, and then the comments becomes "change time" in BSD 4.2,
> probably coincident with the File System Implementation?
>
> The best we can guess is that the change from "creation time" to
> "inode change time" happened sometime between 1979 and 1982. Does
> anyone who was around can give the story about how and when this
> happened?
>
> - Ted