aboutsummaryrefslogtreecommitdiff
path: root/block/backup.c
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2018-08-29 21:57:31 -0400
committerMax Reitz <mreitz@redhat.com>2018-08-31 16:28:33 +0200
commiteb23654dbe43b549ea2a9ebff9d8edf544d34a73 (patch)
tree4801dd246bf808450c131683b57fd50c1f8dbcaf /block/backup.c
parent7b508f6b7a38a8d9729772fa6e525da883fb120b (diff)
jobs: utilize job_exit shim
Utilize the job_exit shim by not calling job_defer_to_main_loop, and where applicable, converting the deferred callback into the job_exit callback. This converts backup, stream, create, and the unit tests all at once. Most of these jobs do not see any changes to the order in which they clean up their resources, except the test-blockjob-txn test, which now puts down its bs before job_completed is called. This is safe for the same reason the reordering in the mirror job is safe, because job_completed no longer runs under two locks, making the unref safe even if it causes a flush. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 20180830015734.19765-7-jsnow@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/backup.c')
-rw-r--r--block/backup.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/block/backup.c b/block/backup.c
index 1e965d54e5..a67b7fa96b 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -380,18 +380,6 @@ static BlockErrorAction backup_error_action(BackupBlockJob *job,
}
}
-typedef struct {
- int ret;
-} BackupCompleteData;
-
-static void backup_complete(Job *job, void *opaque)
-{
- BackupCompleteData *data = opaque;
-
- job_completed(job, data->ret);
- g_free(data);
-}
-
static bool coroutine_fn yield_and_check(BackupBlockJob *job)
{
uint64_t delay_ns;
@@ -483,7 +471,6 @@ static void backup_incremental_init_copy_bitmap(BackupBlockJob *job)
static int coroutine_fn backup_run(Job *opaque_job, Error **errp)
{
BackupBlockJob *job = container_of(opaque_job, BackupBlockJob, common.job);
- BackupCompleteData *data;
BlockDriverState *bs = blk_bs(job->common.blk);
int64_t offset, nb_clusters;
int ret = 0;
@@ -584,9 +571,6 @@ static int coroutine_fn backup_run(Job *opaque_job, Error **errp)
qemu_co_rwlock_unlock(&job->flush_rwlock);
hbitmap_free(job->copy_bitmap);
- data = g_malloc(sizeof(*data));
- data->ret = ret;
- job_defer_to_main_loop(&job->common.job, backup_complete, data);
return ret;
}