[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/22] quorum: Add QuorumChild.to_be_replaced
From: |
Max Reitz |
Subject: |
Re: [PATCH 09/22] quorum: Add QuorumChild.to_be_replaced |
Date: |
Thu, 26 Sep 2019 13:13:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 |
On 25.09.19 15:45, Vladimir Sementsov-Ogievskiy wrote:
> 20.09.2019 18:27, Max Reitz wrote:
>> We will need this to verify that Quorum can let one of its children be
>> replaced without breaking anything else.
>>
>> Signed-off-by: Max Reitz <address@hidden>
>> ---
>> block/quorum.c | 23 +++++++++++++++++++++++
>> 1 file changed, 23 insertions(+)
>>
>> diff --git a/block/quorum.c b/block/quorum.c
>> index cf2171cc74..207054a64e 100644
>> --- a/block/quorum.c
>> +++ b/block/quorum.c
>> @@ -67,6 +67,13 @@ typedef struct QuorumVotes {
>>
>> typedef struct QuorumChild {
>> BdrvChild *child;
>> +
>> + /*
>> + * If set, check whether this node can be replaced without any
>> + * other parent noticing: Unshare CONSISTENT_READ, and take the
>> + * WRITE permission.
>> + */
>> + bool to_be_replaced;
>> } QuorumChild;
>>
>> /* the following structure holds the state of one quorum instance */
>> @@ -1128,6 +1135,16 @@ static void quorum_child_perm(BlockDriverState *bs,
>> BdrvChild *c,
>> uint64_t perm, uint64_t shared,
>> uint64_t *nperm, uint64_t *nshared)
>> {
>> + BDRVQuorumState *s = bs->opaque;
>> + int i;
>> +
>> + for (i = 0; i < s->num_children; i++) {
>> + if (s->children[i].child == c) {
>> + break;
>> + }
>> + }
>> + assert(!c || i < s->num_children);
>
> seems, the loop is useless if c == NULL.
Not wrong. I’ll put it all into an if (c) and initialize i to -1.
Max
signature.asc
Description: OpenPGP digital signature
- [PATCH 04/22] iotests: Let 041 use -blockdev for quorum children, (continued)
- [PATCH 04/22] iotests: Let 041 use -blockdev for quorum children, Max Reitz, 2019/09/20
- [PATCH 05/22] quorum: Fix child permissions, Max Reitz, 2019/09/20
- [PATCH 06/22] block: Add bdrv_recurse_can_replace(), Max Reitz, 2019/09/20
- [PATCH 09/22] quorum: Add QuorumChild.to_be_replaced, Max Reitz, 2019/09/20
- [PATCH 08/22] quorum: Store children in own structure, Max Reitz, 2019/09/20
- [PATCH 07/22] blkverify: Implement .bdrv_recurse_can_replace(), Max Reitz, 2019/09/20
- [PATCH 11/22] block: Use bdrv_recurse_can_replace(), Max Reitz, 2019/09/20
- [PATCH 13/22] mirror: Double-check immediately before replacing, Max Reitz, 2019/09/20
- [PATCH 17/22] iotests: Add VM.assert_block_path(), Max Reitz, 2019/09/20