diff mbox series

[RFC,5/6] rnbd-clt: adjust the layout of struct rnbd_clt_dev

Message ID 20220620034923.35633-6-guoqing.jiang@linux.dev (mailing list archive)
State New, archived
Headers show
Series reduce the size of rnbd_clt_dev | expand

Commit Message

Guoqing Jiang June 20, 2022, 3:49 a.m. UTC
While at it, let re-arrange the struct to remove holes.

Before, pahole reports

	/* size: 232, cachelines: 4, members: 17 */
	/* sum members: 224, holes: 2, sum holes: 8 */
	/* last cacheline: 40 bytes */

After the change, the report changes to

	/* size: 224, cachelines: 4, members: 17 */
	/* last cacheline: 32 bytes */

Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
 drivers/block/rnbd/rnbd-clt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jinpu Wang June 22, 2022, 10:58 a.m. UTC | #1
On Mon, Jun 20, 2022 at 5:50 AM Guoqing Jiang <guoqing.jiang@linux.dev> wrote:
>
> While at it, let re-arrange the struct to remove holes.
>
> Before, pahole reports
>
>         /* size: 232, cachelines: 4, members: 17 */
>         /* sum members: 224, holes: 2, sum holes: 8 */
>         /* last cacheline: 40 bytes */
>
> After the change, the report changes to
>
>         /* size: 224, cachelines: 4, members: 17 */
>         /* last cacheline: 32 bytes */
>
> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
lgtm
Acked-by: Jack Wang <jinpu.wang@ionos.com>

> ---
>  drivers/block/rnbd/rnbd-clt.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/rnbd/rnbd-clt.h b/drivers/block/rnbd/rnbd-clt.h
> index 7520272541b1..df237d2ea0d9 100644
> --- a/drivers/block/rnbd/rnbd-clt.h
> +++ b/drivers/block/rnbd/rnbd-clt.h
> @@ -106,6 +106,7 @@ struct rnbd_queue {
>  };
>
>  struct rnbd_clt_dev {
> +       struct kobject          kobj;
>         struct rnbd_clt_session *sess;
>         struct request_queue    *queue;
>         struct rnbd_queue       *hw_queues;
> @@ -114,15 +115,14 @@ struct rnbd_clt_dev {
>         u32                     clt_device_id;
>         struct mutex            lock;
>         enum rnbd_clt_dev_state dev_state;
> +       refcount_t              refcount;
>         char                    *pathname;
>         enum rnbd_access_mode   access_mode;
>         u32                     nr_poll_queues;
>         u64                     size;           /* device size in bytes */
>         struct list_head        list;
>         struct gendisk          *gd;
> -       struct kobject          kobj;
>         char                    *blk_symlink_name;
> -       refcount_t              refcount;
>         struct work_struct      unmap_on_rmmod_work;
>  };
>
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/block/rnbd/rnbd-clt.h b/drivers/block/rnbd/rnbd-clt.h
index 7520272541b1..df237d2ea0d9 100644
--- a/drivers/block/rnbd/rnbd-clt.h
+++ b/drivers/block/rnbd/rnbd-clt.h
@@ -106,6 +106,7 @@  struct rnbd_queue {
 };
 
 struct rnbd_clt_dev {
+	struct kobject		kobj;
 	struct rnbd_clt_session	*sess;
 	struct request_queue	*queue;
 	struct rnbd_queue	*hw_queues;
@@ -114,15 +115,14 @@  struct rnbd_clt_dev {
 	u32			clt_device_id;
 	struct mutex		lock;
 	enum rnbd_clt_dev_state	dev_state;
+	refcount_t		refcount;
 	char			*pathname;
 	enum rnbd_access_mode	access_mode;
 	u32			nr_poll_queues;
 	u64			size;		/* device size in bytes */
 	struct list_head        list;
 	struct gendisk		*gd;
-	struct kobject		kobj;
 	char			*blk_symlink_name;
-	refcount_t		refcount;
 	struct work_struct	unmap_on_rmmod_work;
 };