Re: [PATCH] 2.5.44-ac3, cciss, more scatter gather elements

From: Stephen Cameron (steve.cameron@hp.com)
Date: Wed Oct 30 2002 - 15:23:55 EST


I wrote:
[...]
> 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

--- lx2544ac5/drivers/block/cciss.c~sgc4 Wed Oct 30 14:09:56 2002
+++ lx2544ac5-root/drivers/block/cciss.c Wed Oct 30 14:09:56 2002
@@ -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);
 

.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Oct 31 2002 - 22:00:49 EST