From: Kevin Wolf <kwolf@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: den@openvz.org, jsnow@redhat.com, qemu-devel@nongnu.org,
qemu-block@nongnu.org, mreitz@redhat.com
Subject: Re: [PATCH RFC 0/3] block: drop inherits_from
Date: Thu, 11 Mar 2021 18:09:46 +0100 [thread overview]
Message-ID: <20210311170946.GG9008@merkur.fritz.box> (raw)
In-Reply-To: <20210311151505.206534-1-vsementsov@virtuozzo.com>
Am 11.03.2021 um 16:15 hat Vladimir Sementsov-Ogievskiy geschrieben:
> Hi all!
>
> I now work on v3 for "block: update graph permissions update", and I'm
> at "[PATCH v2 28/36] block: add bdrv_set_backing_noperm() transaction
> action".
>
> So, the problem is we should handle inherits_from carefully, and most
> probably it should be updated in bdrv_replace_child_noperm().. And
> then, bdrv_replace_child_noperm will become a transaction action,
> which should store old inherits_from to the transaction state for
> possible rollback.. Or something like this, I didn't try yet. I just
> thought, may be we can just drop inherits_from?
>
> I decided to learn the thing a bit, and found that the only usage of
> inherits_from is to limit reopen process. When adding bs to
> reopen_queue we do add its children recursively, but only those which
> inherits from the bs.
>
> That works so starting from
>
> commit 67251a311371c4d22e803f151f47fe817175b6c3
> Author: Kevin Wolf <kwolf@redhat.com>
> Date: Thu Apr 9 18:54:04 2015 +0200
>
> block: Fix reopen flag inheritance
>
>
> The commit made two things:
>
> 1. reopen recursively all* children, not only .file. That's OK.
>
> 2. * : not all, but only that inherits_from bs.
>
> [2] Means that we don't reopen some implicitely created children..
> And, I want to ask, why?
The reason is the difference between
-drive if=none,file=test.qcow2
and something like
-blockdev file,filename=backing.img,node-name=backing
-blockdev file,filename=test.qcow2,node-name=file
-blockdev qcow2,file=file,backing=backing
The former means that bs->file and bs->backing inherit options from the
qcow2 layer. If you reopen the qcow2 layer to set cache.direct=on, both
children inherit the same update and both the file itself and the
backing file will use O_DIRECT - this is the same as would happen if you
had set cache.direct=on in the -drive option from the start.
In the -blockdev case, the nodes were defined explicitly without
inheriting from the qcow2 layer. Setting cache.direct=on on the qcow2
layer (which is actually created last) doesn't influence the two file
layers. So a reopen of the qcow2 layer shouldn't change the two file
nodes either: If they didn't inherit the option during bdrv_open(), they
certainly shouldn't inherit it during bdrv_reopen() either.
> For me it seems that if we have reopen process.. And bs involved. And
> it has a child.. And child role defines how that child should inherit
> options.. Why not to just inherit them?
The -blockdev behaviour makes things a lot more predictable for a
management tool for which we know that it can handle things on the node
level.
So what we really want is not inheriting at all. But compatibility with
-drive doesn't let us. (And actually -blockdev with inline declaration
of children behaves the same as -drive, which may have been a mistake.)
Kevin
next prev parent reply other threads:[~2021-03-11 17:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-11 15:15 [PATCH RFC 0/3] block: drop inherits_from Vladimir Sementsov-Ogievskiy
2021-03-11 15:15 ` [PATCH 1/3] block/commit: keep reference on commit_top_bs Vladimir Sementsov-Ogievskiy
2021-03-11 15:15 ` [PATCH 2/3] block: allow filters to be reopened without .bdrv_reopen_prepare Vladimir Sementsov-Ogievskiy
2021-03-11 15:15 ` [PATCH 3/3] block: drop inherits_from logic Vladimir Sementsov-Ogievskiy
2021-03-11 17:09 ` Kevin Wolf [this message]
2021-03-11 17:28 ` [PATCH RFC 0/3] block: drop inherits_from 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=20210311170946.GG9008@merkur.fritz.box \
--to=kwolf@redhat.com \
--cc=den@openvz.org \
--cc=jsnow@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--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 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).