diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2017-05-08 16:13:02 +0200 |
---|---|---|
committer | Jeff Cody <jcody@redhat.com> | 2017-05-24 16:38:51 -0400 |
commit | 05b0d8e3b8a1ed1a5840a317ce4f7f4ebe53156f (patch) | |
tree | 94487e194c1c0e31d8035e25b2e598f323e521b8 /tests/test-blockjob.c | |
parent | 9f086abbe43d29de2409e01d8fb2d68a6102afbc (diff) |
blockjob: introduce block_job_early_fail
Outside blockjob.c, block_job_unref is only used when a block job fails
to start, and block_job_ref is not used at all. The reference counting
thus is pretty well hidden. Introduce a separate function to be used
by block jobs; because block_job_ref and block_job_unref now become
static, move them earlier in blockjob.c.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-id: 20170508141310.8674-4-pbonzini@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'tests/test-blockjob.c')
-rw-r--r-- | tests/test-blockjob.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c index 740e740398..23bdf1a932 100644 --- a/tests/test-blockjob.c +++ b/tests/test-blockjob.c @@ -116,11 +116,11 @@ static void test_job_ids(void) job[1] = do_test_id(blk[1], "id0", false); /* But once job[0] finishes we can reuse its ID */ - block_job_unref(job[0]); + block_job_early_fail(job[0]); job[1] = do_test_id(blk[1], "id0", true); /* No job ID specified, defaults to the backend name ('drive1') */ - block_job_unref(job[1]); + block_job_early_fail(job[1]); job[1] = do_test_id(blk[1], NULL, true); /* Duplicate job ID */ @@ -133,9 +133,9 @@ static void test_job_ids(void) /* This one is valid */ job[2] = do_test_id(blk[2], "id_2", true); - block_job_unref(job[0]); - block_job_unref(job[1]); - block_job_unref(job[2]); + block_job_early_fail(job[0]); + block_job_early_fail(job[1]); + block_job_early_fail(job[2]); destroy_blk(blk[0]); destroy_blk(blk[1]); |