login
Header Space

 
 

Re: [PATCH] Chaining sg lists for big IO commands v5

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Badari Pulavarty <pbadari@...>
Cc: lkml <linux-kernel@...>, <bhalevy@...>, Andrew Morton <akpm@...>, <fujita.tomonori@...>, <michaelc@...>
Date: Thursday, May 24, 2007 - 8:05 am

On Thu, May 24 2007, Jens Axboe wrote:

Does this help?

diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 10251bf..5510b86 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -155,6 +155,8 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,
 	uint32_t	*cur_dsd;
 	scsi_qla_host_t	*ha;
 	struct scsi_cmnd *cmd;
+	struct scatterlist *sg;
+	int i;
 
 	cmd = sp->cmd;
 
@@ -178,13 +180,10 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,
 
 	/* Load data segments */
 	if (cmd->use_sg != 0) {
-		struct	scatterlist *cur_seg;
-		struct	scatterlist *end_seg;
-
-		cur_seg = (struct scatterlist *)cmd->request_buffer;
-		end_seg = cur_seg + tot_dsds;
-		while (cur_seg < end_seg) {
-			cont_entry_t	*cont_pkt;
+		struct scatterlist *sgl = cmd->request_buffer;
+	
+		for_each_sg(sgl, sg, tot_dsds, i) {
+			cont_entry_t *cont_pkt;
 
 			/* Allocate additional continuation packets? */
 			if (avail_dsds == 0) {
@@ -197,11 +196,9 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,
 				avail_dsds = 7;
 			}
 
-			*cur_dsd++ = cpu_to_le32(sg_dma_address(cur_seg));
-			*cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg));
+			*cur_dsd++ = cpu_to_le32(sg_dma_address(sg));
+			*cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
 			avail_dsds--;
-
-			cur_seg++;
 		}
 	} else {
 		*cur_dsd++ = cpu_to_le32(sp->dma_handle);
@@ -224,6 +221,9 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
 	uint32_t	*cur_dsd;
 	scsi_qla_host_t	*ha;
 	struct scsi_cmnd *cmd;
+	struct scatterlist *sgl;
+	struct scatterlist *sg;
+	int i;
 
 	cmd = sp->cmd;
 
@@ -247,12 +247,8 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
 
 	/* Load data segments */
 	if (cmd->use_sg != 0) {
-		struct	scatterlist *cur_seg;
-		struct	scatterlist *end_seg;
-
-		cur_seg = (struct scatterlist *)cmd->request_buffer;
-		end_seg = cur_seg + tot_dsds;
-		while (cur_seg < end_seg) {
+		sgl = cmd->request_buffer;
+		for_each_sg(sgl, sg, tot_dsds, i) {
 			dma_addr_t	sle_dma;
 			cont_a64_entry_t *cont_pkt;
 
@@ -267,13 +263,11 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
 				avail_dsds = 5;
 			}
 
-			sle_dma = sg_dma_address(cur_seg);
+			sle_dma = sg_dma_address(sg);
 			*cur_dsd++ = cpu_to_le32(LSD(sle_dma));
 			*cur_dsd++ = cpu_to_le32(MSD(sle_dma));
-			*cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg));
+			*cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
 			avail_dsds--;
-
-			cur_seg++;
 		}
 	} else {
 		*cur_dsd++ = cpu_to_le32(LSD(sp->dma_handle));
@@ -642,6 +636,8 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
 	uint32_t	*cur_dsd;
 	scsi_qla_host_t	*ha;
 	struct scsi_cmnd *cmd;
+	struct scatterlist *sg, *sgl;
+	int i;
 
 	cmd = sp->cmd;
 
@@ -671,11 +667,8 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
 
 	/* Load data segments */
 	if (cmd->use_sg != 0) {
-		struct	scatterlist *sgl = cmd->request_buffer;
-		struct	scatterlist *cur_seg;
-		int i;
-
-		for_each_sg(sgl, cur_seg, tot_dsds, i) {
+		sgl = cmd->request_buffer;
+		for_each_sg(sgl, sg, tot_dsds, i) {
 			dma_addr_t	sle_dma;
 			cont_a64_entry_t *cont_pkt;
 
@@ -690,10 +683,10 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
 				avail_dsds = 5;
 			}
 
-			sle_dma = sg_dma_address(cur_seg);
+			sle_dma = sg_dma_address(sg);
 			*cur_dsd++ = cpu_to_le32(LSD(sle_dma));
 			*cur_dsd++ = cpu_to_le32(MSD(sle_dma));
-			*cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg));
+			*cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
 			avail_dsds--;
 		}
 	} else {

-- 
Jens Axboe

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Fri May 11, 9:51 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Tue May 15, 1:15 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Tue May 15, 1:20 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Tue May 15, 1:43 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Tue May 15, 1:50 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Tue May 15, 2:23 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Wed May 16, 5:01 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 17, 2:27 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Thu May 17, 11:15 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Fri May 18, 3:35 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Fri May 18, 1:51 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Mon May 21, 2:14 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Mon May 21, 2:35 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Benny Halevy, (Mon May 21, 3:14 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Tue May 22, 6:15 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 5:34 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 8:05 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Thu May 24, 11:25 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Fri May 25, 2:49 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, FUJITA Tomonori, (Thu May 24, 5:43 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 6:00 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 8:05 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, FUJITA Tomonori, (Thu May 24, 8:44 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, James Bottomley, (Thu May 24, 11:39 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, FUJITA Tomonori, (Thu May 24, 12:01 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, James Bottomley, (Thu May 24, 12:08 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Thu May 24, 8:49 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Tue May 22, 11:35 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Thu May 17, 11:11 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Fri May 18, 3:33 am)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Fri May 18, 12:03 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Jens Axboe, (Fri May 18, 1:03 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Fri May 18, 1:50 pm)
Re: [PATCH] Chaining sg lists for big IO commands v5, Badari Pulavarty, (Wed May 16, 4:58 pm)
speck-geostationary