diff mbox series

[v2,1/9] btrfs: reduce struct btrfs_fs_devices size relocate fsid_change

Message ID 7587a86c31528295d77a707f5c1d795eaec4fe06.1684928629.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs: metadata_uuid refactors part1 | expand

Commit Message

Anand Jain May 24, 2023, 12:02 p.m. UTC
Pack bool fsid_change and bool seeding with other bool declarations in the
struct btrfs_fs_devices, approximately 6 bytes is saved.

   before: 512 bytes
   after: 496 bytes

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v2: Removed added code comments in v1.

 fs/btrfs/volumes.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Sterba May 24, 2023, 8:05 p.m. UTC | #1
On Wed, May 24, 2023 at 08:02:35PM +0800, Anand Jain wrote:
> Pack bool fsid_change and bool seeding with other bool declarations in the
> struct btrfs_fs_devices, approximately 6 bytes is saved.
> 
>    before: 512 bytes
>    after: 496 bytes

I checked the difference on a release build and it's even better, 16
bytes, depends on the optional config features in some of the embedded
structures.

--- pre/btrfs.ko.pahole 2023-05-24 21:54:47.326166521 +0200
+++ post/btrfs.ko.pahole        2023-05-24 21:54:47.754166522 +0200
@@ -1700,49 +1700,39 @@ struct btrfs_free_space_op {
...
 
-       /* size: 344, cachelines: 6, members: 27 */
-       /* sum members: 328, holes: 3, sum holes: 16 */
-       /* last cacheline: 24 bytes */
+       /* size: 328, cachelines: 6, members: 27 */
+       /* last cacheline: 8 bytes */
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 5cbbee32748c..236ae696c984 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -281,7 +281,6 @@  enum btrfs_read_policy {
 struct btrfs_fs_devices {
 	u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */
 	u8 metadata_uuid[BTRFS_FSID_SIZE];
-	bool fsid_change;
 	struct list_head fs_list;
 
 	/*
@@ -337,7 +336,6 @@  struct btrfs_fs_devices {
 	struct list_head alloc_list;
 
 	struct list_head seed_list;
-	bool seeding;
 
 	int opened;
 
@@ -347,6 +345,8 @@  struct btrfs_fs_devices {
 	bool rotating;
 	/* Devices support TRIM/discard commands */
 	bool discardable;
+	bool fsid_change;
+	bool seeding;
 
 	struct btrfs_fs_info *fs_info;
 	/* sysfs kobjects */