From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn5vG-0008IT-VD for qemu-devel@nongnu.org; Wed, 21 May 2014 08:47:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wn5vA-0001Lc-Mn for qemu-devel@nongnu.org; Wed, 21 May 2014 08:47:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wn5vA-0001LQ-EY for qemu-devel@nongnu.org; Wed, 21 May 2014 08:47:00 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4LCkwjr030791 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 21 May 2014 08:46:59 -0400 Date: Wed, 21 May 2014 14:46:57 +0200 From: Stefan Hajnoczi Message-ID: <20140521124657.GC6619@stefanha-thinkpad.redhat.com> References: <1400565880-13409-1-git-send-email-famz@redhat.com> <1400565880-13409-4-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1400565880-13409-4-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v20 03/15] 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, armbru@redhat.com, jcody@redhat.com, hbrock@redhat.com, qemu-devel@nongnu.org, rjones@redhat.com, imain@redhat.com, pbonzini@redhat.com On Tue, May 20, 2014 at 02:04:28PM +0800, Fam Zheng wrote: > This drops BlockDriverState.in_use with op_blockers: > > - Call bdrv_op_block_all in place of bdrv_set_in_use(bs, 1). > > - Call bdrv_op_unblock_all in place of bdrv_set_in_use(bs, 0). > > - Check bdrv_op_is_blocked() in place of bdrv_in_use(bs). > > The specific types are used, e.g. in place of starting block backup, > bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP, ...). > > There is one exception in block_job_create, where > bdrv_op_blocker_is_empty() is used, because we don't know the operation > type here. This doesn't matter because in a few commits away we will drop > the check and move it to callers that _do_ know the type. > > - Check bdrv_op_blocker_is_empty() in place of assert(!bs->in_use). > > Note: there is only bdrv_op_block_all and bdrv_op_unblock_all callers at > this moment. So although the checks are specific to op types, this > changes can still be seen as identical logic with previously with > in_use. The difference is error message are improved because of blocker > error info. > > Signed-off-by: Fam Zheng > Reviewed-by: Jeff Cody > --- > block-migration.c | 7 +++++-- > block.c | 24 +++++++----------------- > blockdev.c | 19 +++++++++---------- > blockjob.c | 14 +++++++++----- > hw/block/dataplane/virtio-blk.c | 18 ++++++++++++------ > include/block/block.h | 2 -- > include/block/block_int.h | 1 - > include/block/blockjob.h | 3 +++ > 8 files changed, 45 insertions(+), 43 deletions(-) Reviewed-by: Stefan Hajnoczi