Skip to content

Commit ae0e5df

Browse files
committed
btrfs: reorder btrfs_bio for better packing
After changes in commit 917f32a ("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: 917f32a ("btrfs: give struct btrfs_bio a real end_io handler") Signed-off-by: David Sterba <[email protected]>
1 parent ab4c54c commit ae0e5df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/volumes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ typedef void (*btrfs_bio_end_io_t)(struct btrfs_bio *bbio);
395395
*/
396396
struct btrfs_bio {
397397
unsigned int mirror_num;
398+
struct bvec_iter iter;
398399

399400
/* for direct I/O */
400401
u64 file_offset;
@@ -403,7 +404,6 @@ struct btrfs_bio {
403404
struct btrfs_device *device;
404405
u8 *csum;
405406
u8 csum_inline[BTRFS_BIO_INLINE_CSUM_SIZE];
406-
struct bvec_iter iter;
407407

408408
/* End I/O information supplied to btrfs_bio_alloc */
409409
btrfs_bio_end_io_t end_io;

0 commit comments

Comments
 (0)