• David Sterba's avatar
    btrfs: move extent_buffer::lock_owner to debug section · 150cce2d
    David Sterba authored
    The lock_owner is used for a rare corruption case and we haven't seen
    any reports in years. Move it to the debugging section of eb.  To close
    the holes also move log_index so the final layout looks like:
    
    struct extent_buffer {
            u64                        start;                /*     0     8 */
            long unsigned int          len;                  /*     8     8 */
            long unsigned int          bflags;               /*    16     8 */
            struct btrfs_fs_info *     fs_info;              /*    24     8 */
            spinlock_t                 refs_lock;            /*    32     4 */
            atomic_t                   refs;                 /*    36     4 */
            int                        read_mirror;          /*    40     4 */
            s8                         log_index;            /*    44     1 */
    
            /* XXX 3 bytes hole, try to pack */
    
            struct callback_head       callback_head __attribute__((__aligned__(8))); /*    48    16 */
            /* --- cacheline 1 boundary (64 bytes) --- */
            struct rw_semaphore        lock;                 /*    64    40 */
            struct page *              pages[16];            /*   104   128 */
    
            /* size: 232, cachelines: 4, members: 11 */
            /* sum members: 229, holes: 1, sum holes: 3 */
            /* forced alignments: 1, forced holes: 1, sum forced holes: 3 */
            /* last cacheline: 40 bytes */
    } __attribute__((__aligned__(8)));
    
    This saves 8 bytes in total and still keeps the lock on a separate cacheline.
    Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    150cce2d
locking.c 10.5 KB