aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-10-29 08:24:18 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-10-29 08:24:18 -0400
commit6cdbb0effc2f511ced23e46f2117e4b31d3d4a50 (patch)
treea440c35498abfd171b619a398f1cee1b62be8219 /include/linux
parent80e675f906db54eb1ce3a9555cee5f45b5b72ab2 (diff)
fs: optimize out 16 bytes worth of padding in struct inode
Rearrange the fields in struct inode so that on an x86_64 system, fields that require 8-byte alignment don't end up causing 4-byte holes in the structure. It reduces the size of struct inode from 568 bytes to 552 bytes. Also move the fields protected by i_lock (i_blocks, i_bytes, and i_size) into the same cache line as i_lock. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/fs.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 178cdb4f1d4a..fbda9a662f57 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -771,12 +771,13 @@ struct inode {
771 unsigned long i_ino; 771 unsigned long i_ino;
772 unsigned int i_nlink; 772 unsigned int i_nlink;
773 dev_t i_rdev; 773 dev_t i_rdev;
774 loff_t i_size;
775 struct timespec i_atime; 774 struct timespec i_atime;
776 struct timespec i_mtime; 775 struct timespec i_mtime;
777 struct timespec i_ctime; 776 struct timespec i_ctime;
778 unsigned int i_blkbits; 777 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
778 unsigned short i_bytes;
779 blkcnt_t i_blocks; 779 blkcnt_t i_blocks;
780 loff_t i_size;
780 781
781#ifdef __NEED_I_SIZE_ORDERED 782#ifdef __NEED_I_SIZE_ORDERED
782 seqcount_t i_size_seqcount; 783 seqcount_t i_size_seqcount;
@@ -784,7 +785,6 @@ struct inode {
784 785
785 /* Misc */ 786 /* Misc */
786 unsigned long i_state; 787 unsigned long i_state;
787 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
788 struct mutex i_mutex; 788 struct mutex i_mutex;
789 789
790 unsigned long dirtied_when; /* jiffies of first dirtying */ 790 unsigned long dirtied_when; /* jiffies of first dirtying */
@@ -798,9 +798,10 @@ struct inode {
798 struct rcu_head i_rcu; 798 struct rcu_head i_rcu;
799 }; 799 };
800 atomic_t i_count; 800 atomic_t i_count;
801 unsigned int i_blkbits;
801 u64 i_version; 802 u64 i_version;
802 unsigned short i_bytes;
803 atomic_t i_dio_count; 803 atomic_t i_dio_count;
804 atomic_t i_writecount;
804 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 805 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
805 struct file_lock *i_flock; 806 struct file_lock *i_flock;
806 struct address_space i_data; 807 struct address_space i_data;
@@ -824,7 +825,6 @@ struct inode {
824#ifdef CONFIG_IMA 825#ifdef CONFIG_IMA
825 atomic_t i_readcount; /* struct files open RO */ 826 atomic_t i_readcount; /* struct files open RO */
826#endif 827#endif
827 atomic_t i_writecount;
828 void *i_private; /* fs or device private pointer */ 828 void *i_private; /* fs or device private pointer */
829}; 829};
830 830