]> git.proxmox.com Git - mirror_qemu.git/commitdiff
migration/postcopy: use QEMU_IS_ALIGNED to replace host_offset
authorWei Yang <richardw.yang@linux.intel.com>
Tue, 6 Aug 2019 00:46:48 +0000 (08:46 +0800)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Wed, 14 Aug 2019 16:33:14 +0000 (17:33 +0100)
Use QEMU_IS_ALIGNED for the check, it would be more consistent with
other align calculations.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190806004648.8659-3-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
migration/ram.c

index d2184c3cfc61d9f5d7551bf2c37347f757c13500..eee68a7991a6bdab14a7c902a6cb6d48b70b6d2f 100644 (file)
@@ -2955,14 +2955,12 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass,
     }
 
     while (run_start < pages) {
-        unsigned long host_offset;
 
         /*
          * If the start of this run of pages is in the middle of a host
          * page, then we need to fixup this host page.
          */
-        host_offset = run_start % host_ratio;
-        if (!host_offset) {
+        if (QEMU_IS_ALIGNED(run_start, host_ratio)) {
             /* Find the end of this run */
             if (unsent_pass) {
                 run_start = find_next_bit(unsentmap, pages, run_start + 1);
@@ -2974,10 +2972,9 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass,
              * run doesn't finish at the end of a host page
              * and we need to discard.
              */
-            host_offset = run_start % host_ratio;
         }
 
-        if (host_offset) {
+        if (!QEMU_IS_ALIGNED(run_start, host_ratio)) {
             unsigned long page;
             unsigned long fixup_start_addr = QEMU_ALIGN_DOWN(run_start,
                                                              host_ratio);