diff mbox

[OPW,kernel,v2] fs:btrfs:Pack struct btrfs_device

Message ID 20131022132858.GA5613@dshgna
State New, archived
Headers show

Commit Message

Dulshani Gunawardhana Oct. 22, 2013, 1:29 p.m. UTC
Pack the structure btrfs_device in volumes.h to eliminate holes detected
by pahole, thus reducing binary memory footprint.

Signed-off-by: Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com>
---

This patch improves on the previous version by grouping the structure
elements in a more human-readable manner.
---
 fs/btrfs/volumes.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Rusty Russell Oct. 24, 2013, 2:28 a.m. UTC | #1
Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com> writes:
> Pack the structure btrfs_device in volumes.h to eliminate holes detected
> by pahole, thus reducing binary memory footprint.
>
> Signed-off-by: Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com>
> ---

Hi Dulshani,

        Much nicer!

Reviewed-by: Rusty Russell <rusty@rustcorp.com.au>

Cheers,
Rusty.

> This patch improves on the previous version by grouping the structure
> elements in a more human-readable manner.
> ---
>  fs/btrfs/volumes.h | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
> index b72f540..8d939ea 100644
> --- a/fs/btrfs/volumes.h
> +++ b/fs/btrfs/volumes.h
> @@ -43,9 +43,8 @@ struct btrfs_device {
>  	/* WRITE_SYNC bios */
>  	struct btrfs_pending_bios pending_sync_bios;
>  
> -	int running_pending;
>  	u64 generation;
> -
> +	int running_pending;
>  	int writeable;
>  	int in_fs_metadata;
>  	int missing;
> @@ -53,11 +52,11 @@ struct btrfs_device {
>  	int is_tgtdev_for_dev_replace;
>  
>  	spinlock_t io_lock;
> +	/* the mode sent to blkdev_get */
> +	fmode_t mode;
>  
>  	struct block_device *bdev;
>  
> -	/* the mode sent to blkdev_get */
> -	fmode_t mode;
>  
>  	struct rcu_string *name;
>  
> @@ -78,16 +77,21 @@ struct btrfs_device {
>  
>  	/* optimal io width for this device */
>  	u32 io_width;
> +	/* type and info about this device */
> +	u64 type;
>  
>  	/* minimal io size for this device */
>  	u32 sector_size;
>  
> -	/* type and info about this device */
> -	u64 type;
>  
>  	/* physical drive uuid (or lvm uuid) */
>  	u8 uuid[BTRFS_UUID_SIZE];
>  
> +	/* for sending down flush barriers */
> +	int nobarriers;
> +	struct bio *flush_bio;
> +	struct completion flush_wait;
> +
>  	/* per-device scrub information */
>  	struct scrub_ctx *scrub_device;
>  
> @@ -103,10 +107,6 @@ struct btrfs_device {
>  	struct radix_tree_root reada_zones;
>  	struct radix_tree_root reada_extents;
>  
> -	/* for sending down flush barriers */
> -	struct bio *flush_bio;
> -	struct completion flush_wait;
> -	int nobarriers;
>  
>  	/* disk I/O failure stats. For detailed description refer to
>  	 * enum btrfs_dev_stat_values in ioctl.h */
> -- 
> 1.8.1.2
>
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
Zach Brown Oct. 29, 2013, 11:01 p.m. UTC | #2
On Thu, Oct 24, 2013 at 12:58:56PM +1030, Rusty Russell wrote:
> Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com> writes:
> > Pack the structure btrfs_device in volumes.h to eliminate holes detected
> > by pahole, thus reducing binary memory footprint.
> >
> > Signed-off-by: Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com>
> > ---
> 
> Hi Dulshani,
> 
>         Much nicer!

Agreed, very nicely done Dulshani.  Thanks for the good feedback on the
first pass, Rusty.

Add it to the pile of reviewed patches to send to the linux-btrfs list :)

Reviewed-by: Zach Brown <zab@redhat.com>

- z
diff mbox

Patch

diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index b72f540..8d939ea 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -43,9 +43,8 @@  struct btrfs_device {
 	/* WRITE_SYNC bios */
 	struct btrfs_pending_bios pending_sync_bios;
 
-	int running_pending;
 	u64 generation;
-
+	int running_pending;
 	int writeable;
 	int in_fs_metadata;
 	int missing;
@@ -53,11 +52,11 @@  struct btrfs_device {
 	int is_tgtdev_for_dev_replace;
 
 	spinlock_t io_lock;
+	/* the mode sent to blkdev_get */
+	fmode_t mode;
 
 	struct block_device *bdev;
 
-	/* the mode sent to blkdev_get */
-	fmode_t mode;
 
 	struct rcu_string *name;
 
@@ -78,16 +77,21 @@  struct btrfs_device {
 
 	/* optimal io width for this device */
 	u32 io_width;
+	/* type and info about this device */
+	u64 type;
 
 	/* minimal io size for this device */
 	u32 sector_size;
 
-	/* type and info about this device */
-	u64 type;
 
 	/* physical drive uuid (or lvm uuid) */
 	u8 uuid[BTRFS_UUID_SIZE];
 
+	/* for sending down flush barriers */
+	int nobarriers;
+	struct bio *flush_bio;
+	struct completion flush_wait;
+
 	/* per-device scrub information */
 	struct scrub_ctx *scrub_device;
 
@@ -103,10 +107,6 @@  struct btrfs_device {
 	struct radix_tree_root reada_zones;
 	struct radix_tree_root reada_extents;
 
-	/* for sending down flush barriers */
-	struct bio *flush_bio;
-	struct completion flush_wait;
-	int nobarriers;
 
 	/* disk I/O failure stats. For detailed description refer to
 	 * enum btrfs_dev_stat_values in ioctl.h */