From 628ff683034c83ce54a1ae91d898d44e34f4851a Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Fri, 23 May 2014 21:29:44 +0800 Subject: block: Move op_blocker check from block_job_create to its caller It makes no sense to check for "any" blocker on bs, we are here only because of the mechanical conversion from in_use to op_blockers. Remove it now, and let the callers check specific operation types. Backup and mirror already have it, add checker to stream and commit. Signed-off-by: Fam Zheng Reviewed-by: Benoit Canet Reviewed-by: Jeff Cody Reviewed-by: Stefan Hajnoczi Signed-off-by: Stefan Hajnoczi --- blockdev.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index 0a519029b8..9a9bdec7da 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1889,6 +1889,10 @@ void qmp_block_stream(const char *device, bool has_base, return; } + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_STREAM, errp)) { + return; + } + if (base) { base_bs = bdrv_find_backing_image(bs, base); if (base_bs == NULL) { @@ -1933,6 +1937,10 @@ void qmp_block_commit(const char *device, return; } + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_COMMIT, errp)) { + return; + } + /* default top_bs is the active layer */ top_bs = bs; -- cgit v1.2.3-55-g7522