diff mbox series

[08/10] btrfs: reduce size and reorder compression members in struct btrfs_inode

Message ID 9c8300f8034d596a60307972b54390364fca1c73.1694126893.git.dsterba@suse.com (mailing list archive)
State New, archived
Headers show
Series Cleanups and struct packing | expand

Commit Message

David Sterba Sept. 7, 2023, 11:09 p.m. UTC
Currently the compression type values are bounded and fit to an u8, we
can pack the btrfs_inode a bit by reordering them to the space created
by the location key. This reduces size from 1112 to 1104.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/btrfs_inode.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Qu Wenruo Sept. 8, 2023, 12:02 a.m. UTC | #1
On 2023/9/8 07:09, David Sterba wrote:
> Currently the compression type values are bounded and fit to an u8, we
> can pack the btrfs_inode a bit by reordering them to the space created
> by the location key. This reduces size from 1112 to 1104.
>
> Signed-off-by: David Sterba <dsterba@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   fs/btrfs/btrfs_inode.h | 20 ++++++++++----------
>   1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
> index b675dc09845d..2e1c0f68d704 100644
> --- a/fs/btrfs/btrfs_inode.h
> +++ b/fs/btrfs/btrfs_inode.h
> @@ -81,6 +81,16 @@ struct btrfs_inode {
>   	 */
>   	struct btrfs_key location;
>
> +	/*
> +	 * Cached values of inode properties
> +	 */
> +	u8 prop_compress;		/* per-file compression algorithm */
> +	/*
> +	 * Force compression on the file using the defrag ioctl, could be
> +	 * different from prop_compress and takes precedence if set
> +	 */
> +	u8 defrag_compress;
> +
>   	/*
>   	 * Lock for counters and all fields used to determine if the inode is in
>   	 * the log or not (last_trans, last_sub_trans, last_log_commit,
> @@ -235,16 +245,6 @@ struct btrfs_inode {
>
>   	struct btrfs_block_rsv block_rsv;
>
> -	/*
> -	 * Cached values of inode properties
> -	 */
> -	unsigned prop_compress;		/* per-file compression algorithm */
> -	/*
> -	 * Force compression on the file using the defrag ioctl, could be
> -	 * different from prop_compress and takes precedence if set
> -	 */
> -	unsigned defrag_compress;
> -
>   	struct btrfs_delayed_node *delayed_node;
>
>   	/* File creation time. */
diff mbox series

Patch

diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index b675dc09845d..2e1c0f68d704 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -81,6 +81,16 @@  struct btrfs_inode {
 	 */
 	struct btrfs_key location;
 
+	/*
+	 * Cached values of inode properties
+	 */
+	u8 prop_compress;		/* per-file compression algorithm */
+	/*
+	 * Force compression on the file using the defrag ioctl, could be
+	 * different from prop_compress and takes precedence if set
+	 */
+	u8 defrag_compress;
+
 	/*
 	 * Lock for counters and all fields used to determine if the inode is in
 	 * the log or not (last_trans, last_sub_trans, last_log_commit,
@@ -235,16 +245,6 @@  struct btrfs_inode {
 
 	struct btrfs_block_rsv block_rsv;
 
-	/*
-	 * Cached values of inode properties
-	 */
-	unsigned prop_compress;		/* per-file compression algorithm */
-	/*
-	 * Force compression on the file using the defrag ioctl, could be
-	 * different from prop_compress and takes precedence if set
-	 */
-	unsigned defrag_compress;
-
 	struct btrfs_delayed_node *delayed_node;
 
 	/* File creation time. */