mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-29 01:51:39 +00:00
NFSv4.2: add client side xattr caching.
Implement client side caching for NFSv4.2 extended attributes. The cache is a per-inode hashtable, with name/value entries. There is one special entry for the listxattr cache. NFS inodes have a pointer to a cache structure. The cache structure is allocated on demand, freed when the cache is invalidated. Memory shrinkers keep the size in check. Large entries (> PAGE_SIZE) are collected by a separate shrinker, and freed more aggressively than others. Signed-off-by: Frank van der Linden <fllinden@amazon.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
parent
012a211abd
commit
95ad37f90c
9 changed files with 1179 additions and 8 deletions
|
@ -193,6 +193,7 @@ bool nfs_check_cache_invalid(struct inode *inode, unsigned long flags)
|
|||
|
||||
return nfs_check_cache_invalid_not_delegated(inode, flags);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nfs_check_cache_invalid);
|
||||
|
||||
static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
|
||||
{
|
||||
|
@ -234,11 +235,13 @@ static void nfs_zap_caches_locked(struct inode *inode)
|
|||
| NFS_INO_INVALID_DATA
|
||||
| NFS_INO_INVALID_ACCESS
|
||||
| NFS_INO_INVALID_ACL
|
||||
| NFS_INO_INVALID_XATTR
|
||||
| NFS_INO_REVAL_PAGECACHE);
|
||||
} else
|
||||
nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR
|
||||
| NFS_INO_INVALID_ACCESS
|
||||
| NFS_INO_INVALID_ACL
|
||||
| NFS_INO_INVALID_XATTR
|
||||
| NFS_INO_REVAL_PAGECACHE);
|
||||
nfs_zap_label_cache_locked(nfsi);
|
||||
}
|
||||
|
@ -1897,7 +1900,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
|
|||
if (!(have_writers || have_delegation)) {
|
||||
invalid |= NFS_INO_INVALID_DATA
|
||||
| NFS_INO_INVALID_ACCESS
|
||||
| NFS_INO_INVALID_ACL;
|
||||
| NFS_INO_INVALID_ACL
|
||||
| NFS_INO_INVALID_XATTR;
|
||||
/* Force revalidate of all attributes */
|
||||
save_cache_validity |= NFS_INO_INVALID_CTIME
|
||||
| NFS_INO_INVALID_MTIME
|
||||
|
@ -2100,6 +2104,9 @@ struct inode *nfs_alloc_inode(struct super_block *sb)
|
|||
#if IS_ENABLED(CONFIG_NFS_V4)
|
||||
nfsi->nfs4_acl = NULL;
|
||||
#endif /* CONFIG_NFS_V4 */
|
||||
#ifdef CONFIG_NFS_V4_2
|
||||
nfsi->xattr_cache = NULL;
|
||||
#endif
|
||||
return &nfsi->vfs_inode;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nfs_alloc_inode);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue