From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfuDu-000151-GP for qemu-devel@nongnu.org; Fri, 24 May 2013 11:48:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfuDt-0006xD-0K for qemu-devel@nongnu.org; Fri, 24 May 2013 11:48:06 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:60565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfuDs-0006wP-Ph for qemu-devel@nongnu.org; Fri, 24 May 2013 11:48:04 -0400 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 May 2013 09:48:03 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id DA85C3E4007A for ; Fri, 24 May 2013 09:47:30 -0600 (MDT) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r4OFlWEv132740 for ; Fri, 24 May 2013 09:47:32 -0600 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r4OFoY1c019974 for ; Fri, 24 May 2013 09:50:34 -0600 Message-ID: <519F8B90.9010609@linux.vnet.ibm.com> Date: Fri, 24 May 2013 11:47:28 -0400 From: Corey Bryant MIME-Version: 1.0 References: <1369331087-22345-1-git-send-email-coreyb@linux.vnet.ibm.com> <1369331087-22345-2-git-send-email-coreyb@linux.vnet.ibm.com> <20130524130622.GA3426@dhcp-200-207.str.redhat.com> <519F884B.8060703@linux.vnet.ibm.com> <20130524153711.GB30453@dhcp-200-207.str.redhat.com> In-Reply-To: <20130524153711.GB30453@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/7] vnvram: VNVRAM bdrv support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: aliguori@us.ibm.com, stefanb@linux.vnet.ibm.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, jschopp@linux.vnet.ibm.com, stefanha@redhat.com, lcapitulino@redhat.com On 05/24/2013 11:37 AM, Kevin Wolf wrote: > Am 24.05.2013 um 17:33 hat Corey Bryant geschrieben: >> >> >> On 05/24/2013 09:06 AM, Kevin Wolf wrote: >>> Am 23.05.2013 um 19:44 hat Corey Bryant geschrieben: >>>> Provides low-level VNVRAM functionality that reads and writes data, >>>> such as an entry's binary blob, to a drive image using the block >>>> driver. >>>> >>>> Signed-off-by: Corey Bryant >>> >>>> +/* >>>> + * Increase the drive size if it's too small to fit the VNVRAM data >>>> + */ >>>> +static int vnvram_drv_adjust_size(VNVRAM *vnvram) >>>> +{ >>>> + int rc = 0; >>>> + int64_t needed_size; >>>> + >>>> + needed_size = 0; >>>> + >>>> + if (bdrv_getlength(vnvram->bds) < needed_size) { >>>> + rc = bdrv_truncate(vnvram->bds, needed_size); >>>> + if (rc != 0) { >>>> + DPRINTF("%s: VNVRAM drive too small\n", __func__); >>>> + } >>>> + } >>>> + >>>> + return rc; >>>> +} >>> >>> This function doesn't make a whole lot of sense. It truncates the file >>> to size 0 if and only if bdrv_getlength() returns an error. >>> >> >> There's a later patch that adds a "get size" function and changes >> the initialization of needed_size to the actual size needed to store >> VNVRAM data. Anyway I should probably just include that change in >> this patch. I think I'll still need this function or part of it >> with the new simplified approach that it looks like we're going to >> take. > > Okay. But even then, do you really want to truncate on errors? > > Kevin > > > True, it'll need something to account for bdrv_getlength() failures and not truncate in that case. -- Regards, Corey Bryant