[libata irq-pio] use PageHighMem() to optimize the kmap_atomic() usage
as done in ide-scsi.c Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
This commit is contained in:
parent
083958d313
commit
91b8b3132e
|
@ -2748,7 +2748,6 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
|
||||||
struct page *page;
|
struct page *page;
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
if (qc->cursect == (qc->nsect - 1))
|
if (qc->cursect == (qc->nsect - 1))
|
||||||
ap->hsm_task_state = HSM_ST_LAST;
|
ap->hsm_task_state = HSM_ST_LAST;
|
||||||
|
@ -2762,14 +2761,21 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
|
||||||
|
|
||||||
DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
|
DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
|
||||||
|
|
||||||
local_irq_save(flags);
|
if (PageHighMem(page)) {
|
||||||
buf = kmap_atomic(page, KM_IRQ0);
|
unsigned long flags;
|
||||||
|
|
||||||
/* do the actual data transfer */
|
local_irq_save(flags);
|
||||||
ata_data_xfer(ap, buf + offset, ATA_SECT_SIZE, do_write);
|
buf = kmap_atomic(page, KM_IRQ0);
|
||||||
|
|
||||||
kunmap_atomic(buf, KM_IRQ0);
|
/* do the actual data transfer */
|
||||||
local_irq_restore(flags);
|
ata_data_xfer(ap, buf + offset, ATA_SECT_SIZE, do_write);
|
||||||
|
|
||||||
|
kunmap_atomic(buf, KM_IRQ0);
|
||||||
|
local_irq_restore(flags);
|
||||||
|
} else {
|
||||||
|
buf = page_address(page);
|
||||||
|
ata_data_xfer(ap, buf + offset, ATA_SECT_SIZE, do_write);
|
||||||
|
}
|
||||||
|
|
||||||
qc->cursect++;
|
qc->cursect++;
|
||||||
qc->cursg_ofs++;
|
qc->cursg_ofs++;
|
||||||
|
@ -2908,7 +2914,6 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
|
||||||
struct page *page;
|
struct page *page;
|
||||||
unsigned char *buf;
|
unsigned char *buf;
|
||||||
unsigned int offset, count;
|
unsigned int offset, count;
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
if (qc->curbytes + bytes >= qc->nbytes)
|
if (qc->curbytes + bytes >= qc->nbytes)
|
||||||
ap->hsm_task_state = HSM_ST_LAST;
|
ap->hsm_task_state = HSM_ST_LAST;
|
||||||
|
@ -2954,14 +2959,21 @@ next_sg:
|
||||||
|
|
||||||
DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
|
DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
|
||||||
|
|
||||||
local_irq_save(flags);
|
if (PageHighMem(page)) {
|
||||||
buf = kmap_atomic(page, KM_IRQ0);
|
unsigned long flags;
|
||||||
|
|
||||||
/* do the actual data transfer */
|
local_irq_save(flags);
|
||||||
ata_data_xfer(ap, buf + offset, count, do_write);
|
buf = kmap_atomic(page, KM_IRQ0);
|
||||||
|
|
||||||
kunmap_atomic(buf, KM_IRQ0);
|
/* do the actual data transfer */
|
||||||
local_irq_restore(flags);
|
ata_data_xfer(ap, buf + offset, count, do_write);
|
||||||
|
|
||||||
|
kunmap_atomic(buf, KM_IRQ0);
|
||||||
|
local_irq_restore(flags);
|
||||||
|
} else {
|
||||||
|
buf = page_address(page);
|
||||||
|
ata_data_xfer(ap, buf + offset, count, do_write);
|
||||||
|
}
|
||||||
|
|
||||||
bytes -= count;
|
bytes -= count;
|
||||||
qc->curbytes += count;
|
qc->curbytes += count;
|
||||||
|
|
Loading…
Reference in a new issue