From ab2257e9941b9ef28d4a4a451e4b146d40a21e18 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Mon, 1 Oct 2018 10:07:05 +0200 Subject: fuse: reduce size of struct fuse_inode Do this by grouping fields used for cached writes and putting them into a union with fileds used for cached readdir (with obviously no overlap, since we don't have hybrid objects). Signed-off-by: Miklos Szeredi --- fs/fuse/fuse_i.h | 62 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 28 deletions(-) (limited to 'fs/fuse/fuse_i.h') diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index d9d1ea78efa6..f5bdce84e766 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -87,45 +87,51 @@ struct fuse_inode { /** Version of last attribute change */ u64 attr_version; - /** Files usable in writepage. Protected by fc->lock */ - struct list_head write_files; + union { + /* Write related fields (regular file only) */ + struct { + /* Files usable in writepage. Protected by fc->lock */ + struct list_head write_files; - /** Writepages pending on truncate or fsync */ - struct list_head queued_writes; + /* Writepages pending on truncate or fsync */ + struct list_head queued_writes; - /** Number of sent writes, a negative bias (FUSE_NOWRITE) - * means more writes are blocked */ - int writectr; + /* Number of sent writes, a negative bias + * (FUSE_NOWRITE) means more writes are blocked */ + int writectr; - /** Waitq for writepage completion */ - wait_queue_head_t page_waitq; + /* Waitq for writepage completion */ + wait_queue_head_t page_waitq; - /** List of writepage requestst (pending or sent) */ - struct list_head writepages; + /* List of writepage requestst (pending or sent) */ + struct list_head writepages; + }; - /* readdir cache */ - struct { - /* true if fully cached */ - bool cached; + /* readdir cache (directory only) */ + struct { + /* true if fully cached */ + bool cached; - /* size of cache */ - loff_t size; + /* size of cache */ + loff_t size; - /* position at end of cache (position of next entry) */ - loff_t pos; + /* position at end of cache (position of next entry) */ + loff_t pos; - /* version of the cache */ - u64 version; + /* version of the cache */ + u64 version; - /* modification time of directory when cache was started */ - struct timespec64 mtime; + /* modification time of directory when cache was + * started */ + struct timespec64 mtime; - /* iversion of directory when cache was started */ - u64 iversion; + /* iversion of directory when cache was started */ + u64 iversion; - /* protects above fields */ - spinlock_t lock; - } rdc; + /* protects above fields */ + spinlock_t lock; + } rdc; + }; /** Miscellaneous bits describing inode state */ unsigned long state; -- cgit v1.2.1