ext4: avoid zero i_dtime wrap in ialloc-test on RTC-less VMs
On RTC-less virtual machines such as QEMU arm64, ktime_get_real_seconds()
starts at 0 on boot. In ialloc_test_find_inode_bit() and
ialloc_test_recently_deleted(), computing (now - age) for age = 10/20/120
can evaluate to 0 if the test runs at that exact uptime second. Because
recently_deleted() treats i_dtime == 0 as "never deleted", the test
spuriously fails when now == 10.
Add a small helper ialloc_test_past_dtime() that bumps the age by 1
second (wrapping to 0xffffffff) whenever (now - age) == 0, keeping the
timestamp in the same wrap-safe time_before32() window while guaranteeing
a non-zero on-disk i_dtime.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 file changed