From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47716 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdqtY-000762-Ta for qemu-devel@nongnu.org; Fri, 14 Jan 2011 16:09:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PdqtX-0006gp-Ld for qemu-devel@nongnu.org; Fri, 14 Jan 2011 16:09:16 -0500 Received: from e34.co.us.ibm.com ([32.97.110.152]:55464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PdqtX-0006gC-G2 for qemu-devel@nongnu.org; Fri, 14 Jan 2011 16:09:15 -0500 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e34.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p0EKvuFs019261 for ; Fri, 14 Jan 2011 13:57:56 -0700 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p0EL8qhE157472 for ; Fri, 14 Jan 2011 14:08:52 -0700 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p0EL8p3M012489 for ; Fri, 14 Jan 2011 14:08:52 -0700 Date: Fri, 14 Jan 2011 15:06:11 -0600 From: Ryan Harper Subject: Re: [Qemu-devel] [PATCH 2/3] block: tell drivers about an image resize Message-ID: <20110114210611.GI6249@us.ibm.com> References: <20110114162044.GA19114@lst.de> <20110114162104.GB19184@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110114162104.GB19184@lst.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org * Christoph Hellwig [2011-01-14 10:27]: > Add a new size_changed flag in the BlockDriverState and call the > change_cb callback to notify drivers about a size change. > > Signed-off-by: Christoph Hellwig > > Index: qemu/block.c > =================================================================== > --- qemu.orig/block.c 2011-01-14 17:05:49.527003363 +0100 > +++ qemu/block.c 2011-01-14 17:07:23.206255143 +0100 > @@ -1135,6 +1135,10 @@ int bdrv_truncate(BlockDriverState *bs, > ret = drv->bdrv_truncate(bs, offset); > if (ret == 0) { > ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS); > + if (bs->change_cb) { > + bs->size_changed = 1; > + bs->change_cb(bs->change_opaque); > + } Do we want to check to ensure the size_changed flag isn't set before doing a second resize event? I'm wondering if the truncate takes $longtime and user gets impatient and issues a second resize command. How should we respond? Ignore it? queue it up? Is there any other path that invokes bdrv_truncate? If so, do we want invoke the call back in those scenarios or only if the truncate is initiated from the monitor invocation? > } > return ret; > } > Index: qemu/block_int.h > =================================================================== > --- qemu.orig/block_int.h 2011-01-14 17:05:49.537004411 +0100 > +++ qemu/block_int.h 2011-01-14 17:06:02.539004271 +0100 > @@ -167,6 +167,7 @@ struct BlockDriverState { > char backing_format[16]; /* if non-zero and backing_file exists */ > int is_temporary; > int media_changed; > + int size_changed; > > BlockDriverState *backing_hd; > BlockDriverState *file; -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx ryanh@us.ibm.com