From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2S7r-0001eW-7S for qemu-devel@nongnu.org; Tue, 09 Jun 2015 18:36:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2S7q-0007Jg-3V for qemu-devel@nongnu.org; Tue, 09 Jun 2015 18:36:07 -0400 Message-ID: <55776A49.3000705@redhat.com> Date: Tue, 09 Jun 2015 16:35:53 -0600 From: Eric Blake MIME-Version: 1.0 References: <1433641131-24123-1-git-send-email-eblake@redhat.com> In-Reply-To: <1433641131-24123-1-git-send-email-eblake@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="OJwc9RLVeBer9Un4HU0qskpcbW90xpMbF" 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: qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: kwolf@redhat.com, fromani@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --OJwc9RLVeBer9Un4HU0qskpcbW90xpMbF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/06/2015 07:38 PM, Eric Blake wrote: > 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. >=20 > Signed-off-by: Eric Blake > --- > block/write-threshold.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) >=20 > @@ -110,9 +110,8 @@ void qmp_block_set_write_threshold(const char *node= _name, > BlockDriverState *bs; > AioContext *aio_context; >=20 > - bs =3D bdrv_find_node(node_name); > + bs =3D bdrv_lookup_bs(node_name, node_name, errp); Hmm, I'm not quite sure this does what I want. If I understand correctly, when you open a qcow2 image, you get the following query-block layout (abbreviated): "inserted": { =2E.. "image": { =2E.. "backing-filename-format": "qcow2", "virtual-size": 12884901888, "filename": "/dev/sda6", "cluster-size": 65536, "format": "qcow2", "actual-size": 0, =2E.. "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, =2E.. "file": "/dev/sda6", That is, the only write_threshold reported is that of the active layer BDS (write_threshold of other BDS is reported through query-named-block-nodes, but only if those BDS have a name), but query-block is not listing any secondary BDS details. Meanwhile, here is the corresponding query-blockstats layout: "device": "drive-virtio-disk0", "parent": { "stats": { "flush_total_time_ns": 0, "wr_highest_offset": 72482304, =2E.. "stats": { "flush_total_time_ns": 728455560, "wr_highest_offset": 9129332224, which DOES show the BDS chain; in particular, each qcow2 file has two BDS (one for the protocol, and the other ('parent') for the actual file).= The statistic I'm interested in is the allocation of the block device (the host offset, aka wr_highest_offset 72482304 above), and NOT the usage pattern of the guest (the qcow2 protocol, wr_highest_offset 9129332224). But bdrv_lookup_bs() finds the qcow2 protocol layer, rather than the intended backing file layer; likewise, query-block is only reporting write_threshold for the protocol layer. I'm wondering if, when a device name is given rather than a node name, it is safe to blindly follow the active layer down to its lowest member (or error out if there are more than one lower members, as in quorum), as that is the statistic that libvirt and upper layers really want ("am I about to exceed the allocation of my underlying storage?"). Likewise, on reporting, it is more useful to know the threshold of the backing layer if the qcow2 protocol layer does not have a threshold. I'm playing with that idea before submitting a v2. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --OJwc9RLVeBer9Un4HU0qskpcbW90xpMbF 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/ iQEcBAEBCAAGBQJVd2pJAAoJEKeha0olJ0NqPF4H/3G1RiRbq85NOF5b5v/bp4ub AD8bChVIyG42CsP6L5SxVUH5E38WjQkDc4yiDPgY9NFFc1pEZWCMWafpBREXeG1B 76k4B47yoEWTgFoqNWphgUj1oIi5Nn2UFprnJTsSN2rMa/a3F2YAYVlIC7w1y9tG ktvGwyEiLcqEVZuyt8wwsHqlCsxzaP9Bdup+BZ+Nh0FCuypQl9zORrqdO56lnIIB iPlMi5ItGaoIKj1YfWUAUAxVo0bYZnAVEOJENLHiT+49ZQN4bNSmBUJnGetzo8Yt SmF8LlHHHO1M4krr+63431tKYs6UfEKDcALaNJuXzgIbeJ4bIg8rj3Ri5kPymLw= =AzaH -----END PGP SIGNATURE----- --OJwc9RLVeBer9Un4HU0qskpcbW90xpMbF--