• Filipe Manana's avatar
    btrfs: shrink the size of struct btrfs_delayed_item · 4c469798
    Filipe Manana authored
    Currently struct btrfs_delayed_item has a base size of 96 bytes, but its
    size can be decreased by doing the following 2 tweaks:
    
    1) Change data_len from u32 to u16. Our maximum possible leaf size is 64K,
       so the data_len can never be larger than that, and in fact it is always
       much smaller than that. The max length for a dentry's name is ensured
       at the VFS level (PATH_MAX, 4096 bytes) and in struct btrfs_inode_ref
       and btrfs_dir_item we use a u16 to store the name's length;
    
    2) Change 'ins_or_del' to a 1 bit enum, which is all we need since it
       can only have 2 values. After this there's also no longer the need to
       BUG_ON() before using 'ins_or_del' in several places. Also rename the
       field from 'ins_or_del' to 'type', which is more clear.
    
    These two tweaks decrease the size of struct btrfs_delayed_item from 96
    bytes down to 88 bytes. A previous patch already reduced the size of this
    structure by 16 bytes, but an upcoming change will increase its size by
    16 bytes (adding a struct list_head element).
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    4c469798
delayed-inode.h 4.76 KB