Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Device-mapper Development (http://www.linux-archive.org/device-mapper-development/)
-   -   dm mpath: reduce size of multipath structure (http://www.linux-archive.org/device-mapper-development/664495-dm-mpath-reduce-size-multipath-structure.html)

Mike Snitzer 05-08-2012 09:56 PM

dm mpath: reduce size of multipath structure
 
Move multipath structure's 'lock' and 'queue_size' members to eliminate
2 4-byte holes. Also use a bit within a single unsigned int for each
existing flag (saves 8-bytes). This allows future flags to be added
without each consuming an unsigned int.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
drivers/md/dm-mpath.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 754f38f..c351607 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -61,11 +61,11 @@ struct multipath {
struct list_head list;
struct dm_target *ti;

- spinlock_t lock;
-
const char *hw_handler_name;
char *hw_handler_params;

+ spinlock_t lock;
+
unsigned nr_priority_groups;
struct list_head priority_groups;

@@ -81,16 +81,17 @@ struct multipath {
struct priority_group *next_pg; /* Switch to this PG if set */
unsigned repeat_count; /* I/Os left before calling PS again */

- unsigned queue_io; /* Must we queue all I/O? */
- unsigned queue_if_no_path; /* Queue I/O if last path fails? */
- unsigned saved_queue_if_no_path;/* Saved state during suspension */
+ unsigned queue_io:1; /* Must we queue all I/O? */
+ unsigned queue_if_no_path:1; /* Queue I/O if last path fails? */
+ unsigned saved_queue_if_no_path:1; /* Saved state during suspension */
+
unsigned pg_init_retries; /* Number of times to retry pg_init */
unsigned pg_init_count; /* Number of times pg_init called */
unsigned pg_init_delay_msecs; /* Number of msecs before pg_init retry */

+ unsigned queue_size;
struct work_struct process_queued_ios;
struct list_head queued_ios;
- unsigned queue_size;

struct work_struct trigger_event;

--
1.7.4.4

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Hannes Reinecke 05-09-2012 06:58 AM

dm mpath: reduce size of multipath structure
 
On 05/08/2012 11:56 PM, Mike Snitzer wrote:
> Move multipath structure's 'lock' and 'queue_size' members to eliminate
> 2 4-byte holes. Also use a bit within a single unsigned int for each
> existing flag (saves 8-bytes). This allows future flags to be added
> without each consuming an unsigned int.
>
> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> ---
> drivers/md/dm-mpath.c | 13 +++++++------
> 1 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
> index 754f38f..c351607 100644
> --- a/drivers/md/dm-mpath.c
> +++ b/drivers/md/dm-mpath.c
> @@ -61,11 +61,11 @@ struct multipath {
> struct list_head list;
> struct dm_target *ti;
>
> - spinlock_t lock;
> -
> const char *hw_handler_name;
> char *hw_handler_params;
>
> + spinlock_t lock;
> +
> unsigned nr_priority_groups;
> struct list_head priority_groups;
>
> @@ -81,16 +81,17 @@ struct multipath {
> struct priority_group *next_pg; /* Switch to this PG if set */
> unsigned repeat_count; /* I/Os left before calling PS again */
>
> - unsigned queue_io; /* Must we queue all I/O? */
> - unsigned queue_if_no_path; /* Queue I/O if last path fails? */
> - unsigned saved_queue_if_no_path;/* Saved state during suspension */
> + unsigned queue_io:1; /* Must we queue all I/O? */
> + unsigned queue_if_no_path:1; /* Queue I/O if last path fails? */
> + unsigned saved_queue_if_no_path:1; /* Saved state during suspension */
> +
> unsigned pg_init_retries; /* Number of times to retry pg_init */
> unsigned pg_init_count; /* Number of times pg_init called */
> unsigned pg_init_delay_msecs; /* Number of msecs before pg_init retry */
>
> + unsigned queue_size;
> struct work_struct process_queued_ios;
> struct list_head queued_ios;
> - unsigned queue_size;
>
> struct work_struct trigger_event;
>

Acked-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


All times are GMT. The time now is 01:24 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.