From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2hOE-0003db-Kh for qemu-devel@nongnu.org; Wed, 10 Jun 2015 10:54:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2hOD-0007J8-DJ for qemu-devel@nongnu.org; Wed, 10 Jun 2015 10:54:02 -0400 Message-ID: <55784F7C.1060702@redhat.com> Date: Wed, 10 Jun 2015 08:53:48 -0600 From: Eric Blake MIME-Version: 1.0 References: <1433641131-24123-1-git-send-email-eblake@redhat.com> <55776A49.3000705@redhat.com> <20150610075729.GB4899@noname.str.redhat.com> <557836A5.4070407@redhat.com> <20150610134306.GF4899@noname.str.redhat.com> In-Reply-To: <20150610134306.GF4899@noname.str.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pqDA4IV6uVkoQ9CllogpvUHLs9NjeGnb0" Subject: Re: [Qemu-devel] [PATCH] block: allow write-threshold on device name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: fromani@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --pqDA4IV6uVkoQ9CllogpvUHLs9NjeGnb0 Content-Type: multipart/mixed; boundary="------------030803060003090406040405" This is a multi-part message in MIME format. --------------030803060003090406040405 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/10/2015 07:43 AM, Kevin Wolf wrote: >=20 >>> Let's stay away from such magic, as much as we can. libvirt can just >>> specify a node-name for the protocol layer and use that. >> >> Okay, I'll probably abandon this patch, then, but still work on >> something to make node names easier for libvirt to integrate with. >=20 > Hm, okay. I would find it nice to accept device names everywhere where = a > node name is expected (just for aesthetic reasons), but I see that it > would probably remain unused, so abandoning the patch is okay with me. For the record, here's the state of the patch that I reached before this email, which includes documentation and proper device name output - but the way I implemented it was is a semantic change; so all the more reason to require node names only for this interface (and avoid the semantic change). The commit message body is not quite accurate (now that I've learned more, the active BDS of the device is NOT the node that libvirt wants, so adding device semantics did not help libvirt), so much as capturing the state of the patch before I abandon it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------030803060003090406040405 Content-Type: text/x-patch; name="v2-0001-block-allow-write-threshold-on-device-name.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0001-block-allow-write-threshold-on-device-name.patch" =46rom 4f2f9838fbe7b06e8703b57f4b2559295b435964 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Sat, 6 Jun 2015 16:00:26 -0600 Subject: [PATCH v2] block: allow write-threshold on device name Commit e2462113 allowed the ability to fire an event if a BDS node exceeds a threshold during a write, but limited the option to only work on node names. For convenience, expand this to allow a device name as a way to set the threshold on the BDS at the active layer of the device. Previously, it was not possible to set a threshold without a node name, so the event was only ever reported on a BDS with a node name, even when that node was the active layer of a device. Now, it is possible that an event can occur on a device whose active BDS does not have a node name; but a name must still be reported. I found it easier to always report a device name, when one is available, which causes a slight change in behavior when node names are in use (the event now reports the device name rather than the node name of the active BDS); but as the two namespaces cannot overlap, the result is still unambiguous. Besides, the new semantics makes libvirt's life easier for as long as libvirt does not yet use node names, so I don't think it will hurt. Signed-off-by: Eric Blake --- v2: Update docs, and report device name when available. --- block/write-threshold.c | 7 +++---- qapi/block-core.json | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/block/write-threshold.c b/block/write-threshold.c index a53c1f5..0082086 100644 --- a/block/write-threshold.c +++ b/block/write-threshold.c @@ -1,7 +1,7 @@ /* * QEMU System Emulator block write threshold notification * - * Copyright Red Hat, Inc. 2014 + * Copyright Red Hat, Inc. 2014, 2015 * * Authors: * Francesco Romani @@ -60,7 +60,7 @@ static int coroutine_fn before_write_notify(NotifierWit= hReturn *notifier, amount =3D bdrv_write_threshold_exceeded(bs, req); if (amount > 0) { qapi_event_send_block_write_threshold( - bs->node_name, + bdrv_get_device_or_node_name(bs), amount, bs->write_threshold_offset, &error_abort); @@ -110,9 +110,8 @@ void qmp_block_set_write_threshold(const char *node_n= ame, BlockDriverState *bs; AioContext *aio_context; - bs =3D bdrv_find_node(node_name); + bs =3D bdrv_lookup_bs(node_name, node_name, errp); if (!bs) { - error_setg(errp, "Device '%s' not found", node_name); return; } diff --git a/qapi/block-core.json b/qapi/block-core.json index 8411d4f..e1b48fe 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2042,9 +2042,9 @@ # means the device should be extended to avoid pausing for # disk exhaustion. # The event is one shot. Once triggered, it needs to be -# re-registered with another block-set-threshold command. +# re-registered with another block-set-write-threshold command. # -# @node-name: graph node name on which the threshold was exceeded. +# @node-name: device or graph node name on which the threshold was excee= ded. # # @amount-exceeded: amount of data which exceeded the threshold, in byte= s. # @@ -2065,7 +2065,7 @@ # This is useful to transparently resize thin-provisioned drives without= # the guest OS noticing. # -# @node-name: graph node name on which the threshold must be set. +# @node-name: device or graph node name on which the threshold must be s= et. # # @write-threshold: configured threshold for the block device, bytes. # Use 0 to disable the threshold. --=20 2.4.2 --------------030803060003090406040405-- --pqDA4IV6uVkoQ9CllogpvUHLs9NjeGnb0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVeE98AAoJEKeha0olJ0NqFucH/2WpfviEmTutvuo/tNjYUMBw tn9LoML2UUb0qXMr+ekKYQQLDCOOniMyIkAYYZPAYCMzn+4R/pg7QiDc1gB/WeCr qyTn9b/LOcvpAvilwOyNZc4GXj0NfBbmCn4N1kl7+YHLx0EfwvEif7dmpt1GTmVG 9Yhz+6n6lXU2M1W9nRmqhbjlM5KxQ/9rif8SW+sp+msVkuOnK19jzQ3h0d5bfWvE zifWp5JeJZNm+Us1+H4MS7HL8Go2FuIDImXqLnbDDdjrstG3n8Kdk5VVUz/AoNnw B0RNnD6RDRBFvl5XfkptfihH9z6KobMlMxvhzJtZ6d2WgCb/wCdh23syxSzOj/Y= =v7EC -----END PGP SIGNATURE----- --pqDA4IV6uVkoQ9CllogpvUHLs9NjeGnb0--