]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/power/snapshot.c
[PATCH] swsusp: read speedup
[linux-2.6-omap-h63xx.git] / kernel / power / snapshot.c
index 24c96f3542318da918879ca45655afef95d55ce8..591301ae8b7d9177873d10ff2630596898ea5177 100644 (file)
@@ -227,11 +227,17 @@ static void copy_data_pages(struct pbe *pblist)
                for (zone_pfn = 0; zone_pfn < zone->spanned_pages; ++zone_pfn) {
                        if (saveable(zone, &zone_pfn)) {
                                struct page *page;
+                               long *src, *dst;
+                               int n;
+
                                page = pfn_to_page(zone_pfn + zone->zone_start_pfn);
                                BUG_ON(!pbe);
                                pbe->orig_address = (unsigned long)page_address(page);
-                               /* copy_page is not usable for copying task structs. */
-                               memcpy((void *)pbe->address, (void *)pbe->orig_address, PAGE_SIZE);
+                               /* copy_page and memcpy are not usable for copying task structs. */
+                               dst = (long *)pbe->address;
+                               src = (long *)pbe->orig_address;
+                               for (n = PAGE_SIZE / sizeof(long); n; n--)
+                                       *dst++ = *src++;
                                pbe = pbe->next;
                        }
                }
@@ -308,7 +314,7 @@ static unsigned int unsafe_pages;
  *     and we count them using unsafe_pages
  */
 
-static inline void *alloc_image_page(gfp_t gfp_mask, int safe_needed)
+static void *alloc_image_page(gfp_t gfp_mask, int safe_needed)
 {
        void *res;
 
@@ -822,13 +828,16 @@ int snapshot_write_next(struct snapshot_handle *handle, size_t count)
        }
        if (!handle->offset)
                handle->buffer = buffer;
+       handle->sync_read = 1;
        if (handle->prev < handle->page) {
                if (!handle->prev) {
-                       error = load_header(handle, (struct swsusp_info *)buffer);
+                       error = load_header(handle,
+                                       (struct swsusp_info *)buffer);
                        if (error)
                                return error;
                } else if (handle->prev <= nr_meta_pages) {
-                       handle->pbe = unpack_orig_addresses(buffer, handle->pbe);
+                       handle->pbe = unpack_orig_addresses(buffer,
+                                                       handle->pbe);
                        if (!handle->pbe) {
                                error = prepare_image(handle);
                                if (error)
@@ -836,10 +845,12 @@ int snapshot_write_next(struct snapshot_handle *handle, size_t count)
                                handle->pbe = pagedir_nosave;
                                handle->last_pbe = NULL;
                                handle->buffer = get_buffer(handle);
+                               handle->sync_read = 0;
                        }
                } else {
                        handle->pbe = handle->pbe->next;
                        handle->buffer = get_buffer(handle);
+                       handle->sync_read = 0;
                }
                handle->prev = handle->page;
        }