From: Jens Axboe <axboe@suse.de>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>,
achim_leubner@adaptec.com
Subject: Re: [PATCH] gdth buggy page mapping
Date: Tue, 23 Nov 2004 20:13:21 +0100 [thread overview]
Message-ID: <20041123191321.GL13174@suse.de> (raw)
In-Reply-To: <1101235504.2016.14.camel@mulgrave>
On Tue, Nov 23 2004, James Bottomley wrote:
> Actually, this:
>
> On Tue, 2004-11-23 at 12:06, Jens Axboe wrote:
> > @@ -2717,8 +2716,8 @@
> > if (scp->use_sg) {
> > sl = (struct scatterlist *)scp->request_buffer;
> > #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
> > - sgcnt = pci_map_sg(ha->pdev,sl,scp->use_sg,PCI_DMA_FROMDEVICE);
> > - for (i=0,cpsum=0; i<sgcnt; ++i,++sl) {
> > + for (i=0,cpsum=0; i<scp->use_sg; ++i,++sl) {
> > + unsigned long flags;
> > cpnow = (ushort)sg_dma_len(sl);
>
> Won't quite work any more. On most platforms, it will since
> sg_dma_len(sl) expands to sl->length which is the correct thing.
> However, on some, like parisc, x86_64, ppc64 it will expand to a
> different parameter which won't get filled in if the dma mapping is
Ah yes, I forgot that some have a different output length. I guess an
open coded ->length would work best then.
> never done. I think all use of the sg_dma_ macros in this driver will
> need modifying with this change.
How so? It's internal usage in that function, it needs a one-liner to
work.
===== drivers/scsi/gdth.c 1.44 vs edited =====
--- 1.44/drivers/scsi/gdth.c 2004-10-01 04:44:10 +02:00
+++ edited/drivers/scsi/gdth.c 2004-11-23 20:13:04 +01:00
@@ -2708,7 +2708,6 @@
ushort cpsum,cpnow;
struct scatterlist *sl;
gdth_ha_str *ha;
- int sgcnt;
char *address;
cpcount = count<=(ushort)scp->bufflen ? count:(ushort)scp->bufflen;
@@ -2717,9 +2716,9 @@
if (scp->use_sg) {
sl = (struct scatterlist *)scp->request_buffer;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,13)
- sgcnt = pci_map_sg(ha->pdev,sl,scp->use_sg,PCI_DMA_FROMDEVICE);
- for (i=0,cpsum=0; i<sgcnt; ++i,++sl) {
- cpnow = (ushort)sg_dma_len(sl);
+ for (i=0,cpsum=0; i<scp->use_sg; ++i,++sl) {
+ unsigned long flags;
+ cpnow = (ushort)sl->length;
TRACE(("copy_internal() now %d sum %d count %d %d\n",
cpnow,cpsum,cpcount,(ushort)scp->bufflen));
if (cpsum+cpnow > cpcount)
@@ -2730,17 +2729,18 @@
hanum);
return;
}
- address = (char *)(page_address(sl->page) + sl->offset);
+ local_irq_save(flags);
+ address = kmap_atomic(sl->page, KM_BIO_SRC_IRQ) + sl->offset;
memcpy(address,buffer,cpnow);
+ flush_dcache_page(sl->page);
+ kunmap_atomic(address, KM_BIO_SRC_IRQ);
+ local_irq_restore(flags);
if (cpsum == cpcount)
break;
buffer += cpnow;
}
- pci_unmap_sg(ha->pdev,scp->request_buffer,
- scp->use_sg,PCI_DMA_FROMDEVICE);
#else
- sgcnt = scp->use_sg;
- for (i=0,cpsum=0; i<sgcnt; ++i,++sl) {
+ for (i=0,cpsum=0; i<scp->use_sg; ++i,++sl) {
cpnow = (ushort)sl->length;
TRACE(("copy_internal() now %d sum %d count %d %d\n",
cpnow,cpsum,cpcount,(ushort)scp->bufflen));
--
Jens Axboe
next prev parent reply other threads:[~2004-11-23 19:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-23 18:06 [PATCH] gdth buggy page mapping Jens Axboe
2004-11-23 18:44 ` James Bottomley
2004-11-23 19:13 ` Jens Axboe [this message]
2004-11-23 19:19 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041123191321.GL13174@suse.de \
--to=axboe@suse.de \
--cc=James.Bottomley@SteelEye.com \
--cc=achim_leubner@adaptec.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.