[PATCH 5/5] ext4: pack holes in ext4_inode_info

libaokun@huaweicloud.com posted 5 patches 1 year, 1 month ago
There is a newer version of this series
[PATCH 5/5] ext4: pack holes in ext4_inode_info
Posted by libaokun@huaweicloud.com 1 year, 1 month ago
From: Baokun Li <libaokun1@huawei.com>

When CONFIG_DEBUG_SPINLOCK is not enabled (general case), there are four
4 bytes holes and one 2 bytes hole in struct ext4_inode_info. Move the
members to pack the four 4 bytes holes.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
 fs/ext4/ext4.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 203a900fd789..345dda2310d0 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1060,6 +1060,8 @@ struct ext4_inode_info {
 	/* Number of ongoing updates on this inode */
 	atomic_t  i_fc_updates;
 
+	spinlock_t i_raw_lock;	/* protects updates to the raw inode */
+
 	/* Fast commit wait queue for this inode */
 	wait_queue_head_t i_fc_wait;
 
@@ -1097,8 +1099,6 @@ struct ext4_inode_info {
 	struct inode vfs_inode;
 	struct jbd2_inode *jinode;
 
-	spinlock_t i_raw_lock;	/* protects updates to the raw inode */
-
 	/*
 	 * File creation time. Its function is same as that of
 	 * struct timespec64 i_{a,c,m}time in the generic inode.
@@ -1141,6 +1141,7 @@ struct ext4_inode_info {
 	/* quota space reservation, managed internally by quota code */
 	qsize_t i_reserved_quota;
 #endif
+	spinlock_t i_block_reservation_lock;
 
 	/* Lock protecting lists below */
 	spinlock_t i_completed_io_lock;
@@ -1151,8 +1152,6 @@ struct ext4_inode_info {
 	struct list_head i_rsv_conversion_list;
 	struct work_struct i_rsv_conversion_work;
 
-	spinlock_t i_block_reservation_lock;
-
 	/*
 	 * Transactions that contain inode's metadata needed to complete
 	 * fsync and fdatasync, respectively.
-- 
2.46.1
Re: [PATCH 5/5] ext4: pack holes in ext4_inode_info
Posted by Jan Kara 1 year, 1 month ago
On Fri 20-12-24 14:07:57, libaokun@huaweicloud.com wrote:
> From: Baokun Li <libaokun1@huawei.com>
> 
> When CONFIG_DEBUG_SPINLOCK is not enabled (general case), there are four
> 4 bytes holes and one 2 bytes hole in struct ext4_inode_info. Move the
> members to pack the four 4 bytes holes.
> 
> Signed-off-by: Baokun Li <libaokun1@huawei.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/ext4.h | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 203a900fd789..345dda2310d0 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -1060,6 +1060,8 @@ struct ext4_inode_info {
>  	/* Number of ongoing updates on this inode */
>  	atomic_t  i_fc_updates;
>  
> +	spinlock_t i_raw_lock;	/* protects updates to the raw inode */
> +
>  	/* Fast commit wait queue for this inode */
>  	wait_queue_head_t i_fc_wait;
>  
> @@ -1097,8 +1099,6 @@ struct ext4_inode_info {
>  	struct inode vfs_inode;
>  	struct jbd2_inode *jinode;
>  
> -	spinlock_t i_raw_lock;	/* protects updates to the raw inode */
> -
>  	/*
>  	 * File creation time. Its function is same as that of
>  	 * struct timespec64 i_{a,c,m}time in the generic inode.
> @@ -1141,6 +1141,7 @@ struct ext4_inode_info {
>  	/* quota space reservation, managed internally by quota code */
>  	qsize_t i_reserved_quota;
>  #endif
> +	spinlock_t i_block_reservation_lock;
>  
>  	/* Lock protecting lists below */
>  	spinlock_t i_completed_io_lock;
> @@ -1151,8 +1152,6 @@ struct ext4_inode_info {
>  	struct list_head i_rsv_conversion_list;
>  	struct work_struct i_rsv_conversion_work;
>  
> -	spinlock_t i_block_reservation_lock;
> -
>  	/*
>  	 * Transactions that contain inode's metadata needed to complete
>  	 * fsync and fdatasync, respectively.
> -- 
> 2.46.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR