IDE: Save a call to PageHighMem()
authorJean Delvare <khali@linux-fr.org>
Tue, 23 Jun 2009 11:12:24 +0000 (04:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 7 Aug 2009 17:42:55 +0000 (10:42 -0700)
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>
drivers/ide/ide-taskfile.c

index 75b85a8cd2d4935ba500927946fa292c890e0e8d..90e5c0deb0e02da84e28a3c19993c614732f5c00 100644 (file)
@@ -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;
@@ -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;
@@ -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;