diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-04-13 18:50:05 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-05-23 14:30:49 +0200 |
commit | 80fa2c756b3241f24015a7503a01f7999d4a942d (patch) | |
tree | db1b410af62162feb7d8b69651a9d671cf4cc030 /block | |
parent | a50c2ab858fe613fb805e53b4f6b970ab936706d (diff) | |
download | qemu-80fa2c756b3241f24015a7503a01f7999d4a942d.zip qemu-80fa2c756b3241f24015a7503a01f7999d4a942d.tar.gz qemu-80fa2c756b3241f24015a7503a01f7999d4a942d.tar.bz2 |
job: Add reference counting
This moves reference counting from BlockJob to Job.
In order to keep calling the BlockJob cleanup code when the job is
deleted via job_unref(), introduce a new JobDriver.free callback. Every
block job must use block_job_free() for this callback, this is asserted
in block_job_create().
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/backup.c | 1 | ||||
-rw-r--r-- | block/commit.c | 1 | ||||
-rw-r--r-- | block/mirror.c | 2 | ||||
-rw-r--r-- | block/stream.c | 1 |
4 files changed, 5 insertions, 0 deletions
diff --git a/block/backup.c b/block/backup.c index baf8d43..cfdb89d 100644 --- a/block/backup.c +++ b/block/backup.c @@ -526,6 +526,7 @@ static const BlockJobDriver backup_job_driver = { .job_driver = { .instance_size = sizeof(BackupBlockJob), .job_type = JOB_TYPE_BACKUP, + .free = block_job_free, }, .start = backup_run, .commit = backup_commit, diff --git a/block/commit.c b/block/commit.c index 32d29c8..925c96a 100644 --- a/block/commit.c +++ b/block/commit.c @@ -218,6 +218,7 @@ static const BlockJobDriver commit_job_driver = { .job_driver = { .instance_size = sizeof(CommitBlockJob), .job_type = JOB_TYPE_COMMIT, + .free = block_job_free, }, .start = commit_run, }; diff --git a/block/mirror.c b/block/mirror.c index 35fcc1f..0df4f70 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -989,6 +989,7 @@ static const BlockJobDriver mirror_job_driver = { .job_driver = { .instance_size = sizeof(MirrorBlockJob), .job_type = JOB_TYPE_MIRROR, + .free = block_job_free, }, .start = mirror_run, .complete = mirror_complete, @@ -1001,6 +1002,7 @@ static const BlockJobDriver commit_active_job_driver = { .job_driver = { .instance_size = sizeof(MirrorBlockJob), .job_type = JOB_TYPE_COMMIT, + .free = block_job_free, }, .start = mirror_run, .complete = mirror_complete, diff --git a/block/stream.c b/block/stream.c index cb723f1..7273d22 100644 --- a/block/stream.c +++ b/block/stream.c @@ -212,6 +212,7 @@ static const BlockJobDriver stream_job_driver = { .job_driver = { .instance_size = sizeof(StreamBlockJob), .job_type = JOB_TYPE_STREAM, + .free = block_job_free, }, .start = stream_run, }; |