]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: reorder btrfs_bio for better packing
authorDavid Sterba <dsterba@suse.com>
Tue, 11 Oct 2022 10:02:31 +0000 (12:02 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 24 Oct 2022 13:27:34 +0000 (15:27 +0200)
commitae0e5df4d1a4a2694c9c203cc25334aaaf9f2dfa
treeb0a611ed4f9c83eb65eda96da6f60d35304b9a06
parentab4c54c643a01067669df8332b64e3f31b69e071
btrfs: reorder btrfs_bio for better packing

After changes in commit 917f32a23501 ("btrfs: give struct btrfs_bio a
real end_io handler") the layout of btrfs_bio can be improved.  There
are two holes and the structure size is 264 bytes on release build. By
reordering the iterator we can get rid of the holes and the size is 256
bytes which fits to slabs much better.

Final layout:

struct btrfs_bio {
unsigned int               mirror_num;           /*     0     4 */
struct bvec_iter           iter;                 /*     4    20 */
u64                        file_offset;          /*    24     8 */
struct btrfs_device *      device;               /*    32     8 */
u8 *                       csum;                 /*    40     8 */
u8                         csum_inline[64];      /*    48    64 */
/* --- cacheline 1 boundary (64 bytes) was 48 bytes ago --- */
btrfs_bio_end_io_t         end_io;               /*   112     8 */
void *                     private;              /*   120     8 */
/* --- cacheline 2 boundary (128 bytes) --- */
struct work_struct         end_io_work;          /*   128    32 */
struct bio                 bio;                  /*   160    96 */

/* size: 256, cachelines: 4, members: 10 */
};

Fixes: 917f32a23501 ("btrfs: give struct btrfs_bio a real end_io handler")
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.h