aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfs_fs.h
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2021-09-28 17:41:41 -0400
committerTrond Myklebust <trond.myklebust@hammerspace.com>2021-10-20 18:09:54 -0400
commite591b298d7ecb851e200f65946e3d53fe78a3c4f (patch)
tree1bc19ad91902aee46eeb108f68beb50c72fd31f2 /include/linux/nfs_fs.h
parentNFS: Fix WARN_ON due to unionization of nfs_inode.nrequests (diff)
downloadlinux-dev-e591b298d7ecb851e200f65946e3d53fe78a3c4f.tar.xz
linux-dev-e591b298d7ecb851e200f65946e3d53fe78a3c4f.zip
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>
Diffstat (limited to '')
-rw-r--r--include/linux/nfs_fs.h42
1 files changed, 24 insertions, 18 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 457b866a2d9e..739ca1ef934f 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -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 */