From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlVNn-0005LR-5M for qemu-devel@nongnu.org; Tue, 26 Nov 2013 22:01:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlVNi-0007z2-J3 for qemu-devel@nongnu.org; Tue, 26 Nov 2013 22:01:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlVNi-0007yk-AW for qemu-devel@nongnu.org; Tue, 26 Nov 2013 22:01:38 -0500 Message-ID: <52956083.5000409@redhat.com> Date: Wed, 27 Nov 2013 11:01:23 +0800 From: Fam Zheng MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH v2 5/6] qcow2: implement bdrv_preallocate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao , Kevin Wolf , "Daniel P. Berrange" , Peter Lieven Cc: qemu-devel@nongnu.org On 2013=E5=B9=B411=E6=9C=8827=E6=97=A5 10:15, Hu Tao wrote: > Signed-off-by: Hu Tao > --- > block/qcow2.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/block/qcow2.c b/block/qcow2.c > index b054a01..a23fade 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -2180,6 +2180,12 @@ static int qcow2_amend_options(BlockDriverState = *bs, > return 0; > } > > +static int qcow2_preallocate(BlockDriverState *bs, int64_t offset, > + int64_t length) > +{ > + return bdrv_preallocate(bs->file, offset, length); > +} > + What's the semantics of .bdrv_preallocate? I think you should map=20 [offset, offset + length) to clusters in image file, and then forward to=20 bs->file, rather than this direct wrapper. E.g. bdrv_preallocate(qcow2_bs, 0, cluster_size) should call=20 bdrv_preallocate(qcow2_bs->file, offset_off_first_cluster, cluster_size). Fam > static QEMUOptionParameter qcow2_create_options[] =3D { > { > .name =3D BLOCK_OPT_SIZE, > @@ -2234,6 +2240,7 @@ static BlockDriver bdrv_qcow2 =3D { > .bdrv_reopen_prepare =3D qcow2_reopen_prepare, > .bdrv_create =3D qcow2_create, > .bdrv_has_zero_init =3D bdrv_has_zero_init_1, > + .bdrv_preallocate =3D qcow2_preallocate, > .bdrv_co_get_block_status =3D qcow2_co_get_block_status, > .bdrv_set_key =3D qcow2_set_key, > .bdrv_make_empty =3D qcow2_make_empty, >