]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/zfs_vnops.c
Enable lazytime semantic for atime
authorChunwei Chen <david.chen@osnexus.com>
Thu, 31 Mar 2016 23:52:03 +0000 (16:52 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 6 Apr 2016 01:55:51 +0000 (18:55 -0700)
commit704cd0758a1a4ecef47b0dfa097acd94c8e4f57d
tree18a9d083cf3774a1b36a44c44576d01ca5b68b72
parent0df9673f01e8c52d882502d62789fa66efc327e2
Enable lazytime semantic for atime

Linux 4.0 introduces lazytime. The idea is that when we update the atime, we
delay writing it to disk for as long as it is reasonably possible.

When lazytime is enabled, dirty_inode will be called with only I_DIRTY_TIME
flag whenever i_atime is updated. So under such condition, we will set
z_atime_dirty. We will only write it to disk if file is closed, inode is
evicted or setattr is called. Ideally, we should also write it whenever SA
is going to be updated, but it is left for future improvement.

There's one thing that we should take care of now that we allow i_atime to be
dirty. In original implementation, whenever SA is modified, zfs_inode_update
will be called to overwrite every thing in inode. This will cause dirty
i_atime to be discarded. We fix this by don't overwrite i_atime in
zfs_inode_update. We only overwrite i_atime when allocating new inode or doing
zfs_rezget with zfs_inode_update_new.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #4482
module/zfs/zfs_vnops.c
module/zfs/zfs_znode.c
module/zfs/zpl_inode.c