btrfs-progs: reorder extent buffer members for better packing
authorDavid Sterba <dsterba@suse.com>
Mon, 9 Apr 2018 15:42:40 +0000 (17:42 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 24 Apr 2018 11:00:12 +0000 (13:00 +0200)
commit944974b4854e3f274e1beaa8165765eb385d8558
tree45737fafea6bc0e5aa3529a53a047af77e7d454a
parent26c1dafbf60182610744bba427583c0fdd8d0327
btrfs-progs: reorder extent buffer members for better packing

Afther the fs_info was added, the size was over 128 bytes but we still
have 8 bytes of holes, so with minor reordering we get back to that size.

Before:

struct extent_buffer {
        struct cache_extent        cache_node;           /*     0    48 */
        u64                        start;                /*    48     8 */
        u64                        dev_bytenr;           /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        u32                        len;                  /*    64     4 */

        /* XXX 4 bytes hole, try to pack */

        struct extent_io_tree *    tree;                 /*    72     8 */
        struct list_head           lru;                  /*    80    16 */
        struct list_head           recow;                /*    96    16 */
        int                        refs;                 /*   112     4 */
        u32                        flags;                /*   116     4 */
        int                        fd;                   /*   120     4 */

        /* XXX 4 bytes hole, try to pack */

        /* --- cacheline 2 boundary (128 bytes) --- */
        struct btrfs_fs_info *     fs_info;              /*   128     8 */
        char                       data[0];              /*   136     0 */

        /* size: 136, cachelines: 3, members: 12 */
        /* sum members: 128, holes: 2, sum holes: 8 */
        /* last cacheline: 8 bytes */
};

After:

struct extent_buffer {
        struct cache_extent        cache_node;           /*     0    48 */
        u64                        start;                /*    48     8 */
        u64                        dev_bytenr;           /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        struct extent_io_tree *    tree;                 /*    64     8 */
        struct list_head           lru;                  /*    72    16 */
        struct list_head           recow;                /*    88    16 */
        u32                        len;                  /*   104     4 */
        int                        refs;                 /*   108     4 */
        u32                        flags;                /*   112     4 */
        int                        fd;                   /*   116     4 */
        struct btrfs_fs_info *     fs_info;              /*   120     8 */
        /* --- cacheline 2 boundary (128 bytes) --- */
        char                       data[0];              /*   128     0 */

        /* size: 128, cachelines: 2, members: 12 */
};

Signed-off-by: David Sterba <dsterba@suse.com>
extent_io.h