Commit a9079052 authored by Jean Delvare's avatar Jean Delvare Committed by David S. Miller

IDE: Save a call to PageHighMem()

PageHighMem() isn't cheap so avoid calling it twice on the same page.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Acked-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 90bc1a65
...@@ -236,6 +236,7 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd, ...@@ -236,6 +236,7 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
while (len) { while (len) {
unsigned nr_bytes = min(len, cursg->length - cmd->cursg_ofs); unsigned nr_bytes = min(len, cursg->length - cmd->cursg_ofs);
int page_is_high;
if (nr_bytes > PAGE_SIZE) if (nr_bytes > PAGE_SIZE)
nr_bytes = PAGE_SIZE; nr_bytes = PAGE_SIZE;
...@@ -247,7 +248,8 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd, ...@@ -247,7 +248,8 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
page = nth_page(page, (offset >> PAGE_SHIFT)); page = nth_page(page, (offset >> PAGE_SHIFT));
offset %= PAGE_SIZE; offset %= PAGE_SIZE;
if (PageHighMem(page)) page_is_high = PageHighMem(page);
if (page_is_high)
local_irq_save(flags); local_irq_save(flags);
buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset;
...@@ -268,7 +270,7 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd, ...@@ -268,7 +270,7 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
kunmap_atomic(buf, KM_BIO_SRC_IRQ); kunmap_atomic(buf, KM_BIO_SRC_IRQ);
if (PageHighMem(page)) if (page_is_high)
local_irq_restore(flags); local_irq_restore(flags);
len -= nr_bytes; len -= nr_bytes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment