From: iap10@labyrinth.cl.cam.ac.uk Date: Sun, 2 May 2004 00:27:58 +0000 (+0000) Subject: bitkeeper revision 1.884 (4094408eiFBLnUCY6YdJfald4yk6bw) X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~18237 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=685d71bab181325dd4f5a5965314fa647fdf68a6;p=xen.git bitkeeper revision 1.884 (4094408eiFBLnUCY6YdJfald4yk6bw) Restore now uses fast mapper interface. --- diff --git a/tools/xc/lib/xc_linux_restore.c b/tools/xc/lib/xc_linux_restore.c index 00acc5a687..e27221281a 100644 --- a/tools/xc/lib/xc_linux_restore.c +++ b/tools/xc/lib/xc_linux_restore.c @@ -10,6 +10,8 @@ #include #include +#define MAX_BATCH_SIZE 1024 + /* This may allow us to create a 'quiet' command-line option, if necessary. */ #define verbose_printf(_f, _a...) \ do { \ @@ -93,6 +95,9 @@ int xc_linux_restore(int xc_handle, /* A temporary mapping of the guest's suspend record. */ suspend_record_t *p_srec; + mfn_mapper_t *region_mapper, *mapper_handle1; + char *region_base; + /* The name and descriptor of the file that we are reading from. */ int fd; gzFile gfd; @@ -215,6 +220,15 @@ int xc_linux_restore(int xc_handle, goto out; } + + if ( (region_mapper = mfn_mapper_init(xc_handle, dom, + MAX_BATCH_SIZE*PAGE_SIZE, + PROT_WRITE )) + == NULL ) + goto out; + + region_base = mfn_mapper_base( region_mapper ); + verbose_printf("Reloading memory pages: 0%%"); /* @@ -242,7 +256,7 @@ int xc_linux_restore(int xc_handle, goto out; } - printf("batch=%d\n",j); + //printf("batch=%d\n",j); if(j==0) break; // our work here is done @@ -255,6 +269,24 @@ int xc_linux_restore(int xc_handle, for(i=0;i PAGE_SIZE ) copy_size = PAGE_SIZE; - pfn = pfn_to_mfn_frame_list[i/1024]; + unsigned long pfn, mfn; + + pfn = pfn_to_mfn_frame_list[i]; if ( (pfn >= nr_pfns) || (pfn_type[pfn] != NONE) ) { ERROR("PFN-to-MFN frame number is bad"); goto out; } - ppage = map_pfn_writeable(pm_handle, pfn_to_mfn_table[pfn]); - memcpy(ppage, &pfn_to_mfn_table[i], copy_size); - unmap_pfn(pm_handle, ppage); + mfn = pfn_to_mfn_table[pfn]; + + mfn_mapper_queue_entry( mapper_handle1, i<