From 05b0d8e3b8a1ed1a5840a317ce4f7f4ebe53156f Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 8 May 2017 16:13:02 +0200 Subject: 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 Reviewed-by: John Snow Signed-off-by: Paolo Bonzini Reviewed-by: Jeff Cody Message-id: 20170508141310.8674-4-pbonzini@redhat.com Signed-off-by: Jeff Cody --- block/mirror.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'block/mirror.c') diff --git a/block/mirror.c b/block/mirror.c index e86f8f8ad7..b9eb2a2ddb 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1252,7 +1252,7 @@ fail: g_free(s->replaces); blk_unref(s->target); - block_job_unref(&s->common); + block_job_early_fail(&s->common); } bdrv_child_try_set_perm(mirror_top_bs->backing, 0, BLK_PERM_ALL, -- cgit v1.2.3