Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nfs: split nfs_update_timestamps

The VFS paths update either the atime or ctime and mtime but never mix
between atime and the others. Split nfs_update_timestamps to match this
to prepare for cleaning up the VFS interfaces.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20260108141934.2052404-4-hch@lst.de
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Christoph Hellwig and committed by
Christian Brauner
b8b3002f dc9629fa

+15 -16
+15 -16
fs/nfs/inode.c
··· 669 669 NFS_I(inode)->cache_validity &= ~cache_flags; 670 670 } 671 671 672 - static void nfs_update_timestamps(struct inode *inode, unsigned int ia_valid) 672 + static void nfs_update_atime(struct inode *inode) 673 673 { 674 - enum file_time_flags time_flags = 0; 675 - unsigned int cache_flags = 0; 674 + inode_update_timestamps(inode, S_ATIME); 675 + NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_ATIME; 676 + } 676 677 677 - if (ia_valid & ATTR_MTIME) { 678 - time_flags |= S_MTIME | S_CTIME; 679 - cache_flags |= NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME; 680 - } 681 - if (ia_valid & ATTR_ATIME) { 682 - time_flags |= S_ATIME; 683 - cache_flags |= NFS_INO_INVALID_ATIME; 684 - } 685 - inode_update_timestamps(inode, time_flags); 686 - NFS_I(inode)->cache_validity &= ~cache_flags; 678 + static void nfs_update_mtime(struct inode *inode) 679 + { 680 + inode_update_timestamps(inode, S_MTIME | S_CTIME); 681 + NFS_I(inode)->cache_validity &= 682 + ~(NFS_INO_INVALID_CTIME | NFS_INO_INVALID_MTIME); 687 683 } 688 684 689 685 void nfs_update_delegated_atime(struct inode *inode) 690 686 { 691 687 spin_lock(&inode->i_lock); 692 688 if (nfs_have_delegated_atime(inode)) 693 - nfs_update_timestamps(inode, ATTR_ATIME); 689 + nfs_update_atime(inode); 694 690 spin_unlock(&inode->i_lock); 695 691 } 696 692 697 693 void nfs_update_delegated_mtime_locked(struct inode *inode) 698 694 { 699 695 if (nfs_have_delegated_mtime(inode)) 700 - nfs_update_timestamps(inode, ATTR_MTIME); 696 + nfs_update_mtime(inode); 701 697 } 702 698 703 699 void nfs_update_delegated_mtime(struct inode *inode) ··· 743 747 ATTR_ATIME|ATTR_ATIME_SET); 744 748 } 745 749 } else { 746 - nfs_update_timestamps(inode, attr->ia_valid); 750 + if (attr->ia_valid & ATTR_MTIME) 751 + nfs_update_mtime(inode); 752 + if (attr->ia_valid & ATTR_ATIME) 753 + nfs_update_atime(inode); 747 754 attr->ia_valid &= ~(ATTR_MTIME|ATTR_ATIME); 748 755 } 749 756 spin_unlock(&inode->i_lock);