Received: from eggs.gnu.org ([2001:4830:134:3::10]:53324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c58by-0006U7-MA for qemu-devel@nongnu.org; Fri, 11 Nov 2016 04:59:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c58bx-0000ID-Uk for qemu-devel@nongnu.org; Fri, 11 Nov 2016 04:59:06 -0500 Date: Fri, 11 Nov 2016 10:58:57 +0100 From: Kevin Wolf Message-ID: <20161111095857.GA7533@noname.redhat.com> References: <1478798349-28983-1-git-send-email-kwolf@redhat.com> <1478798349-28983-8-git-send-email-kwolf@redhat.com> <6386e9e0-3317-3d68-9ff9-d33b0a87213a@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline In-Reply-To: <6386e9e0-3317-3d68-9ff9-d33b0a87213a@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 7/8] quorum: Implement .bdrv_co_preadv/pwritev() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-block@nongnu.org, berto@igalia.com, qemu-devel@nongnu.org, mreitz@redhat.com --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 11.11.2016 um 03:37 hat Eric Blake geschrieben: > On 11/10/2016 11:19 AM, Kevin Wolf wrote: > > This enables byte granularity requests on quorum nodes. > >=20 > > Note that the QMP events emitted by the driver are an external API that > > we were careless enough to define as sector based. The offset and length > > of requests reported in events are rounded down therefore. >=20 > Would it be better to round offset down and length up? A length of 0 > looks odd. To be honest, I don't know what these events are used for and what the most useful rounding would be. Maybe Berto can tell? > Should we add more fields to the two affected events (QUORUM_FAILURE and > QUORUM_REPORT_BAD)? We have to keep the existing fields for back-compat, > but we could add new fields that give byte-based locations for > management apps smart enough to use the new instead of the old > (particularly since the old fields are named 'sector-num' and > 'sectors-count'). If there is a user for the new fields, I can do that. > > Signed-off-by: Kevin Wolf > > --- > > block/quorum.c | 75 ++++++++++++++++++++++++++------------------------= -------- > > 1 file changed, 33 insertions(+), 42 deletions(-) > >=20 >=20 > > @@ -198,14 +198,17 @@ static void quorum_report_bad(QuorumOpType type, = uint64_t sector_num, > > } > > =20 > > qapi_event_send_quorum_report_bad(type, !!msg, msg, node_name, > > - sector_num, nb_sectors, &error_a= bort); > > + offset / BDRV_SECTOR_SIZE, > > + bytes / BDRV_SECTOR_SIZE, &error= _abort); >=20 > Rounding the offset down makes sense, but rounding the bytes down can > lead to weird messages. Blindly rounding it up to a sector boundary can > also be wrong (example: writing 2 bytes at offset 511 really affects > 1024 bytes when you consider that two sectors had to undergo > read-modify-write). Don't we have a helper routine for determining the > end boundary when we have to convert an offset and length to a courser > alignment? Hm, I would have to check the header files. I don't know one off the top of my head. If you find it, let me know. > > @@ -462,8 +461,8 @@ static void GCC_FMT_ATTR(2, 3) quorum_err(QuorumAIO= CB *acb, > > va_list ap; > > =20 > > va_start(ap, fmt); > > - fprintf(stderr, "quorum: sector_num=3D%" PRId64 " nb_sectors=3D%d = ", > > - acb->sector_num, acb->nb_sectors); > > + fprintf(stderr, "quorum: offset=3D%" PRIu64 " bytes=3D%" PRIu64 " = ", > > + acb->offset, acb->bytes); >=20 > Might be worth a separate patch to get rid of fprintf and use correct > error reporting. But not the work for this patch. What would correct error reporting be in this case? A QMP event? Because other than that and stderr, I don't think we have any channels for error messages for I/O requests. We could use error_report(), but it would be effectively the same thing as fprintf(). Kevin --FCuugMFkClbJLl1L Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJYJZZhAAoJEH8JsnLIjy/WqbcP/2+ob+nlJA0cjz0bTD+oBZEz ypBPSn1ChH+WXyRvrSykjDmTvVyF3CssXc4kukHq+wez0LxbpqLC5a6jGBgMhK4Z TjxdcFXPGV0mLx5Pw4kefHdX3JLb/vpZXuXxntGaFW/1Si2qiZRuqM7i87VmZPFW Fq9KStFSblP3ntYQmL/kpbUWOeh7ETi2jWtbJGsx3c+Bmj1hzM4HRA02kT1/xfch /PMDPwzYAEPifCtG4rBqWTghyL9udurge4H7zysUuHx6D0hd8YzBkMjHOJb5Pbje zQa+NXuLU2GqUiySV/D27Jv4iPkDixmV/avZqfgJBsDqr5BJivw2badLHA1WHvno gwr19PiYZzZyZKjZxYrPCfAgYHEoArvtMxqayGmAz9DVjdMVwFyCqg2oIOtIedTl ITjRurUYWcX+orwouqrjFH66G0/u/R/vb5oAP78e/wAP++1dNOzZxwUsPvLa4Xf3 IpI31JWASWJK1BRSxCJSZYDtYPK/31T/nf9hNUdTtC0q4J1IDhAAct+4fI6lsccY ankwbzvSJKiUlGcdQyasf2aje33MSuKTwwdAmdEExdjTIeSjZR4Re1lZHLHbugbf GIFISCTgnNCZ3cR+aYrv2MvLch2hREkiRNrI/Nm98HcFpDF6bgBR/Y8b9Yd+wAGD 3m1jLZK1/W2rOLxUbKrf =cNxr -----END PGP SIGNATURE----- --FCuugMFkClbJLl1L--