Commit 1c9f2c76 authored by Tejun Heo's avatar Tejun Heo Committed by Greg Kroah-Hartman

kernfs: Rearrange kernfs_node fields to reduce its size on 64bit

Moving .flags and .mode right below .hash makes kernfs_node smaller by 8
bytes on 64bit. To avoid creating a hole from 8 bytes alignment on 32bit
archs, .priv is moved below so that there are two 32bit pointers after the
64bit .id field.

v2: Updated to avoid size increase on 32bit noticed by Geert.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/ZZ7hwA18nfmFjYpj@slm.duckdns.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 41bccc98
...@@ -206,22 +206,22 @@ struct kernfs_node { ...@@ -206,22 +206,22 @@ struct kernfs_node {
const void *ns; /* namespace tag */ const void *ns; /* namespace tag */
unsigned int hash; /* ns + name hash */ unsigned int hash; /* ns + name hash */
unsigned short flags;
umode_t mode;
union { union {
struct kernfs_elem_dir dir; struct kernfs_elem_dir dir;
struct kernfs_elem_symlink symlink; struct kernfs_elem_symlink symlink;
struct kernfs_elem_attr attr; struct kernfs_elem_attr attr;
}; };
void *priv;
/* /*
* 64bit unique ID. On 64bit ino setups, id is the ino. On 32bit, * 64bit unique ID. On 64bit ino setups, id is the ino. On 32bit,
* the low 32bits are ino and upper generation. * the low 32bits are ino and upper generation.
*/ */
u64 id; u64 id;
unsigned short flags; void *priv;
umode_t mode;
struct kernfs_iattrs *iattr; struct kernfs_iattrs *iattr;
}; };
......
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