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>
master
David Sterba 2018-04-09 17:42:40 +02:00
parent 26c1dafbf6
commit 944974b485
1 changed files with 1 additions and 1 deletions

View File

@ -91,10 +91,10 @@ struct extent_buffer {
struct cache_extent cache_node;
u64 start;
u64 dev_bytenr;
u32 len;
struct extent_io_tree *tree;
struct list_head lru;
struct list_head recow;
u32 len;
int refs;
u32 flags;
int fd;