diff options
author | Eric Sandeen <sandeen@redhat.com> | 2009-07-13 10:24:17 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-07-13 10:24:17 -0400 |
commit | 726447d803802cd0be8f62d17c4a34421781b938 (patch) | |
tree | ef1d7d4b9afb0f81b9eb6f09980c152d35ceb3cf /fs/ext4/ext4.h | |
parent | 089ceecc1ea4a69ed8bcc5c7c7b96ce487e26b33 (diff) |
ext4: naturally align struct ext4_allocation_request
As Ted noted, the ext4_allocation_request isn't well aligned. Looking
at it with pahole we're wasting space on 64-bit arches:
struct ext4_allocation_request {
struct inode * inode; /* 0 8 */
ext4_lblk_t logical; /* 8 4 */
/* XXX 4 bytes hole, try to pack */
ext4_fsblk_t goal; /* 16 8 */
ext4_lblk_t lleft; /* 24 4 */
/* XXX 4 bytes hole, try to pack */
ext4_fsblk_t pleft; /* 32 8 */
ext4_lblk_t lright; /* 40 4 */
/* XXX 4 bytes hole, try to pack */
ext4_fsblk_t pright; /* 48 8 */
unsigned int len; /* 56 4 */
unsigned int flags; /* 60 4 */
/* --- cacheline 1 boundary (64 bytes) --- */
/* size: 64, cachelines: 1, members: 9 */
/* sum members: 52, holes: 3, sum holes: 12 */
};
Grouping 32-bit members together closes these holes and shrinks the
structure by 12 bytes. which is important since ext4 can get on the
hairy edge of stack overruns.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 0ddf7e55abe1..9714db393efe 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -93,20 +93,20 @@ typedef unsigned int ext4_group_t; | |||
93 | struct ext4_allocation_request { | 93 | struct ext4_allocation_request { |
94 | /* target inode for block we're allocating */ | 94 | /* target inode for block we're allocating */ |
95 | struct inode *inode; | 95 | struct inode *inode; |
96 | /* how many blocks we want to allocate */ | ||
97 | unsigned int len; | ||
96 | /* logical block in target inode */ | 98 | /* logical block in target inode */ |
97 | ext4_lblk_t logical; | 99 | ext4_lblk_t logical; |
98 | /* phys. target (a hint) */ | ||
99 | ext4_fsblk_t goal; | ||
100 | /* the closest logical allocated block to the left */ | 100 | /* the closest logical allocated block to the left */ |
101 | ext4_lblk_t lleft; | 101 | ext4_lblk_t lleft; |
102 | /* phys. block for ^^^ */ | ||
103 | ext4_fsblk_t pleft; | ||
104 | /* the closest logical allocated block to the right */ | 102 | /* the closest logical allocated block to the right */ |
105 | ext4_lblk_t lright; | 103 | ext4_lblk_t lright; |
106 | /* phys. block for ^^^ */ | 104 | /* phys. target (a hint) */ |
105 | ext4_fsblk_t goal; | ||
106 | /* phys. block for the closest logical allocated block to the left */ | ||
107 | ext4_fsblk_t pleft; | ||
108 | /* phys. block for the closest logical allocated block to the right */ | ||
107 | ext4_fsblk_t pright; | 109 | ext4_fsblk_t pright; |
108 | /* how many blocks we want to allocate */ | ||
109 | unsigned int len; | ||
110 | /* flags. see above EXT4_MB_HINT_* */ | 110 | /* flags. see above EXT4_MB_HINT_* */ |
111 | unsigned int flags; | 111 | unsigned int flags; |
112 | }; | 112 | }; |