diff options
author | Tim Chase <[email protected]> | 2014-01-18 13:00:53 -0600 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-01-29 15:50:44 -0800 |
commit | 6d111134c0d1eb9b179eb9fddf26a31d5d45ae22 (patch) | |
tree | 58b2ef03d95ddcc6721574651ea223e7150c1763 /module/zfs/zfs_vfsops.c | |
parent | 2278381ce2a820afe76dd9650298858d7037a01b (diff) |
Implement relatime.
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
Diffstat (limited to 'module/zfs/zfs_vfsops.c')
-rw-r--r-- | module/zfs/zfs_vfsops.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index f331a36ea..ec59bfbd8 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -138,6 +138,12 @@ atime_changed_cb(void *arg, uint64_t 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) { zfs_sb_t *zsb = arg; @@ -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, + 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 @@ unregister: */ (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); |