From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3nGy-0003ha-3G for qemu-devel@nongnu.org; Mon, 29 Jul 2013 09:14:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3nGs-0004dB-4Z for qemu-devel@nongnu.org; Mon, 29 Jul 2013 09:14:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3580) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3nGr-0004cx-TZ for qemu-devel@nongnu.org; Mon, 29 Jul 2013 09:13:54 -0400 Date: Mon, 29 Jul 2013 15:13:44 +0200 From: Kevin Wolf Message-ID: <20130729131344.GD10467@dhcp-200-207.str.redhat.com> References: <1374762197-7261-1-git-send-email-pbonzini@redhat.com> <1374762197-7261-5-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1374762197-7261-5-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 04/19] block: update bs->total_sectors on writes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: pl@kamp.de, qemu-devel@nongnu.org, stefanha@redhat.com Am 25.07.2013 um 16:23 hat Paolo Bonzini geschrieben: > If a BlockDriverState is growable, after every write we need to > check if bs->total_sectors might have changed. > > Signed-off-by: Paolo Bonzini > --- > block.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/block.c b/block.c > index 6cd39fa..ebac2fa 100644 > --- a/block.c > +++ b/block.c > @@ -2651,6 +2651,9 @@ static int coroutine_fn bdrv_co_do_writev(BlockDriverState *bs, > if (bs->wr_highest_sector < sector_num + nb_sectors - 1) { > bs->wr_highest_sector = sector_num + nb_sectors - 1; > } > + if (bs->growable && ret >= 0) { > + bs->total_sectors = MAX(bs->total_sectors, sector_num + nb_sectors); > + } Can we change bdrv_getlength() to use bs->total_sectors even for growable images after this patch? Kevin