qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v2] block/backup-top: fix flags handling
Date: Thu, 6 Feb 2020 19:46:55 +0300	[thread overview]
Message-ID: <19ba1ec7-a865-a1cb-b46c-96c15c2ddf40@virtuozzo.com> (raw)
In-Reply-To: <05f70af6-83f9-c51f-74f3-bbbe4675e411@redhat.com>

06.02.2020 19:31, Max Reitz wrote:
> On 03.02.20 14:42, Vladimir Sementsov-Ogievskiy wrote:
>> backup-top "supports" write-unchanged, by skipping CBW operation in
>> backup_top_co_pwritev. But it forgets to do the same in
>> backup_top_co_pwrite_zeroes, as well as declare support for
>> BDRV_REQ_WRITE_UNCHANGED.
>>
>> Fix this, and, while being here, declare also support for flags
>> supported by source child.
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>
>> v2: restrict flags propagation like it is done in other filters [Eric]
>>      move state variable initialization to the top
>>
>>   block/backup-top.c | 32 ++++++++++++++++++++------------
>>   1 file changed, 20 insertions(+), 12 deletions(-)
>>
>> diff --git a/block/backup-top.c b/block/backup-top.c
>> index 9aed2eb4c0..a4cec60859 100644
>> --- a/block/backup-top.c
>> +++ b/block/backup-top.c
> 
> 
> [...]
> 
>> @@ -186,17 +190,21 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState *source,
>>                                            Error **errp)
>>   {
>>       Error *local_err = NULL;
>> -    BDRVBackupTopState *state;
>>       BlockDriverState *top = bdrv_new_open_driver(&bdrv_backup_top_filter,
>>                                                    filter_node_name,
>>                                                    BDRV_O_RDWR, errp);
>> +    BDRVBackupTopState *state = top->opaque;
>>   
>>       if (!top) {
>>           return NULL;
>>       }
> 
> If top can be NULL, then we shouldn’t dereference it before (with
> state = top->opaque).

Oh yes.

> 
> (Pulling up the initialization of @state is also unrelated to this
> patch, I don’t exactly know why you’re doing it here.)
> 

I just though, that it is small good style enhancement, but it isn't :)

Let's keep state variable handling as it was.

-- 
Best regards,
Vladimir


      reply	other threads:[~2020-02-06 16:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03 13:42 [PATCH v2] block/backup-top: fix flags handling Vladimir Sementsov-Ogievskiy
2020-02-03 15:42 ` Eric Blake
2020-02-03 18:20   ` Vladimir Sementsov-Ogievskiy
2020-02-06 16:31 ` Max Reitz
2020-02-06 16:46   ` Vladimir Sementsov-Ogievskiy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19ba1ec7-a865-a1cb-b46c-96c15c2ddf40@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).