From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMYqu-0001EH-KV for qemu-devel@nongnu.org; Thu, 19 Sep 2013 03:40:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMYqo-00039G-Kg for qemu-devel@nongnu.org; Thu, 19 Sep 2013 03:40:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMYqo-00038E-7n for qemu-devel@nongnu.org; Thu, 19 Sep 2013 03:40:34 -0400 Message-ID: <523AAA61.5040300@redhat.com> Date: Thu, 19 Sep 2013 09:40:17 +0200 From: Max Reitz MIME-Version: 1.0 References: <1378382715-28132-1-git-send-email-mreitz@redhat.com> <1378382715-28132-2-git-send-email-mreitz@redhat.com> <20130918145918.GG25444@stefanha-thinkpad.redhat.com> In-Reply-To: <20130918145918.GG25444@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] block: Additional info string in ImageInfo and BDI List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi On 2013-09-18 16:59, Stefan Hajnoczi wrote: > On Thu, Sep 05, 2013 at 02:05:13PM +0200, Max Reitz wrote: >> diff --git a/block.c b/block.c >> index 26639e8..9fd9f3a 100644 >> --- a/block.c >> +++ b/block.c >> @@ -1921,7 +1921,7 @@ void bdrv_round_to_clusters(BlockDriverState *bs, >> int64_t *cluster_sector_num, >> int *cluster_nb_sectors) >> { >> - BlockDriverInfo bdi; >> + BlockDriverInfo bdi = { .info_string = NULL }; >> >> if (bdrv_get_info(bs, &bdi) < 0 || bdi.cluster_size == 0) { >> *cluster_sector_num = sector_num; >> @@ -1932,6 +1932,7 @@ void bdrv_round_to_clusters(BlockDriverState *bs, >> *cluster_nb_sectors = QEMU_ALIGN_UP(sector_num - *cluster_sector_num + >> nb_sectors, c); >> } >> + g_free(bdi.info_string); >> } > This function is called in the I/O path. It's not appropriate to > generate an options string each time this gets called :). > > Together with Eric's comments it seems like this change needs a > different interface that is QMP-friendly and not in the I/O path. > > Stefan I've already sent a v2, v3 and v4 which address Eric's comment. However, your problem still remains. I think I might either add a new function for specifically requesting the format specific information (instead of generally including it in BDI) or introduce a flag parameter for bdrv_get_info which requests that BDI field to be filled (or, more generally, which will prevent bdrv_get_info from performing any relatively expensive operation). Max