[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v13 2/3] quorum: implement bdrv_add_child() and
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [PATCH v13 2/3] quorum: implement bdrv_add_child() and bdrv_del_child() |
Date: |
Mon, 9 May 2016 18:50:44 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 |
On 09.05.2016 17:52, Alberto Garcia wrote:
> On Wed 13 Apr 2016 10:33:08 AM CEST, Changlong Xie wrote:
[...]
>> + /* We can safely remove this child now */
>> + memmove(&s->children[i], &s->children[i + 1],
>> + (s->num_children - i - 1) * sizeof(BdrvChild *));
>> + s->children = g_renew(BdrvChild *, s->children, --s->num_children);
>> + bdrv_unref_child(bs, child);
>
> Question: do we want to decrement last_index if 'i' is the last
> children? Something like:
I think it's better to keep it consistent. It probably wouldn't hurt to
do this, but I don't see any real benefit and on the other hand it looks
a bit strange (to the user) to special-case replacement of the last child.
Max
> if (i == s->num_children - 1) {
> s->last_index--;
> } else {
> memmove(...)
> }
> s->children = g_renew(...)
>
> Berto
>
signature.asc
Description: OpenPGP digital signature