All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] scsi_cmnd: Rearrange and shrink some elements
@ 2007-10-18 16:27 Matthew Wilcox
  2007-10-18 16:27 ` [PATCH 2/4] shuttle_usbat: Eliminate use of transfersize Matthew Wilcox
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Matthew Wilcox @ 2007-10-18 16:27 UTC (permalink / raw)
  To: linux-scsi; +Cc: Matthew Wilcox, Matthew Wilcox

 - rearrange the elements of the scsi_pointer
 - shrink and move the eh_eflags element
 - turn sc_data_direction into an unsigned char
 - move tag

By doing this, we reduce the size of scsi_cmnd from 376 to 352 bytes
on x86-64 and from 272 to 260 bytes on i386.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
---
 include/scsi/scsi_cmnd.h |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 8b8759c..b9c7846 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -13,22 +13,21 @@ struct Scsi_Host;
 struct scsi_device;
 
 struct scsi_data_buffer {
+	struct scatterlist* sglist;
 	unsigned length;
 	int resid;
 	unsigned short sg_count;
 	unsigned short alloc_sg_count;
-	struct scatterlist* sglist;
 };
 
 /* embedded in scsi_cmnd */
 struct scsi_pointer {
 	char *ptr;		/* data pointer */
-	int this_residual;	/* left in this buffer */
 	struct scatterlist *buffer;	/* which buffer */
+	dma_addr_t dma_handle;
+	int this_residual;	/* left in this buffer */
 	int buffers_residual;	/* how many buffers left */
 
-        dma_addr_t dma_handle;
-
 	volatile int Status;
 	volatile int Message;
 	volatile int have_data_in;
@@ -40,7 +39,6 @@ struct scsi_cmnd {
 	struct scsi_device *device;
 	struct list_head list;  /* scsi_cmnd participates in queue lists */
 	struct list_head eh_entry; /* entry for the host eh_cmd_q */
-	int eh_eflags;		/* Used by error handlr */
 
 	/*
 	 * A SCSI Command is assigned a nonzero serial_number before passed
@@ -64,7 +62,9 @@ struct scsi_cmnd {
 	int timeout_per_command;
 
 	unsigned char cmd_len;
-	enum dma_data_direction sc_data_direction;
+	unsigned char eh_eflags;		/* Used by error handler */
+	unsigned char sc_data_direction;	/* enum dma_data_direction */
+	unsigned char tag;			/* SCSI-II queued command tag */
 
 	/* These elements define the operation we are about to perform */
 #define MAX_COMMAND_SIZE	16
@@ -82,8 +82,7 @@ struct scsi_cmnd {
 				   reconnects.   Probably == sector
 				   size */
 
-	struct request *request;	/* The command we are
-				   	   working on */
+	struct request *request;	/* The command we are working on */
 
 #define SCSI_SENSE_BUFFERSIZE 	96
 	unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE];
@@ -111,8 +110,6 @@ struct scsi_cmnd {
 
 	int result;		/* Status code from lower level driver */
 
-	unsigned char tag;	/* SCSI-II queued command tag */
-
 	struct scsi_data_buffer sdb;
 };
 
-- 
1.4.4.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH 1/4] scsi_cmnd: Rearrange and shrink some elements
@ 2007-10-18  8:46 Matthew Wilcox
  2007-10-18  8:46 ` [PATCH 3/4] qla1280,qla2xxx: Remove display of transfersize Matthew Wilcox
  0 siblings, 1 reply; 10+ messages in thread
From: Matthew Wilcox @ 2007-10-18  8:46 UTC (permalink / raw)
  To: linux-scsi; +Cc: Matthew Wilcox, Matthew Wilcox

By
 - rearranging the elements of the scsi_pointer
 - shrinking and moving the eh_eflags element
 - turning sc_data_direction into an unsigned char
 - moving tag

we achieve a size reduction in scsi_cmnd of 376 to 352 bytes on x86-64
and from 272 to 260 bytes on i386.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
---
 include/scsi/scsi_cmnd.h |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 047ffe6..04fe0d8 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -13,22 +13,21 @@ struct Scsi_Host;
 struct scsi_device;
 
 struct scsi_data_buffer {
+	struct scatterlist* sglist;
 	unsigned length;
 	int resid;
 	unsigned short sg_count;
 	unsigned short alloc_sg_count;
-	struct scatterlist* sglist;
 };
 
 /* embedded in scsi_cmnd */
 struct scsi_pointer {
 	char *ptr;		/* data pointer */
-	int this_residual;	/* left in this buffer */
 	struct scatterlist *buffer;	/* which buffer */
+	dma_addr_t dma_handle;
+	int this_residual;	/* left in this buffer */
 	int buffers_residual;	/* how many buffers left */
 
-        dma_addr_t dma_handle;
-
 	volatile int Status;
 	volatile int Message;
 	volatile int have_data_in;
@@ -40,7 +39,6 @@ struct scsi_cmnd {
 	struct scsi_device *device;
 	struct list_head list;  /* scsi_cmnd participates in queue lists */
 	struct list_head eh_entry; /* entry for the host eh_cmd_q */
-	int eh_eflags;		/* Used by error handlr */
 
 	/*
 	 * A SCSI Command is assigned a nonzero serial_number before passed
@@ -64,7 +62,9 @@ struct scsi_cmnd {
 	int timeout_per_command;
 
 	unsigned char cmd_len;
-	enum dma_data_direction sc_data_direction;
+	unsigned char eh_eflags;		/* Used by error handler */
+	unsigned char sc_data_direction;	/* enum dma_data_direction */
+	unsigned char tag;			/* SCSI-II queued command tag */
 
 	/* These elements define the operation we are about to perform */
 #define MAX_COMMAND_SIZE	16
@@ -82,8 +82,7 @@ struct scsi_cmnd {
 				   reconnects.   Probably == sector
 				   size */
 
-	struct request *request;	/* The command we are
-				   	   working on */
+	struct request *request;	/* The command we are working on */
 
 #define SCSI_SENSE_BUFFERSIZE 	96
 	unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE];
@@ -111,8 +110,6 @@ struct scsi_cmnd {
 
 	int result;		/* Status code from lower level driver */
 
-	unsigned char tag;	/* SCSI-II queued command tag */
-
 	union {
 		struct scsi_data_buffer sdb;
 		/*
@@ -121,11 +118,11 @@ struct scsi_cmnd {
 		 *        of struct scsi_data_buffer members.
 		 */
 		struct {
+			void __deprecated *request_buffer;
 			unsigned __deprecated request_bufflen;
 			int __deprecated resid;
 			unsigned short __deprecated use_sg;
 			unsigned short __deprecated place_holder_sg_alloc;
-			void __deprecated *request_buffer;
 		};
 	};
 };
-- 
1.4.4.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-10-19 17:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-18 16:27 [PATCH 1/4] scsi_cmnd: Rearrange and shrink some elements Matthew Wilcox
2007-10-18 16:27 ` [PATCH 2/4] shuttle_usbat: Eliminate use of transfersize Matthew Wilcox
2007-10-18 16:27 ` [PATCH 3/4] qla1280,qla2xxx: Remove display " Matthew Wilcox
2007-10-18 18:57   ` Seokmann Ju
2007-10-18 20:10     ` Matthew Wilcox
2007-10-18 21:05       ` Seokmann Ju
2007-10-18 21:40         ` Matthew Wilcox
2007-10-18 16:27 ` [PATCH 4/4] Replace scmd->transfersize with scsi_transfer_size() Matthew Wilcox
2007-10-19 17:45   ` Stefan Richter
  -- strict thread matches above, loose matches on Subject: below --
2007-10-18  8:46 [PATCH 1/4] scsi_cmnd: Rearrange and shrink some elements Matthew Wilcox
2007-10-18  8:46 ` [PATCH 3/4] qla1280,qla2xxx: Remove display of transfersize Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.