Skip to content

Commit

Permalink
NFS: Convert cache_change_attribute into a jiffy-based value
Browse files Browse the repository at this point in the history
 Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Oct 28, 2005
1 parent 0e574af commit 913a70f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions fs/nfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
* We may need to keep the attributes marked as invalid if
* we raced with nfs_end_attr_update().
*/
if (verifier == nfsi->cache_change_attribute)
if (time_after_eq(verifier, nfsi->cache_change_attribute))
nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME);
spin_unlock(&inode->i_lock);

Expand Down Expand Up @@ -1202,7 +1202,7 @@ void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
if (S_ISDIR(inode->i_mode)) {
memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
/* This ensures we revalidate child dentries */
nfsi->cache_change_attribute++;
nfsi->cache_change_attribute = jiffies;
}
spin_unlock(&inode->i_lock);

Expand Down Expand Up @@ -1242,7 +1242,7 @@ void nfs_end_data_update(struct inode *inode)
nfsi->cache_validity |= NFS_INO_INVALID_DATA;
spin_unlock(&inode->i_lock);
}
nfsi->cache_change_attribute ++;
nfsi->cache_change_attribute = jiffies;
atomic_dec(&nfsi->data_updates);
}

Expand Down Expand Up @@ -1391,7 +1391,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign
/* Do we perhaps have any outstanding writes? */
if (nfsi->npages == 0) {
/* No, but did we race with nfs_end_data_update()? */
if (verifier == nfsi->cache_change_attribute) {
if (time_after_eq(verifier, nfsi->cache_change_attribute)) {
inode->i_size = new_isize;
invalid |= NFS_INO_INVALID_DATA;
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/nfs_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ static inline long nfs_save_change_attribute(struct inode *inode)
static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long chattr)
{
return !nfs_caches_unstable(inode)
&& chattr == NFS_I(inode)->cache_change_attribute;
&& time_after_eq(chattr, NFS_I(inode)->cache_change_attribute);
}

/*
Expand Down

0 comments on commit 913a70f

Please sign in to comment.