hvm, save/restore: Skip page batches which contain no valid pages.
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 23 Sep 2008 16:11:33 +0000 (17:11 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 23 Sep 2008 16:11:33 +0000 (17:11 +0100)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
tools/libxc/xc_domain_save.c

index c6e1c23c32ddc6394610865be152c68043506551..c1ced27d98f1b19abe50bd45fb1c1ce1c931c3ad 100644 (file)
@@ -1115,7 +1115,20 @@ int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
                 goto out;
             }
 
-            if ( !hvm )
+            if ( hvm )
+            {
+                /* Look for and skip completely empty batches. */
+                for ( j = 0; j < batch; j++ )
+                    if ( (pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK) !=
+                         XEN_DOMCTL_PFINFO_XTAB )
+                        break;
+                if ( j == batch )
+                {
+                    munmap(region_base, batch*PAGE_SIZE);
+                    continue; /* bail on this batch: no valid pages */
+                }
+            }
+            else
             {
                 /* Get page types */
                 for ( j = 0; j < batch; j++ )