Support for cached lookups via readdirplus [2/6]
Subsystems (2)
PATCH 1/1 Support for cached lookups via readdirplus [2/6]
Cleanup for readdirplus. Allow the file attribute struct to set the NFS_READTIME(inode) to some value other than 'jiffies'.
Cheers,
Trond
fs/nfs/inode.c +7 -4
@@ -700,13 +700,13 @@ new_isize =nfs_size_to_loff_t (fattr->size); new_atime =nfs_time_to_secs (fattr->atime); -NFS_READTIME (inode) = jiffies; +NFS_READTIME (inode) = fattr->timestamp;NFS_CACHE_CTIME (inode) = fattr->ctime; inode->i_ctime =nfs_time_to_secs (fattr->ctime); inode->i_atime = new_atime;NFS_CACHE_MTIME (inode) = new_mtime; inode->i_mtime =nfs_time_to_secs (new_mtime); -NFS_MTIME_UPDATE (inode) = jiffies; +NFS_MTIME_UPDATE (inode) = fattr->timestamp;NFS_CACHE_ISIZE (inode) = new_size; inode->i_size = new_isize; inode->i_mode = fattr->mode;
@@ -1014,6 +1014,9 @@ goto out_err; } +/* Throw out obsolete READDIRPLUS attributes */ +if (time_before (fattr->timestamp,NFS_READTIME (inode))) +return 0 ;/* * Make sure the inode's type hasn't changed. */
@@ -1032,7 +1035,7 @@/* * Update the read time so we don't revalidate too often. */ -NFS_READTIME (inode) = jiffies; +NFS_READTIME (inode) = fattr->timestamp;/* * Note: NFS_CACHE_ISIZE(inode) reflects the state of the cache.
@@ -1082,7 +1085,7 @@if (NFS_CACHE_MTIME (inode) != new_mtime) {if (invalid) -NFS_MTIME_UPDATE (inode) = jiffies; +NFS_MTIME_UPDATE (inode) = fattr->timestamp;NFS_CACHE_MTIME (inode) = new_mtime; inode->i_mtime =nfs_time_to_secs (new_mtime); }
fs/nfs/nfs2xdr.c +1 -0
@@ -118,6 +118,7 @@ fattr->mode = (fattr->mode & ~S_IFMT ) |S_IFIFO ; fattr->rdev =0 ; } + fattr->timestamp = jiffies;return p; }
fs/nfs/nfs3xdr.c +1 -0
@@ -181,6 +181,7 @@/* Update the mode bits */ fattr->valid |= (NFS_ATTR_FATTR |NFS_ATTR_FATTR_V3 ); + fattr->timestamp = jiffies;return p; }
include/linux/nfs_xdr.h +1 -0
@@ -27,6 +27,7 @@__u64 atime;__u64 mtime;__u64 ctime; +unsigned long timestamp; };#define NFS_ATTR_WCC 0x0001/* pre-op WCC data */