mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Simplify time handling logic in zfs_settattr
Simplify time handling in zfs_setattr by mimicking the logic in setattr_copy from the linux kernel. In order to achieve this in the case when ZFS' log is being replayed it is necessary to unconditionally set the ctime in zfs_replay_setattr. Also use the timespec_trunc function when assigning values to the generic inode struct. This is currently a noop since zfs sets s_time_gran to 1, however in the future rules about precision might change. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Chunwei Chen <david.chen@osnexus.com> Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com> Closes #4916
This commit is contained in:
committed by
Brian Behlendorf
parent
9f5f0019ab
commit
87f9371aef
@@ -335,7 +335,8 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
|
||||
vap->va_ctime = ia->ia_ctime;
|
||||
|
||||
if (vap->va_mask & ATTR_ATIME)
|
||||
ip->i_atime = ia->ia_atime;
|
||||
ip->i_atime = timespec_trunc(ia->ia_atime,
|
||||
ip->i_sb->s_time_gran);
|
||||
|
||||
cookie = spl_fstrans_mark();
|
||||
error = -zfs_setattr(ip, vap, 0, cr);
|
||||
|
||||
Reference in New Issue
Block a user