From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4IT9-0005Bb-Qj for qemu-devel@nongnu.org; Fri, 17 Jan 2014 18:05:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W4IT4-0008Ra-0A for qemu-devel@nongnu.org; Fri, 17 Jan 2014 18:04:55 -0500 Received: from paradis.irqsave.net ([62.212.105.220]:47753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4IT3-0008R4-Cq for qemu-devel@nongnu.org; Fri, 17 Jan 2014 18:04:49 -0500 Date: Fri, 17 Jan 2014 23:47:34 +0100 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140117224734.GC7739@irqsave.net> References: <1389968119-24771-1-git-send-email-kwolf@redhat.com> <1389968119-24771-4-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1389968119-24771-4-git-send-email-kwolf@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 03/29] block: Update BlockLimits when they might have changed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: pl@kamp.de, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, xiawenc@linux.vnet.ibm.com Le Friday 17 Jan 2014 =E0 15:14:53 (+0100), Kevin Wolf a =E9crit : > When reopening with different flags, or when backing files disappear > from the chain, the limits may change. Make sure they get updated in > these cases. >=20 > Signed-off-by: Kevin Wolf > Reviewed-by: Wenchao Xia > Reviewed-by: Max Reitz > --- > block.c | 5 ++++- > block/stream.c | 2 ++ > include/block/block.h | 1 + > 3 files changed, 7 insertions(+), 1 deletion(-) >=20 > diff --git a/block.c b/block.c > index 20f85cb..9a8562d 100644 > --- a/block.c > +++ b/block.c > @@ -479,7 +479,7 @@ int bdrv_create_file(const char* filename, QEMUOpti= onParameter *options, > return ret; > } > =20 > -static int bdrv_refresh_limits(BlockDriverState *bs) > +int bdrv_refresh_limits(BlockDriverState *bs) > { > BlockDriver *drv =3D bs->drv; > =20 > @@ -1464,6 +1464,8 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_s= tate) > reopen_state->bs->enable_write_cache =3D !!(reopen_state->flags & > BDRV_O_CACHE_WB); > reopen_state->bs->read_only =3D !(reopen_state->flags & BDRV_O_RDW= R); > + > + bdrv_refresh_limits(reopen_state->bs); > } > =20 > /* > @@ -2261,6 +2263,7 @@ int bdrv_drop_intermediate(BlockDriverState *acti= ve, BlockDriverState *top, > } > new_top_bs->backing_hd =3D base_bs; > =20 > + bdrv_refresh_limits(new_top_bs); > =20 > QSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry= , next) { > /* so that bdrv_close() does not recursively close the chain *= / > diff --git a/block/stream.c b/block/stream.c > index 46bec7d..dd0b4ac 100644 > --- a/block/stream.c > +++ b/block/stream.c > @@ -75,6 +75,8 @@ static void close_unused_images(BlockDriverState *top= , BlockDriverState *base, > unused->backing_hd =3D NULL; > bdrv_unref(unused); > } > + > + bdrv_refresh_limits(top); > } > =20 > static void coroutine_fn stream_run(void *opaque) > diff --git a/include/block/block.h b/include/block/block.h > index 36efaea..64fb319 100644 > --- a/include/block/block.h > +++ b/include/block/block.h > @@ -249,6 +249,7 @@ int bdrv_truncate(BlockDriverState *bs, int64_t off= set); > int64_t bdrv_getlength(BlockDriverState *bs); > int64_t bdrv_get_allocated_file_size(BlockDriverState *bs); > void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr)= ; > +int bdrv_refresh_limits(BlockDriverState *bs); > int bdrv_commit(BlockDriverState *bs); > int bdrv_commit_all(void); > int bdrv_change_backing_file(BlockDriverState *bs, > --=20 > 1.8.1.4 >=20 Reviewed-by: Beno=EEt Canet >=20