Commit 2f3e61cd authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] reduce size of struct dentry on 64bit

Reduce size of struct dentry from 248 to 232 bytes on 64bit.

- Reduce size of qstr by 8 bytes, placing int hash and int len together.
  We gain a further 4 byte saving when qstr is used in struct dentry
  since qstr goes from 24 to 16 bytes and the next member (d_lru)
  requires 8 byte alignment (which means 4 bytes of padding).

- Move d_mounted to the end, since char d_iname[] only requires 1 byte
  alignment. This reduces struct dentry by another 4 bytes.

With these changes the number of objects we can fit into a 4kB slab
goes from 16 to 17 on ppc64.

Note the above assumes the architecture naturally aligns types.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 486f80b9
...@@ -33,8 +33,8 @@ struct vfsmount; ...@@ -33,8 +33,8 @@ struct vfsmount;
*/ */
struct qstr { struct qstr {
unsigned int hash; unsigned int hash;
const unsigned char *name;
unsigned int len; unsigned int len;
const unsigned char *name;
}; };
struct dentry_stat_t { struct dentry_stat_t {
...@@ -101,11 +101,11 @@ struct dentry { ...@@ -101,11 +101,11 @@ struct dentry {
unsigned long d_time; /* used by d_revalidate */ unsigned long d_time; /* used by d_revalidate */
struct dentry_operations *d_op; struct dentry_operations *d_op;
struct super_block *d_sb; /* The root of the dentry tree */ struct super_block *d_sb; /* The root of the dentry tree */
int d_mounted;
void *d_fsdata; /* fs-specific data */ void *d_fsdata; /* fs-specific data */
struct rcu_head d_rcu; struct rcu_head d_rcu;
struct dcookie_struct *d_cookie; /* cookie, if any */ struct dcookie_struct *d_cookie; /* cookie, if any */
struct hlist_node d_hash; /* lookup hash list */ struct hlist_node d_hash; /* lookup hash list */
int d_mounted;
unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment