Skip to content

Commit

Permalink
vfs: reorganize 'struct inode' layout a bit
Browse files Browse the repository at this point in the history
This tries to make the 'struct inode' accesses denser in the data cache
by moving a commonly accessed field (i_security) closer to other fields
that are accessed often.

It also makes 'i_state' just an 'unsigned int' rather than 'unsigned
long', since we only use a few bits of that field, and moves it next to
the existing 'i_flags' so that we potentially get better structure
layout (although depending on config options, i_flags may already have
packed in the same word as i_lock, so this improves packing only for the
case of spinlock debugging)

Out 'struct inode' is still way too big, and we should probably move
some other fields around too (the acl fields in particular) for better
data cache access density.  Other fields (like the inode hash) are
likely to be entirely irrelevant under most loads.

Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Jun 8, 2011
1 parent 95f4efb commit 13e12d1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,13 @@ struct inode {

spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
unsigned int i_flags;
unsigned int i_state;
#ifdef CONFIG_SECURITY
void *i_security;
#endif
struct mutex i_mutex;

unsigned long i_state;

unsigned long dirtied_when; /* jiffies of first dirtying */

struct hlist_node i_hash;
Expand Down Expand Up @@ -798,9 +802,6 @@ struct inode {
atomic_t i_readcount; /* struct files open RO */
#endif
atomic_t i_writecount;
#ifdef CONFIG_SECURITY
void *i_security;
#endif
#ifdef CONFIG_FS_POSIX_ACL
struct posix_acl *i_acl;
struct posix_acl *i_default_acl;
Expand Down

0 comments on commit 13e12d1

Please sign in to comment.