• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision4c2d0f6dca24f3396ab0718ad3f9f53cc53004df (tree)
Time2022-01-28 23:38:23
AuthorDavid Edmondson <david.edmondson@orac...>
CommiterJuan Quintela

Log Message

migration: Introduce ram_transferred_add()

Replace direct manipulation of ram_counters.transferred with a
function.

Signed-off-by: David Edmondson <david.edmondson@oracle.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>

Change Summary

Incremental Difference

--- a/migration/ram.c
+++ b/migration/ram.c
@@ -387,6 +387,11 @@ uint64_t ram_bytes_remaining(void)
387387
388388 MigrationStats ram_counters;
389389
390+static void ram_transferred_add(uint64_t bytes)
391+{
392+ ram_counters.transferred += bytes;
393+}
394+
390395 /* used by the search for pages to send */
391396 struct PageSearchStatus {
392397 /* Current block being searched */
@@ -767,7 +772,7 @@ static int save_xbzrle_page(RAMState *rs, uint8_t **current_data,
767772 * RAM_SAVE_FLAG_CONTINUE.
768773 */
769774 xbzrle_counters.bytes += bytes_xbzrle - 8;
770- ram_counters.transferred += bytes_xbzrle;
775+ ram_transferred_add(bytes_xbzrle);
771776
772777 return 1;
773778 }
@@ -1208,7 +1213,7 @@ static int save_zero_page(RAMState *rs, RAMBlock *block, ram_addr_t offset)
12081213
12091214 if (len) {
12101215 ram_counters.duplicate++;
1211- ram_counters.transferred += len;
1216+ ram_transferred_add(len);
12121217 return 1;
12131218 }
12141219 return -1;
@@ -1235,7 +1240,7 @@ static bool control_save_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
12351240 }
12361241
12371242 if (bytes_xmit) {
1238- ram_counters.transferred += bytes_xmit;
1243+ ram_transferred_add(bytes_xmit);
12391244 *pages = 1;
12401245 }
12411246
@@ -1266,8 +1271,8 @@ static bool control_save_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
12661271 static int save_normal_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
12671272 uint8_t *buf, bool async)
12681273 {
1269- ram_counters.transferred += save_page_header(rs, rs->f, block,
1270- offset | RAM_SAVE_FLAG_PAGE);
1274+ ram_transferred_add(save_page_header(rs, rs->f, block,
1275+ offset | RAM_SAVE_FLAG_PAGE));
12711276 if (async) {
12721277 qemu_put_buffer_async(rs->f, buf, TARGET_PAGE_SIZE,
12731278 migrate_release_ram() &
@@ -1275,7 +1280,7 @@ static int save_normal_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
12751280 } else {
12761281 qemu_put_buffer(rs->f, buf, TARGET_PAGE_SIZE);
12771282 }
1278- ram_counters.transferred += TARGET_PAGE_SIZE;
1283+ ram_transferred_add(TARGET_PAGE_SIZE);
12791284 ram_counters.normal++;
12801285 return 1;
12811286 }
@@ -1367,7 +1372,7 @@ static bool do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block,
13671372 static void
13681373 update_compress_thread_counts(const CompressParam *param, int bytes_xmit)
13691374 {
1370- ram_counters.transferred += bytes_xmit;
1375+ ram_transferred_add(bytes_xmit);
13711376
13721377 if (param->zero_page) {
13731378 ram_counters.duplicate++;
@@ -2284,7 +2289,7 @@ void acct_update_position(QEMUFile *f, size_t size, bool zero)
22842289 ram_counters.duplicate += pages;
22852290 } else {
22862291 ram_counters.normal += pages;
2287- ram_counters.transferred += size;
2292+ ram_transferred_add(size);
22882293 qemu_update_position(f, size);
22892294 }
22902295 }
@@ -3040,7 +3045,7 @@ out:
30403045 multifd_send_sync_main(rs->f);
30413046 qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
30423047 qemu_fflush(f);
3043- ram_counters.transferred += 8;
3048+ ram_transferred_add(8);
30443049
30453050 ret = qemu_file_get_error(f);
30463051 }