-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
Add the "relatime" property. When set to "on", a file's atime will only be updated if the existing atime at least a day old or if the existing ctime or mtime has been updated since the last access. This behavior is compatible with the Linux "relatime" mount option. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2064 Closes #1917
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,12 @@ atime_changed_cb(void *arg, uint64_t newval) | |
((zfs_sb_t *)arg)->z_atime = newval; | ||
} | ||
|
||
static void | ||
relatime_changed_cb(void *arg, uint64_t newval) | ||
{ | ||
((zfs_sb_t *)arg)->z_relatime = newval; | ||
} | ||
|
||
static void | ||
xattr_changed_cb(void *arg, uint64_t newval) | ||
{ | ||
|
@@ -275,6 +281,8 @@ zfs_register_callbacks(zfs_sb_t *zsb) | |
dsl_pool_config_enter(dmu_objset_pool(os), FTAG); | ||
error = dsl_prop_register(ds, | ||
zfs_prop_to_name(ZFS_PROP_ATIME), atime_changed_cb, zsb); | ||
error = dsl_prop_register(ds, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dweeezil
Author
Contributor
|
||
zfs_prop_to_name(ZFS_PROP_RELATIME), relatime_changed_cb, zsb); | ||
error = error ? error : dsl_prop_register(ds, | ||
zfs_prop_to_name(ZFS_PROP_XATTR), xattr_changed_cb, zsb); | ||
error = error ? error : dsl_prop_register(ds, | ||
|
@@ -314,6 +322,8 @@ zfs_register_callbacks(zfs_sb_t *zsb) | |
*/ | ||
(void) dsl_prop_unregister(ds, zfs_prop_to_name(ZFS_PROP_ATIME), | ||
atime_changed_cb, zsb); | ||
(void) dsl_prop_unregister(ds, zfs_prop_to_name(ZFS_PROP_RELATIME), | ||
relatime_changed_cb, zsb); | ||
(void) dsl_prop_unregister(ds, zfs_prop_to_name(ZFS_PROP_XATTR), | ||
xattr_changed_cb, zsb); | ||
(void) dsl_prop_unregister(ds, zfs_prop_to_name(ZFS_PROP_RECORDSIZE), | ||
|
@@ -914,6 +924,9 @@ zfs_unregister_callbacks(zfs_sb_t *zsb) | |
VERIFY(dsl_prop_unregister(ds, "atime", atime_changed_cb, | ||
zsb) == 0); | ||
|
||
VERIFY(dsl_prop_unregister(ds, "relatime", relatime_changed_cb, | ||
zsb) == 0); | ||
|
||
VERIFY(dsl_prop_unregister(ds, "xattr", xattr_changed_cb, | ||
zsb) == 0); | ||
|
||
|
2 comments
on commit 6d11113
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@behlendorf So can one set atime=off and relatime=on. Does both need to be on to take effect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CMCDragonkai relatime=[on|off] will have no effect unless atime=on
Should this not keep the value of "error" like the other lines do?