Enable relatime by default

Linux sets relatime on mount by default for any file system,
but relatime=off in ZFS disables it explicitly.

Let's be consistent with other file systems on Linux.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Melikov <mail@gmelikov.ru>
Closes #13614
This commit is contained in:
George Melikov 2022-08-13 00:20:25 +03:00 committed by GitHub
parent b3d0568cfd
commit fbc210fab2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 12 deletions

View File

@ -1545,7 +1545,7 @@ Access time is only updated if the previous
access time was earlier than the current modify or change time or if the access time was earlier than the current modify or change time or if the
existing access time hasn't been updated within the past 24 hours. existing access time hasn't been updated within the past 24 hours.
The default value is The default value is
.Sy off . .Sy on .
The values The values
.Sy on .Sy on
and and

View File

@ -465,7 +465,7 @@ zfs_prop_init(void)
/* inherit index (boolean) properties */ /* inherit index (boolean) properties */
zprop_register_index(ZFS_PROP_ATIME, "atime", 1, PROP_INHERIT, zprop_register_index(ZFS_PROP_ATIME, "atime", 1, PROP_INHERIT,
ZFS_TYPE_FILESYSTEM, "on | off", "ATIME", boolean_table, sfeatures); ZFS_TYPE_FILESYSTEM, "on | off", "ATIME", boolean_table, sfeatures);
zprop_register_index(ZFS_PROP_RELATIME, "relatime", 0, PROP_INHERIT, zprop_register_index(ZFS_PROP_RELATIME, "relatime", 1, PROP_INHERIT,
ZFS_TYPE_FILESYSTEM, "on | off", "RELATIME", boolean_table, ZFS_TYPE_FILESYSTEM, "on | off", "RELATIME", boolean_table,
sfeatures); sfeatures);
zprop_register_index(ZFS_PROP_DEVICES, "devices", 1, PROP_INHERIT, zprop_register_index(ZFS_PROP_DEVICES, "devices", 1, PROP_INHERIT,

View File

@ -62,11 +62,9 @@ do
mtpt=$(snapshot_mountpoint $dst) mtpt=$(snapshot_mountpoint $dst)
log_mustnot check_atime_updated $mtpt/$TESTFILE log_mustnot check_atime_updated $mtpt/$TESTFILE
else else
if is_linux; then
log_must zfs set relatime=off $dst
fi
log_must zfs set atime=on $dst log_must zfs set atime=on $dst
log_must zfs set relatime=off $dst
log_must check_atime_updated $mtpt/$TESTFILE log_must check_atime_updated $mtpt/$TESTFILE
log_must check_atime_updated $mtpt/$TESTFILE log_must check_atime_updated $mtpt/$TESTFILE
fi fi

View File

@ -62,6 +62,7 @@ do
else else
log_must zfs set atime=on $dst log_must zfs set atime=on $dst
log_must zfs set relatime=on $dst log_must zfs set relatime=on $dst
log_must check_atime_updated $mtpt/$TESTFILE log_must check_atime_updated $mtpt/$TESTFILE
log_mustnot check_atime_updated $mtpt/$TESTFILE log_mustnot check_atime_updated $mtpt/$TESTFILE
fi fi

View File

@ -65,11 +65,10 @@ do
mtpt=$(snapshot_mountpoint $dst) mtpt=$(snapshot_mountpoint $dst)
log_mustnot check_atime_updated $mtpt/$TESTFILE log_mustnot check_atime_updated $mtpt/$TESTFILE
else else
if is_linux; then
log_must zfs set relatime=off $(dirname $dst)
fi
log_must zfs set atime=on $(dirname $dst) log_must zfs set atime=on $(dirname $dst)
# inherited relatime won't apply because of mount option, set explicitly
log_must zfs set relatime=off $dst
log_must check_atime_updated $mtpt/$TESTFILE log_must check_atime_updated $mtpt/$TESTFILE
log_must check_atime_updated $mtpt/$TESTFILE log_must check_atime_updated $mtpt/$TESTFILE
fi fi

View File

@ -68,6 +68,7 @@ do
else else
log_must zfs set atime=on $(dirname $dst) log_must zfs set atime=on $(dirname $dst)
log_must zfs set relatime=on $(dirname $dst) log_must zfs set relatime=on $(dirname $dst)
log_must check_atime_updated $mtpt/$TESTFILE log_must check_atime_updated $mtpt/$TESTFILE
log_mustnot check_atime_updated $mtpt/$TESTFILE log_mustnot check_atime_updated $mtpt/$TESTFILE
fi fi

View File

@ -33,7 +33,7 @@
# for 10 sec. # for 10 sec.
# 4. Verify that l2arc_write_max is set back to the default. # 4. Verify that l2arc_write_max is set back to the default.
# 5. Set l2arc_write_max to a value less than the cache device size but # 5. Set l2arc_write_max to a value less than the cache device size but
# larger than the default (64MB). # larger than the default (256MB).
# 6. Record the l2_size. # 6. Record the l2_size.
# 7. Random read for 1 sec. # 7. Random read for 1 sec.
# 8. Record the l2_size again. # 8. Record the l2_size again.
@ -87,6 +87,9 @@ log_must truncate -s $VDEV_SZ $VDEV
log_must zpool create -f $TESTPOOL $VDEV cache $VCACHE log_must zpool create -f $TESTPOOL $VDEV cache $VCACHE
# Actually, this test relies on atime writes to force the L2 ARC discards
log_must zfs set relatime=off $TESTPOOL
log_must fio $FIO_SCRIPTS/mkfiles.fio log_must fio $FIO_SCRIPTS/mkfiles.fio
log_must fio $FIO_SCRIPTS/random_reads.fio log_must fio $FIO_SCRIPTS/random_reads.fio
@ -94,7 +97,7 @@ typeset write_max2=$(get_tunable L2ARC_WRITE_MAX)
log_must test $write_max2 -eq $write_max log_must test $write_max2 -eq $write_max
log_must set_tunable32 L2ARC_WRITE_MAX $(( 64 * 1024 * 1024 )) log_must set_tunable32 L2ARC_WRITE_MAX $(( 256 * 1024 * 1024 ))
export RUNTIME=1 export RUNTIME=1
typeset do_once=true typeset do_once=true