NFS: Save some space in the inode

Save some space in the nfs_inode by setting up an anonymous union with
the fields that are peculiar to a specific type of filesystem object.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
Trond Myklebust
2021-09-28 17:41:41 -04:00
parent 0ebeebcf59
commit e591b298d7
2 changed files with 42 additions and 26 deletions

View File

@@ -155,33 +155,39 @@ struct nfs_inode {
unsigned long attrtimeo_timestamp;
unsigned long attr_gencount;
/* "Generation counter" for the attribute cache. This is
* bumped whenever we update the metadata on the
* server.
*/
unsigned long cache_change_attribute;
struct rb_root access_cache;
struct list_head access_cache_entry_lru;
struct list_head access_cache_inode_lru;
/*
* This is the cookie verifier used for NFSv3 readdir
* operations
*/
__be32 cookieverf[NFS_DIR_VERIFIER_SIZE];
atomic_long_t nrequests;
struct nfs_mds_commit_info commit_info;
union {
/* Directory */
struct {
/* "Generation counter" for the attribute cache.
* This is bumped whenever we update the metadata
* on the server.
*/
unsigned long cache_change_attribute;
/*
* This is the cookie verifier used for NFSv3 readdir
* operations
*/
__be32 cookieverf[NFS_DIR_VERIFIER_SIZE];
/* Readers: in-flight sillydelete RPC calls */
/* Writers: rmdir */
struct rw_semaphore rmdir_sem;
};
/* Regular file */
struct {
atomic_long_t nrequests;
struct nfs_mds_commit_info commit_info;
struct mutex commit_mutex;
};
};
/* Open contexts for shared mmap writes */
struct list_head open_files;
/* Readers: in-flight sillydelete RPC calls */
/* Writers: rmdir */
struct rw_semaphore rmdir_sem;
struct mutex commit_mutex;
#if IS_ENABLED(CONFIG_NFS_V4)
struct nfs4_cached_acl *nfs4_acl;
/* NFSv4 state */