From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vkzh5-0007jX-SV for qemu-devel@nongnu.org; Mon, 25 Nov 2013 12:11:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vkzgu-0007En-Fj for qemu-devel@nongnu.org; Mon, 25 Nov 2013 12:11:31 -0500 Received: from mail-qe0-x232.google.com ([2607:f8b0:400d:c02::232]:62859) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vkzgu-0007Ej-BF for qemu-devel@nongnu.org; Mon, 25 Nov 2013 12:11:20 -0500 Received: by mail-qe0-f50.google.com with SMTP id 1so2141352qec.23 for ; Mon, 25 Nov 2013 09:11:20 -0800 (PST) Sender: Paolo Bonzini Message-ID: <529384B2.7010109@redhat.com> Date: Mon, 25 Nov 2013 18:11:14 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1385097894-1380-1-git-send-email-famz@redhat.com> <1385097894-1380-4-git-send-email-famz@redhat.com> In-Reply-To: <1385097894-1380-4-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 3/7] block: Replace in_use with operation blocker List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: kwolf@redhat.com, hbrock@redhat.com, qemu-devel@nongnu.org, rjones@redhat.com, imain@redhat.com, stefanha@redhat.com Il 22/11/2013 06:24, Fam Zheng ha scritto: > @@ -41,13 +41,11 @@ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs, > { > BlockJob *job; > > - if (bs->job || bdrv_in_use(bs)) { > + if (bs->job) { > error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs)); > return NULL; > } > bdrv_ref(bs); Why is this check disappearing? Perhaps a previous patch should hoist the in_use check to the callers of block_job_create, and here you should just have an assertion that bs->job == NULL. Then this patch can change the checks to the appropriate op. Paolo