Skip to contentSkip to conversation

2.5.44-ac3, cciss, more scatter gather elements

PATCH Stephen Cameron 1 participant 1 message Oct 30, 2002 Block layer

lore
Share & tools
lore
#0 lore raw

I wrote:
[...]

Quoted 2 lines

Anyway, here is a new cciss patch to work with your ll_rw_blk.c patch to use more than 31 scatter gather entries.

And that patch was missing something important. It didn't unmap all the addresses correctly. That's what I get for sitting on a patch since 2.5.7, I guess. Here's a patch to fix that.

-- steve

 drivers/block/cciss.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions, 4 deletions
drivers/block/cciss.c renamed from drivers/block/cciss.c~sgc4 +16 -4
@@ -1719,6 +1719,8 @@ static inline void complete_command( ctl
 	int i;
 	int retry_cmd = 0;
 	u64bit temp64;
+	int sgpage, sgelem;
+	SGDescriptor_struct *sgd;
 		
 	if (timeout)
 		status = 0; 
@@ -1830,13 +1832,23 @@ static inline void complete_command( ctl
 	}	
 	/* command did not need to be retried */
 	/* unmap the DMA mapping for all the scatter gather elements */
-	for(i=0; i<cmd->Header.SGList; i++) {
-		temp64.val32.lower = cmd->SG[i].Addr.lower;
-		temp64.val32.upper = cmd->SG[i].Addr.upper;
+	sgpage = 0;
+	sgelem = 0;
+	for(i=0; i<cmd->Header.SGTotal; i++) {
+		sgd = &cmd->sgdlist[sgpage].sgd[sgelem];
+		if (sgelem == MAXSGENTRIES-1 && sgd->Ext) {
+			i++;
+			sgpage++;
+			sgelem=0;
+			sgd = &cmd->sgdlist[sgpage].sgd[sgelem];
+		}
+		temp64.val32.lower = sgd->Addr.lower;
+		temp64.val32.upper = sgd->Addr.upper;
 		pci_unmap_page(hba[cmd->ctlr]->pdev,
-			temp64.val, cmd->SG[i].Len,
+			temp64.val, sgd->Len,
 			(cmd->Request.Type.Direction == XFER_READ) ?
 				PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE);
+		sgelem++;
 	}
 	complete_buffers(cmd->rq->bio, status);
 

.