Skip to content

Commit

Permalink
Enable relatime by default
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: George Melikov <[email protected]>
Closes #13614
  • Loading branch information
gmelikov authored Aug 12, 2022
1 parent b3d0568 commit fbc210f
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion man/man7/zfsprops.7
Original file line number Diff line number Diff line change
Expand Up @@ -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
existing access time hasn't been updated within the past 24 hours.
The default value is
.Sy off .
.Sy on .
The values
.Sy on
and
Expand Down
2 changes: 1 addition & 1 deletion module/zcommon/zfs_prop.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ zfs_prop_init(void)
/* inherit index (boolean) properties */
zprop_register_index(ZFS_PROP_ATIME, "atime", 1, PROP_INHERIT,
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,
sfeatures);
zprop_register_index(ZFS_PROP_DEVICES, "devices", 1, PROP_INHERIT,
Expand Down
6 changes: 2 additions & 4 deletions tests/zfs-tests/tests/functional/atime/atime_001_pos.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ do
mtpt=$(snapshot_mountpoint $dst)
log_mustnot check_atime_updated $mtpt/$TESTFILE
else
if is_linux; then
log_must zfs set relatime=off $dst
fi

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
fi
Expand Down
1 change: 1 addition & 0 deletions tests/zfs-tests/tests/functional/atime/atime_003_pos.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ do
else
log_must zfs set atime=on $dst
log_must zfs set relatime=on $dst

log_must check_atime_updated $mtpt/$TESTFILE
log_mustnot check_atime_updated $mtpt/$TESTFILE
fi
Expand Down
7 changes: 3 additions & 4 deletions tests/zfs-tests/tests/functional/atime/root_atime_on.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ do
mtpt=$(snapshot_mountpoint $dst)
log_mustnot check_atime_updated $mtpt/$TESTFILE
else
if is_linux; then
log_must zfs set relatime=off $(dirname $dst)
fi

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
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ do
else
log_must zfs set atime=on $(dirname $dst)
log_must zfs set relatime=on $(dirname $dst)

log_must check_atime_updated $mtpt/$TESTFILE
log_mustnot check_atime_updated $mtpt/$TESTFILE
fi
Expand Down
7 changes: 5 additions & 2 deletions tests/zfs-tests/tests/functional/cache/cache_012_pos.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# for 10 sec.
# 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
# larger than the default (64MB).
# larger than the default (256MB).
# 6. Record the l2_size.
# 7. Random read for 1 sec.
# 8. Record the l2_size again.
Expand Down Expand Up @@ -87,14 +87,17 @@ log_must truncate -s $VDEV_SZ $VDEV

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/random_reads.fio

typeset write_max2=$(get_tunable L2ARC_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

typeset do_once=true
Expand Down

0 comments on commit fbc210f

Please sign in to comment.