qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/9] block: Add COR filter driver


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH v2 1/9] block: Add COR filter driver
Date: Wed, 25 Apr 2018 13:18:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0

On 2018-04-24 17:08, Alberto Garcia wrote:
> On Sat 21 Apr 2018 03:29:21 PM CEST, Max Reitz wrote:
>> This adds a simple copy-on-read filter driver.  It relies on the already
>> existing COR functionality in the central block layer code, which may be
>> moved here once we no longer need it there.
>>
>> Signed-off-by: Max Reitz <address@hidden>
> 
> 
>> +#define PERM_PASSTHROUGH (BLK_PERM_CONSISTENT_READ \
>> +                          | BLK_PERM_WRITE \
>> +                          | BLK_PERM_RESIZE)
>> +#define PERM_UNCHANGED (BLK_PERM_ALL & ~PERM_PASSTHROUGH)
>> +
>> +static void cor_child_perm(BlockDriverState *bs, BdrvChild *c,
>> +                           const BdrvChildRole *role,
>> +                           BlockReopenQueue *reopen_queue,
>> +                           uint64_t perm, uint64_t shared,
>> +                           uint64_t *nperm, uint64_t *nshared)
>> +{
>> +    if (c == NULL) {
>> +        *nperm = (perm & PERM_PASSTHROUGH) | BLK_PERM_WRITE_UNCHANGED;
>> +        *nshared = (shared & PERM_PASSTHROUGH) | PERM_UNCHANGED;
>> +        return;
>> +    }
>> +
>> +    *nperm = (perm & PERM_PASSTHROUGH) |
>> +             (c->perm & PERM_UNCHANGED);
> 
> I admit I'm not completely familiar with this, but don't you need to add
> BLK_PERM_WRITE_UNCHANGED to *nperm ?

As long as it's requested in when the child is attached (which it is in
the "c == NULL" case), it should be part of c->perm then.

(And since PERM_PASSTHROUGH does not contain WRITE_UNCHANGED, it is part
of PERM_UNCHANGED.)

Max

>> +    *nshared = (shared & PERM_PASSTHROUGH) |
>> +               (c->shared_perm & PERM_UNCHANGED);
>> +}
> 
> Berto
> 


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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