qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-block] [PATCH RFC v3 4/8] block: convert Throttle


From: Manos Pitsidianakis
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH RFC v3 4/8] block: convert ThrottleGroup to object with QOM
Date: Tue, 27 Jun 2017 19:12:21 +0300
User-agent: NeoMutt/20170609-57-1e93be (1.8.3)

On Tue, Jun 27, 2017 at 06:05:55PM +0200, Alberto Garcia wrote:
On Mon 26 Jun 2017 06:58:32 PM CEST, Manos Pitsidianakis wrote:
On Mon, Jun 26, 2017 at 03:52:34PM +0100, Stefan Hajnoczi wrote:
On Fri, Jun 23, 2017 at 03:46:56PM +0300, Manos Pitsidianakis wrote:
+static bool throttle_group_exists(const char *name)
+{
+    ThrottleGroup *iter;
+    bool ret = false;
+
+    qemu_mutex_lock(&throttle_groups_lock);

Not sure if this lock or the throttle_groups list are necessary.

As Manos says accesses to the throttle_groups list need to be locked.

What I don't like at first sight is the code duplication in
throttle_group_incref() and throttle_group_obj_complete().

Have you seen iothread.c:qmp_query_iothreads()?  All objects are put
into a container (the parent object), so you can just iterate over its
children.  There's no need for a separate list because QOM already has
all the objects.

I haven't looked into this yet but it could be a solution.

If throttle_groups_register_blk() uses QOM instead of calling throttle_group_incref() the duplication could be eliminated. Then all of throttle-groups.c uses QOM internally. I don't see any reason why not do this.

Berto

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]