From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLI2S-0005zL-WC for qemu-devel@nongnu.org; Wed, 05 Mar 2014 15:03:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLI2N-0004F7-1V for qemu-devel@nongnu.org; Wed, 05 Mar 2014 15:03:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:62155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLI2M-0004Em-Pt for qemu-devel@nongnu.org; Wed, 05 Mar 2014 15:03:30 -0500 Message-ID: <5317830D.9080609@redhat.com> Date: Wed, 05 Mar 2014 21:03:25 +0100 From: Max Reitz MIME-Version: 1.0 References: <1393860533-2063-1-git-send-email-mreitz@redhat.com> <1393860533-2063-5-git-send-email-mreitz@redhat.com> <20140305160908.GF1709@irqsave.net> In-Reply-To: <20140305160908.GF1709@irqsave.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 04/10] block/json: Add functions for writing zeroes etc. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-1?Q?Beno=EEt_Canet?= Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi On 05.03.2014 17:09, Beno=EEt Canet wrote: > The Monday 03 Mar 2014 =E0 16:28:47 (+0100), Max Reitz wrote : >> Add passthrough functions for bdrv_aio_discard(), >> bdrv_co_write_zeroes(), bdrv_truncate() and bdrv_has_zero_init(). >> >> Signed-off-by: Max Reitz >> --- >> block/json.c | 30 ++++++++++++++++++++++++++++++ >> 1 file changed, 30 insertions(+) >> >> diff --git a/block/json.c b/block/json.c >> index 2f885cc..a2f4691 100644 >> --- a/block/json.c >> +++ b/block/json.c >> @@ -98,6 +98,21 @@ static BlockDriverAIOCB *json_aio_flush(BlockDriver= State *bs, >> return bdrv_aio_flush(bs->file, cb, opaque); >> } >> =20 >> +static BlockDriverAIOCB *json_aio_discard(BlockDriverState *bs, >> + int64_t sector_num, int nb_= sectors, >> + BlockDriverCompletionFunc *= cb, >> + void *opaque) >> +{ >> + return bdrv_aio_discard(bs, sector_num, nb_sectors, cb, opaque); > Isn't it bs->file ? Oh, you're right, I'll fix it. Max > >> +} >> + >> +static coroutine_fn int json_co_write_zeroes(BlockDriverState *bs, >> + int64_t sector_num, int = nb_sectors, >> + BdrvRequestFlags flags) >> +{ >> + return bdrv_co_write_zeroes(bs, sector_num, nb_sectors, flags); > same > >> +} >> + >> static void json_invalidate_cache(BlockDriverState *bs) >> { >> return bdrv_invalidate_cache(bs->file); >> @@ -108,6 +123,16 @@ static int64_t json_getlength(BlockDriverState *b= s) >> return bdrv_getlength(bs->file); >> } >> =20 >> +static int json_truncate(BlockDriverState *bs, int64_t offset) >> +{ >> + return bdrv_truncate(bs->file, offset); >> +} >> + >> +static int json_has_zero_init(BlockDriverState *bs) >> +{ >> + return bdrv_has_zero_init(bs->file); >> +} >> + >> static int json_refresh_limits(BlockDriverState *bs) >> { >> bs->bl =3D bs->file->bl; >> @@ -131,12 +156,17 @@ static BlockDriver bdrv_json =3D { >> .bdrv_aio_readv =3D json_aio_readv, >> .bdrv_aio_writev =3D json_aio_writev, >> .bdrv_aio_flush =3D json_aio_flush, >> + .bdrv_aio_discard =3D json_aio_discard, >> + >> + .bdrv_co_write_zeroes =3D json_co_write_zeroes, >> =20 >> .bdrv_invalidate_cache =3D json_invalidate_cache, >> =20 >> .has_variable_length =3D true, >> .bdrv_getlength =3D json_getlength, >> + .bdrv_truncate =3D json_truncate, >> =20 >> + .bdrv_has_zero_init =3D json_has_zero_init, >> .bdrv_refresh_limits =3D json_refresh_limits, >> .bdrv_get_info =3D json_get_info, >> =20 >> --=20 >> 1.9.0 >> >>