ext4: naturally align struct ext4_allocation_request
commit726447d803802cd0be8f62d17c4a34421781b938
authorEric Sandeen <sandeen@redhat.com>
Mon, 13 Jul 2009 14:24:17 +0000 (13 10:24 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 13 Jul 2009 14:24:17 +0000 (13 10:24 -0400)
treeef1d7d4b9afb0f81b9eb6f09980c152d35ceb3cf
parent089ceecc1ea4a69ed8bcc5c7c7b96ce487e26b33
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>
fs/ext4/ext4.h