From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4J9k-00066t-JU for qemu-devel@nongnu.org; Fri, 17 Jan 2014 18:49:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W4J9e-0008KW-LG for qemu-devel@nongnu.org; Fri, 17 Jan 2014 18:48:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W4J9e-0008KI-CT for qemu-devel@nongnu.org; Fri, 17 Jan 2014 18:48:50 -0500 Message-ID: <52D9C1C9.6030806@redhat.com> Date: Sat, 18 Jan 2014 00:50:33 +0100 From: Max Reitz MIME-Version: 1.0 References: <1389968119-24771-1-git-send-email-kwolf@redhat.com> <1389968119-24771-27-git-send-email-kwolf@redhat.com> In-Reply-To: <1389968119-24771-27-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 26/29] blkdebug: Make required alignment configurable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, pl@kamp.de, xiawenc@linux.vnet.ibm.com, stefanha@redhat.com On 17.01.2014 15:15, Kevin Wolf wrote: > The new 'align' option of blkdebug can be used in order to emulate > backends with a required 4k alignment on hosts which only really requir= e > 512 byte alignment. > > Signed-off-by: Kevin Wolf > --- > block/blkdebug.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) The patch itself is okay, but will have to be rebased on the=20 blkdebug/blkverify series =96 specifically, we'll need to add this new=20 option to qapi-schema.json (BlockdevOptionsBlkdebug). > diff --git a/block/blkdebug.c b/block/blkdebug.c > index ebc5f13..dc4ba46 100644 > --- a/block/blkdebug.c > +++ b/block/blkdebug.c > @@ -346,6 +346,11 @@ static QemuOptsList runtime_opts =3D { > .type =3D QEMU_OPT_STRING, > .help =3D "[internal use only, will be removed]", > }, > + { > + .name =3D "align", > + .type =3D QEMU_OPT_SIZE, > + .help =3D "Required alignment in bytes", > + }, > { /* end of list */ } > }, > }; > @@ -357,6 +362,7 @@ static int blkdebug_open(BlockDriverState *bs, QDic= t *options, int flags, > QemuOpts *opts; > Error *local_err =3D NULL; > const char *filename, *config; > + uint64_t align; > int ret; > =20 > opts =3D qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); > @@ -394,6 +400,16 @@ static int blkdebug_open(BlockDriverState *bs, QDi= ct *options, int flags, > goto fail; > } > =20 > + /* Set request alignment */ > + align =3D qemu_opt_get_size(opts, "align", bs->request_alignment); > + if (align > 0 && align < INT_MAX && !(align & (align - 1))) { Hm, I like that test to check whether align is a power of two. ;-) Max > + bs->request_alignment =3D align; > + } else { > + error_setg(errp, "Invalid alignment"); > + ret =3D -EINVAL; > + goto fail; > + } > + > ret =3D 0; > fail: > qemu_opts_del(opts);