Timestamps

Working on Eden’s timestamp storage.

Hm, I wonder what ext4’s possible timestamp range is?

Time to read https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Inode_Timestamps.

That’s a cute way to extend the legacy timestamp format. One extra 32-bit value gives nanosecond precision and extends the range out to year 2446.

What happens if we exceed the range?

dev:~/tmp/timestamps $ df -T .
Filesystem     Type    ...
/dev/vda3      ext4    ...
dev:~/tmp/timestamps $ touch -d '1900-01-01 01:02' a
dev:~/tmp/timestamps $ ls -l
total 0
-rw-r--r--. 1 chadaustin users 0 Jan  1  1900 a

Huh, that’s weird. ext4 shouldn’t be able to represent 1900.

dev:~/tmp/timestamps $ touch -d '2800-01-01 01:02' b
dev:~/tmp/timestamps $ ls -l
total 0
-rw-r--r--. 1 chadaustin users 0 Jan  1  1900 a
-rw-r--r--. 1 chadaustin users 0 Jan  1  2800 b

And it definitely shouldn’t be able to represent year 2800…

dev:~/tmp/timestamps $ sudo bash -c 'echo 2 > /proc/sys/vm/drop_caches'
dev:~/tmp/timestamps $ ls -l
total 0
-rw-r--r--. 1 chadaustin users 0 May 29  2444 a
-rw-r--r--. 1 chadaustin users 0 Aug  5  2255 b

… oh.

Leave a Reply

Your email address will not be published. Required fields are marked *