Skip to content

Commit 739fcc1

Browse files
xzpeterJuan Quintela
authored andcommitted
migration: Drop return code for disgard ram process
It will just never fail. Drop those return values where they're constantly zeros. A tiny touch-up on the tracepoint so trace_ram_postcopy_send_discard_bitmap() is called after the logic itself (which sounds more reasonable). Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
1 parent f30c2e5 commit 739fcc1

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

migration/migration.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,10 +2991,7 @@ static int postcopy_start(MigrationState *ms)
29912991
* that are dirty
29922992
*/
29932993
if (migrate_postcopy_ram()) {
2994-
if (ram_postcopy_send_discard_bitmap(ms)) {
2995-
error_report("postcopy send discard bitmap failed");
2996-
goto fail;
2997-
}
2994+
ram_postcopy_send_discard_bitmap(ms);
29982995
}
29992996

30002997
/*

migration/ram.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,8 +2459,6 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *block);
24592459
/**
24602460
* postcopy_each_ram_send_discard: discard all RAMBlocks
24612461
*
2462-
* Returns 0 for success or negative for error
2463-
*
24642462
* Utility for the outgoing postcopy code.
24652463
* Calls postcopy_send_discard_bm_ram for each RAMBlock
24662464
* passing it bitmap indexes and name.
@@ -2469,10 +2467,9 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *block);
24692467
*
24702468
* @ms: current migration state
24712469
*/
2472-
static int postcopy_each_ram_send_discard(MigrationState *ms)
2470+
static void postcopy_each_ram_send_discard(MigrationState *ms)
24732471
{
24742472
struct RAMBlock *block;
2475-
int ret;
24762473

24772474
RAMBLOCK_FOREACH_NOT_IGNORED(block) {
24782475
postcopy_discard_send_init(ms, block->idstr);
@@ -2490,14 +2487,9 @@ static int postcopy_each_ram_send_discard(MigrationState *ms)
24902487
* just needs indexes at this point, avoids it having
24912488
* target page specific code.
24922489
*/
2493-
ret = postcopy_send_discard_bm_ram(ms, block);
2490+
postcopy_send_discard_bm_ram(ms, block);
24942491
postcopy_discard_send_finish(ms);
2495-
if (ret) {
2496-
return ret;
2497-
}
24982492
}
2499-
2500-
return 0;
25012493
}
25022494

25032495
/**
@@ -2570,8 +2562,6 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *block)
25702562
/**
25712563
* ram_postcopy_send_discard_bitmap: transmit the discard bitmap
25722564
*
2573-
* Returns zero on success
2574-
*
25752565
* Transmit the set of pages to be discarded after precopy to the target
25762566
* these are pages that:
25772567
* a) Have been previously transmitted but are now dirty again
@@ -2582,7 +2572,7 @@ static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *block)
25822572
*
25832573
* @ms: current migration state
25842574
*/
2585-
int ram_postcopy_send_discard_bitmap(MigrationState *ms)
2575+
void ram_postcopy_send_discard_bitmap(MigrationState *ms)
25862576
{
25872577
RAMState *rs = ram_state;
25882578

@@ -2596,9 +2586,9 @@ int ram_postcopy_send_discard_bitmap(MigrationState *ms)
25962586
rs->last_sent_block = NULL;
25972587
rs->last_page = 0;
25982588

2599-
trace_ram_postcopy_send_discard_bitmap();
2589+
postcopy_each_ram_send_discard(ms);
26002590

2601-
return postcopy_each_ram_send_discard(ms);
2591+
trace_ram_postcopy_send_discard_bitmap();
26022592
}
26032593

26042594
/**

migration/ram.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
5757
void acct_update_position(QEMUFile *f, size_t size, bool zero);
5858
void ram_postcopy_migrated_memory_release(MigrationState *ms);
5959
/* For outgoing discard bitmap */
60-
int ram_postcopy_send_discard_bitmap(MigrationState *ms);
60+
void ram_postcopy_send_discard_bitmap(MigrationState *ms);
6161
/* For incoming postcopy discard */
6262
int ram_discard_range(const char *block_name, uint64_t start, size_t length);
6363
int ram_postcopy_incoming_init(MigrationIncomingState *mis);

0 commit comments

Comments
 (0)