All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Alberto Garcia <berto@igalia.com>,
	Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"qemu-block@nongnu.org" <qemu-block@nongnu.org>
Cc: "kwolf@redhat.com" <kwolf@redhat.com>,
	"jcody@redhat.com" <jcody@redhat.com>,
	"mreitz@redhat.com" <mreitz@redhat.com>,
	Denis Lunev <den@virtuozzo.com>
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH RFC 1/1] Stream block job involves copy-on-read filter
Date: Mon, 11 Feb 2019 14:51:33 +0000	[thread overview]
Message-ID: <6b3c82fb-b4a2-7802-1737-a34e22130114@virtuozzo.com> (raw)
In-Reply-To: <w51sgwuv2ok.fsf@maestria.local.igalia.com>

11.02.2019 17:07, Alberto Garcia wrote:
> On Fri 08 Feb 2019 04:29:48 PM CET, Andrey Shinkevich wrote:
>> On 08/02/2019 16:13, Alberto Garcia wrote:
>>> On Wed 23 Jan 2019 12:54:24 PM CET, Andrey Shinkevich wrote:
>>>> +static BlockDriverState *insert_filter(BlockDriverState *bs, Error **errp)
>>>> +{
>>>> +    BlockDriverState *cor_filter_bs;
>>>> +    Error *local_err = NULL;
>>>> +
>>>> +    cor_filter_bs = create_filter_node(bs, errp);
>>>> +    if (cor_filter_bs == NULL) {
>>>> +        error_prepend(errp, "Could not create filter node: ");
>>>> +        return NULL;
>>>> +    }
>>>> +
>>>> +    bdrv_set_aio_context(cor_filter_bs, bdrv_get_aio_context(bs));
>>>> +
>>>> +    bdrv_drained_begin(bs);
>>>> +    bdrv_replace_node(bs, cor_filter_bs, &local_err);
>>>> +    bdrv_drained_end(bs);
>>>
>>> I think this was already discussed in the previous version of this
>>> patch: if you insert a copy-on-read filter here then all guest reads
>>> will copy the data from the backing chain, but you don't want to copy
>>> anything below the 'base' node, so the copy-on-read filter needs a
>>> 'base' parameter.
>>>
>> Before that, we still have the unresolved issue with getting the
>> filter as the 'base' input parameter. That happens sometimes because
>> the base is being searched by the file name, which is the same to the
>> one of the filter, rather than by the node name (!)
> 
> I'm not sure if I understand. block-stream has 'base' and 'base-node'
> parameters, and in the first case you would convert the file name to a
> node name.
> 
> stream_start() gets the BlockDriverState, not the file name, so why
> can't you get the node name from there and pass it to the copy-on-read
> filter?
> 
> Berto
> 

The problem is in  the concept of "base" node. The code written in manner
that base is not changed during block job. However, job don't own base and
there is no guarantee that it will not change during the job. Moreover,
when we create a filter above top node, starting several stream jobs to
nearby regions of nodes in common backing chain it leads exatly to this
situation: during the job an unrelated filter may be inserted between
our bottom-intermediate-node and base-node. Or, contra-wise, we can start
with base on some filter, which is removed during our job.

So, my suggestion is:
1. calculate bottome-intermediate-node as soon as possible, at the very
    beginning of qmp-command handling, before any context switch.
2. don't keep link to base-node in job, and operate relatively to
    bottom-intermediate-node
3. and this leads to implementation of block_status() function which will
    take bottom-node parameter instead of base, and may be other similar
    things.


-- 
Best regards,
Vladimir

  reply	other threads:[~2019-02-11 14:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 11:54 [Qemu-devel] [PATCH RFC 1/1] Stream block job involves copy-on-read filter Andrey Shinkevich
2019-01-23 13:10 ` Vladimir Sementsov-Ogievskiy
2019-01-31 14:02 ` Andrey Shinkevich
2019-02-08 13:13 ` [Qemu-devel] [Qemu-block] " Alberto Garcia
2019-02-08 15:29   ` Andrey Shinkevich
2019-02-11 14:07     ` Alberto Garcia
2019-02-11 14:51       ` Vladimir Sementsov-Ogievskiy [this message]
2019-02-11 15:52         ` Alberto Garcia
2019-02-11 16:58           ` Vladimir Sementsov-Ogievskiy
2019-02-12 11:35             ` Alberto Garcia
2019-02-14 13:43               ` Andrey Shinkevich
2019-02-18 10:08                 ` Vladimir Sementsov-Ogievskiy
2019-02-20  9:10                   ` Andrey Shinkevich
2019-02-11 14:54       ` Andrey Shinkevich

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=6b3c82fb-b4a2-7802-1737-a34e22130114@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=andrey.shinkevich@virtuozzo.com \
    --cc=berto@igalia.com \
    --cc=den@virtuozzo.com \
    --cc=jcody@redhat.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 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.