From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1ZDP-0002SG-3C for qemu-devel@nongnu.org; Tue, 23 Jul 2013 05:49:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1ZDM-0006QN-2M for qemu-devel@nongnu.org; Tue, 23 Jul 2013 05:49:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1ZDL-0006QD-Ob for qemu-devel@nongnu.org; Tue, 23 Jul 2013 05:49:03 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6N9n2Bq001129 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 23 Jul 2013 05:49:03 -0400 Date: Tue, 23 Jul 2013 11:49:01 +0200 From: Stefan Hajnoczi Message-ID: <20130723094901.GD20256@stefanha-thinkpad.redhat.com> References: <1374054136-28741-1-git-send-email-famz@redhat.com> <1374054136-28741-6-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1374054136-28741-6-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 05/11] migration: omit drive ref as we have bdrv_ref now 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, pbonzini@redhat.com On Wed, Jul 17, 2013 at 05:42:10PM +0800, Fam Zheng wrote: > Signed-off-by: Fam Zheng > --- > block-migration.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/block-migration.c b/block-migration.c > index d558410..d14f4eb 100644 > --- a/block-migration.c > +++ b/block-migration.c > @@ -320,7 +320,6 @@ static void init_blk_migration_it(void *opaque, BlockDriverState *bs) > bmds->completed_sectors = 0; > bmds->shared_base = block_mig_state.shared_base; > alloc_aio_bitmap(bmds); > - drive_get_ref(drive_get_by_blockdev(bs)); > bdrv_ref(bs, true); > > block_mig_state.total_sector_sum += sectors; > @@ -558,7 +557,6 @@ static void blk_mig_cleanup(void) > while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) { > QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry); > bdrv_unref(bmds->bs, true); > - drive_put_ref(drive_get_by_blockdev(bmds->bs)); > g_free(bmds->aio_bitmap); > g_free(bmds); > } > -- > 1.8.3.2 The key information here is that block-migration.c does not actually use DriveInfo anywhere. Hence it's safe to drop this code since we really only cared about referencing BDS. I suggest including an explanation like this in the commit description. I had to audit the code to check whether the DriveInfo was used anywhere else.