Skip to content

Commit

Permalink
IDE: Save a call to PageHighMem()
Browse files Browse the repository at this point in the history
PageHighMem() isn't cheap so avoid calling it twice on the same page.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jean Delvare authored and David S. Miller committed Aug 7, 2009
1 parent 90bc1a6 commit a907905
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/ide/ide-taskfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,

while (len) {
unsigned nr_bytes = min(len, cursg->length - cmd->cursg_ofs);
int page_is_high;

if (nr_bytes > PAGE_SIZE)
nr_bytes = PAGE_SIZE;
Expand All @@ -247,7 +248,8 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,
page = nth_page(page, (offset >> PAGE_SHIFT));
offset %= PAGE_SIZE;

if (PageHighMem(page))
page_is_high = PageHighMem(page);
if (page_is_high)
local_irq_save(flags);

buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset;
Expand All @@ -268,7 +270,7 @@ void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd,

kunmap_atomic(buf, KM_BIO_SRC_IRQ);

if (PageHighMem(page))
if (page_is_high)
local_irq_restore(flags);

len -= nr_bytes;
Expand Down

0 comments on commit a907905

Please sign in to comment.