All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com,
	kwolf@redhat.com, mreitz@redhat.com, armbru@redhat.com,
	jsnow@redhat.com, eblake@redhat.com, den@openvz.org
Subject: Re: [PATCH v12 06/14] copy-on-read: pass bottom node name to COR driver
Date: Fri, 23 Oct 2020 18:31:54 +0300	[thread overview]
Message-ID: <96d5d3b8-8334-3900-7085-6fd7aeb8190b@virtuozzo.com> (raw)
In-Reply-To: <5cb6baa3-3035-9b50-3e45-a2a48bc8fdd6@virtuozzo.com>


On 23.10.2020 17:45, Vladimir Sementsov-Ogievskiy wrote:
> 22.10.2020 21:13, Andrey Shinkevich wrote:
>> We are going to use the COR-filter for a block-stream job.
>> To limit COR operations by the base node in the backing chain during
>> stream job, pass the bottom node name, that is the first non-filter
>> overlay of the base, to the copy-on-read driver as the base node itself
>> may change due to possible concurrent jobs.
>> The rest of the functionality will be implemented in the patch that
>> follows.
>>
>> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>> ---
>>   block/copy-on-read.c | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
>> diff --git a/block/copy-on-read.c b/block/copy-on-read.c
>> index 618c4c4..3d8e4db 100644
>> --- a/block/copy-on-read.c
>> +++ b/block/copy-on-read.c
>> @@ -24,18 +24,24 @@
>>   #include "block/block_int.h"
>>   #include "qemu/module.h"
>>   #include "qapi/error.h"
>> +#include "qapi/qmp/qerror.h"
>> +#include "qapi/qmp/qdict.h"
>>   #include "block/copy-on-read.h"
>>   typedef struct BDRVStateCOR {
>>       bool active;
>> +    BlockDriverState *bottom_bs;
>>   } BDRVStateCOR;
>>   static int cor_open(BlockDriverState *bs, QDict *options, int flags,
>>                       Error **errp)
>>   {
>> +    BlockDriverState *bottom_bs = NULL;
>>       BDRVStateCOR *state = bs->opaque;
>> +    /* Find a bottom node name, if any */
>> +    const char *bottom_node = qdict_get_try_str(options, "bottom");
>>       bs->file = bdrv_open_child(NULL, options, "file", bs, 
>> &child_of_bds,
>>                                  BDRV_CHILD_FILTERED | 
>> BDRV_CHILD_PRIMARY,
>> @@ -51,7 +57,17 @@ static int cor_open(BlockDriverState *bs, QDict 
>> *options, int flags,
>>           ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) &
>>               bs->file->bs->supported_zero_flags);
>> +    if (bottom_node) {
>> +        bottom_bs = bdrv_lookup_bs(NULL, bottom_node, errp);
>> +        if (!bottom_bs) {
>> +            error_setg(errp, QERR_BASE_NOT_FOUND, bottom_node);
> 
> QERR_BASE_NOT_FOUND is unrelated here. Also, I see a comment in qerror.h 
> that such macros should not be used in new code. And don't forget to 
> drop qerror.h include line.
> 

I have been surprized because I don't have it in my branch and instead I do:
error_setg(errp, "Bottom node '%s' not found", bottom_node);

>> +            qdict_del(options, "bottom");
> 
> this may be moved above "bottom_bs = ..", to not call it after "if" in 
> separate.
> 

Please, see the "Re: [PATCH v11 04/13] copy-on-read: pass overlay base 
node name to COR driver".

>> +            return -EINVAL;
>> +        }
>> +        qdict_del(options, "bottom");
>> +    }
>>       state->active = true;
>> +    state->bottom_bs = bottom_bs;
>>       /*
>>        * We don't need to call bdrv_child_refresh_perms() now as the 
>> permissions
>>
> 
> 


  reply	other threads:[~2020-10-23 16:19 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 18:13 [PATCH v12 00/14] Apply COR-filter to the block-stream permanently Andrey Shinkevich via
2020-10-22 18:13 ` [PATCH v12 01/14] copy-on-read: support preadv/pwritev_part functions Andrey Shinkevich via
2020-10-22 18:13 ` [PATCH v12 02/14] block: add insert/remove node functions Andrey Shinkevich via
2020-10-23 14:24   ` Vladimir Sementsov-Ogievskiy
2020-10-23 14:32     ` Vladimir Sementsov-Ogievskiy
2020-10-22 18:13 ` [PATCH v12 03/14] copy-on-read: add filter drop function Andrey Shinkevich via
2020-10-23 14:32   ` Vladimir Sementsov-Ogievskiy
2020-10-22 18:13 ` [PATCH v12 04/14] qapi: add filter-node-name to block-stream Andrey Shinkevich via
2020-10-22 18:13 ` [PATCH v12 05/14] qapi: create BlockdevOptionsCor structure for COR driver Andrey Shinkevich via
2020-10-23 14:51   ` Vladimir Sementsov-Ogievskiy
2020-10-22 18:13 ` [PATCH v12 06/14] copy-on-read: pass bottom node name to " Andrey Shinkevich via
2020-10-23 14:45   ` Vladimir Sementsov-Ogievskiy
2020-10-23 15:31     ` Andrey Shinkevich [this message]
2020-10-23 16:01       ` Vladimir Sementsov-Ogievskiy
2020-10-22 18:13 ` [PATCH v12 07/14] copy-on-read: limit COR operations to bottom node Andrey Shinkevich via
2020-10-23 14:59   ` Vladimir Sementsov-Ogievskiy
2020-10-22 18:13 ` [PATCH v12 08/14] iotests: add #310 to test bottom node in COR driver Andrey Shinkevich via
2020-10-27 14:23   ` Vladimir Sementsov-Ogievskiy
2020-10-22 18:13 ` [PATCH v12 09/14] block: modify the comment for BDRV_REQ_PREFETCH flag Andrey Shinkevich via
2020-10-27 14:44   ` Vladimir Sementsov-Ogievskiy
2020-10-22 18:13 ` [PATCH v12 10/14] block: include supported_read_flags into BDS structure Andrey Shinkevich via
2020-10-27 14:50   ` Vladimir Sementsov-Ogievskiy
2020-10-22 18:13 ` [PATCH v12 11/14] copy-on-read: add support for read flags to COR-filter Andrey Shinkevich via
2020-10-27 14:46   ` Vladimir Sementsov-Ogievskiy
2020-10-27 14:56     ` Vladimir Sementsov-Ogievskiy
2020-10-22 18:13 ` [PATCH v12 12/14] copy-on-read: skip non-guest reads if no copy needed Andrey Shinkevich via
2020-10-22 18:13 ` [PATCH v12 13/14] stream: skip filters when writing backing file name to QCOW2 header Andrey Shinkevich via
2020-10-27 15:09   ` Vladimir Sementsov-Ogievskiy
2020-10-27 16:01     ` Andrey Shinkevich
2020-10-27 16:21       ` Vladimir Sementsov-Ogievskiy
2020-10-27 16:42         ` Andrey Shinkevich
2020-10-27 16:44           ` Vladimir Sementsov-Ogievskiy
2020-10-22 18:13 ` [PATCH v12 14/14] block: apply COR-filter to block-stream jobs Andrey Shinkevich via
2020-10-27 16:13   ` Vladimir Sementsov-Ogievskiy
2020-10-27 17:48     ` Andrey Shinkevich
2020-10-27 17:57       ` Vladimir Sementsov-Ogievskiy
2020-10-27 18:24         ` Andrey Shinkevich
2020-12-02 18:18           ` Andrey Shinkevich
2020-12-03 19:19             ` Vladimir Sementsov-Ogievskiy

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=96d5d3b8-8334-3900-7085-6fd7aeb8190b@virtuozzo.com \
    --to=andrey.shinkevich@virtuozzo.com \
    --cc=armbru@redhat.com \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@virtuozzo.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.