[PATCH] 2.4.x SATA with highmem

From: Willy Tarreau
Date: Sun Dec 04 2005 - 12:44:32 EST


Hi Jeff,

On Sun, Dec 04, 2005 at 04:59:11PM +0100, Willy Tarreau wrote:
> > >libata-core.c:2427: error: for each function it appears in.)
> > >libata-core.c: In function `ata_sg_setup':
> > >libata-core.c:2701: error: `KM_IRQ0' undeclared (first use in this
> > >function)
> > >make[2]: *** [libata-core.o] Error 1
> >
> > hmmm, interesting. Easy enough to fix. I guess I didn't build on a
> > highmem box.
>
> Same problem for me, but unfortunately, I don't know how to fix this. I've
> seen that KM_IRQ* are not defined on x86. I don't know if I can use other
> ones, not what would be the consequences. Would you please enlighten me a
> bit on this, I'm willing to test it but don't know how to build it first.

Well, after finding a good doc on kmap_atomic on lwn.net, I think I
understood how to fix this. I grepped the whole kernel for kmap_atomic()
and found that KM_BIO_IRQ was only used by ntfs, which had a comment
stating that it was used to support highmem. So I thought we could share
the same type and rediffed the patch, and now the kernel builds.

Here is my proposal, I hope it's correct.

Cheers,
Willy


diff -urN linux-2.4.32-libata1/drivers/scsi/libata-core.c linux-2.4.32-libata1-highmem/drivers/scsi/libata-core.c
--- linux-2.4.32-libata1/drivers/scsi/libata-core.c 2005-12-04 16:32:33.000000000 +0100
+++ linux-2.4.32-libata1-highmem/drivers/scsi/libata-core.c 2005-12-04 18:37:28.000000000 +0100
@@ -2424,9 +2424,9 @@
sg[qc->orig_n_elem - 1].length += qc->pad_len;
if (pad_buf) {
struct scatterlist *psg = &qc->pad_sgent;
- void *addr = kmap_atomic(psg->page, KM_IRQ0);
+ void *addr = kmap_atomic(psg->page, KM_BIO_IRQ);
memcpy(addr + psg->offset, pad_buf, qc->pad_len);
- kunmap_atomic(psg->page, KM_IRQ0);
+ kunmap_atomic(psg->page, KM_BIO_IRQ);
}
} else {
if (sg_dma_len(&sg[0]) > 0)
@@ -2698,9 +2698,9 @@
psg->offset = offset_in_page(offset);

if (qc->tf.flags & ATA_TFLAG_WRITE) {
- void *addr = kmap_atomic(psg->page, KM_IRQ0);
+ void *addr = kmap_atomic(psg->page, KM_BIO_IRQ);
memcpy(pad_buf, addr + psg->offset, qc->pad_len);
- kunmap_atomic(psg->page, KM_IRQ0);
+ kunmap_atomic(psg->page, KM_BIO_IRQ);
}

sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ);


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