Skip to content

Commit a3c3eec

Browse files
jc2870tytso
authored andcommitted
ext4: adjust the layout of the ext4_inode_info structure to save memory
Using pahole, we can see that there are some padding holes in the current ext4_inode_info structure. Adjusting the layout of ext4_inode_info can reduce these holes, resulting in the size of the structure decreasing from 2424 bytes to 2408 bytes. Signed-off-by: Junchao Sun <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 47ac09b commit a3c3eec

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/ext4/ext4.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,7 @@ struct ext4_inode_info {
10581058

10591059
/* Number of ongoing updates on this inode */
10601060
atomic_t i_fc_updates;
1061+
atomic_t i_unwritten; /* Nr. of inflight conversions pending */
10611062

10621063
/* Fast commit wait queue for this inode */
10631064
wait_queue_head_t i_fc_wait;
@@ -1106,6 +1107,10 @@ struct ext4_inode_info {
11061107

11071108
/* mballoc */
11081109
atomic_t i_prealloc_active;
1110+
1111+
/* allocation reservation info for delalloc */
1112+
/* In case of bigalloc, this refer to clusters rather than blocks */
1113+
unsigned int i_reserved_data_blocks;
11091114
struct rb_root i_prealloc_node;
11101115
rwlock_t i_prealloc_lock;
11111116

@@ -1122,10 +1127,6 @@ struct ext4_inode_info {
11221127
/* ialloc */
11231128
ext4_group_t i_last_alloc_group;
11241129

1125-
/* allocation reservation info for delalloc */
1126-
/* In case of bigalloc, this refer to clusters rather than blocks */
1127-
unsigned int i_reserved_data_blocks;
1128-
11291130
/* pending cluster reservations for bigalloc file systems */
11301131
struct ext4_pending_tree i_pending_tree;
11311132

@@ -1149,7 +1150,6 @@ struct ext4_inode_info {
11491150
*/
11501151
struct list_head i_rsv_conversion_list;
11511152
struct work_struct i_rsv_conversion_work;
1152-
atomic_t i_unwritten; /* Nr. of inflight conversions pending */
11531153

11541154
spinlock_t i_block_reservation_lock;
11551155

0 commit comments

Comments
 (0)