[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 08/22] quorum: Store children in own structure
From: |
Max Reitz |
Subject: |
Re: [PATCH 08/22] quorum: Store children in own structure |
Date: |
Thu, 26 Sep 2019 13:07:19 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 |
On 25.09.19 15:21, Vladimir Sementsov-Ogievskiy wrote:
> 20.09.2019 18:27, Max Reitz wrote:
[...]
>> @@ -1022,8 +1028,10 @@ static void quorum_add_child(BlockDriverState *bs,
>> BlockDriverState *child_bs,
>> s->next_child_index--;
>> goto out;
>> }
>
> more context:
> assert(s->num_children <= INT_MAX / sizeof(BdrvChild *));
> if (s->num_children == INT_MAX / sizeof(BdrvChild *) ||
> s->next_child_index == UINT_MAX) {
> error_setg(errp, "Too many children");
> return;
> }
>
> here: s/BdrvChild */QuorumChild
>
>
>> - s->children = g_renew(BdrvChild *, s->children, s->num_children + 1);
>> - s->children[s->num_children++] = child;
>> + s->children = g_renew(QuorumChild, s->children, s->num_children + 1);
>> + s->children[s->num_children++] = (QuorumChild){
>> + .child = child,
>> + };
>>
>> out:
>> bdrv_drained_end(bs);
[...]
>> @@ -1059,7 +1067,7 @@ static void quorum_del_child(BlockDriverState *bs,
>> BdrvChild *child,
>> /* We can safely remove this child now */
>> memmove(&s->children[i], &s->children[i + 1],
>> (s->num_children - i - 1) * sizeof(BdrvChild *));
>
> s/BdrvChild */QuorumChild/
Damn, yes to both.
I was really hoping I didn’t mess this patch up.
Thanks.
Max
>> - s->children = g_renew(BdrvChild *, s->children, --s->num_children);
>> + s->children = g_renew(QuorumChild, s->children, --s->num_children);
>> bdrv_unref_child(bs, child);
>>
>> bdrv_drained_end(bs);
>> @@ -1100,7 +1108,7 @@ static void
>> quorum_gather_child_options(BlockDriverState *bs, QDict *target,
>>
>> for (i = 0; i < s->num_children; i++) {
>> qlist_append(children_list,
>> - qobject_ref(s->children[i]->bs->full_open_options));
>> +
>> qobject_ref(s->children[i].child->bs->full_open_options));
>> }
>> }
>>
>>
>
> with my suggestions:
> Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
>
signature.asc
Description: OpenPGP digital signature
- Re: [PATCH 07/22] blkverify: Implement .bdrv_recurse_can_replace(), (continued)
- [PATCH 09/22] quorum: Add QuorumChild.to_be_replaced, Max Reitz, 2019/09/20
- [PATCH 06/22] block: Add bdrv_recurse_can_replace(), Max Reitz, 2019/09/20
- [PATCH 08/22] quorum: Store children in own structure, Max Reitz, 2019/09/20
- [PATCH 12/22] block: Remove bdrv_recurse_is_first_non_filter(), Max Reitz, 2019/09/20
- [PATCH 11/22] block: Use bdrv_recurse_can_replace(), Max Reitz, 2019/09/20
- [PATCH 14/22] quorum: Stop marking it as a filter, Max Reitz, 2019/09/20
- [PATCH 10/22] quorum: Implement .bdrv_recurse_can_replace(), Max Reitz, 2019/09/20