Skip to content
  • David Sterba's avatar
    btrfs: switch extent_state state to unsigned · 9ee49a04
    David Sterba authored
    
    
    Currently there's a 4B hole in the structure between refs and state and there
    are only 16 bits used so we can make it unsigned. This will get a better
    packing and may save some stack space for local variables.
    
    The size of extent_state gets reduced by 8B and there are usually a lot
    of slab objects.
    
    struct extent_state {
    	u64                        start;                /*     0     8 */
    	u64                        end;                  /*     8     8 */
    	struct rb_node             rb_node;              /*    16    24 */
    	wait_queue_head_t          wq;                   /*    40    24 */
    	/* --- cacheline 1 boundary (64 bytes) --- */
    	atomic_t                   refs;                 /*    64     4 */
    
    	/* XXX 4 bytes hole, try to pack */
    
    	long unsigned int          state;                /*    72     8 */
    	u64                        private;              /*    80     8 */
    
    	/* size: 88, cachelines: 2, members: 7 */
    	/* sum members: 84, holes: 1, sum holes: 4 */
    	/* last cacheline: 24 bytes */
    };
    
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.cz>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    9ee49a04