From: Max Reitz <mreitz@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Tao Xu <tao3.xu@intel.com>,
qemu-block@nongnu.org
Subject: Re: [PATCH v3 2/2] quorum: Implement bdrv_co_pwrite_zeroes()
Date: Fri, 13 Nov 2020 17:35:54 +0100 [thread overview]
Message-ID: <9a429c8a-c053-79fa-dc7f-e8650f1cdb77@redhat.com> (raw)
In-Reply-To: <w517dqpfckl.fsf@maestria.local.igalia.com>
On 13.11.20 17:26, Alberto Garcia wrote:
> On Fri 13 Nov 2020 05:11:20 PM CET, Max Reitz wrote:
>
>>> We could set all supported_zero_flags as long as all children support
>>> them, right?
>>
>> Sure, I was just thinking that we could set these regardless of
>> whether the children support them, because (on zero-writes) the block
>> layer will figure out for us whether the child nodes support them. O:)
>
> But it can happen that one child supports e.g. BDRV_REQ_NO_FALLBACK but
> the rest don't. In this case I think the block layer should return
> -ENOTSUP earlier without writing to the child(ren) that do support that
> flag.
That’s true.
> So Quorum's supported_zero_flags would be the logical and of all of its
> children's flags, right?
Yes. (And so it would need to be recalculated whenever a child is added
or removed.)
> I'm unsure about BDRV_REQ_WRITE_UNCHANGED, many filters set that on top
> of the other flags, but when would a BDS not support this flag?
The WRITE_UNCHANGED flag is basically just a hint for the permission
system that for such a write, the WRITE_UNCHANGED permission is
sufficient. So drivers that can pass through *all* WRITE_UNCHANGED
requests as they are (i.e., filter drivers) can support this write/zero
flag and then pass that flag on. This way, they are safe not to take
the WRITE permission on their child unless their parent has taken the
WRITE permission on them.
(Otherwise, they’d also have to take the WRITE permission if the parent
only holds the WRITE_UNCHANGED permission.)
Supporting this flag doesn’t make sense for drivers that won’t be able
to pass it on all the time. For example, qcow2 generally cannot pass it
on, because it still needs to perform WRITE_UNCHANGED requests as normal
writes. (WRITE_UNCHANGED comes from copy-on-read; the data will read
the same, hence the _UNCHANGED, but it still needs to be allocated on
the receiving format layer.)
(Technically, qcow2 could figure out whether the requests it generates
from a WRITE_UNCHANGED request still result in unchanging writes in the
protocol layer, but there is no reason to. It needs the WRITE
permission anyway, because there are going to be some non-unchanging
writes it has to perform. And if it holds the WRITE permission, there
is no need to bother with the WRITE_UNCHANGED flag.)
>>> pwrite_zeroes() does this additionaly:
>>>
>>> if (!(child->bs->open_flags & BDRV_O_UNMAP)) {
>>> flags &= ~BDRV_REQ_MAY_UNMAP;
>>> }
>>
>> Interesting. Technically, Quorum doesn’t support that flag (in
>> supported_zero_flags O:))), so it shouldn’t appear, but, er, well
>> then.
>
> It would with the change that I'm proposing above.
Yes, I know. Hence the “O:)”. O:)
Max
prev parent reply other threads:[~2020-11-13 16:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 16:53 [PATCH v3 0/2] quorum: Implement bdrv_co_block_status() Alberto Garcia
2020-11-11 16:53 ` [PATCH v3 1/2] " Alberto Garcia
2020-11-13 11:36 ` Max Reitz
2020-11-11 16:53 ` [PATCH v3 2/2] quorum: Implement bdrv_co_pwrite_zeroes() Alberto Garcia
2020-11-13 11:49 ` Max Reitz
2020-11-13 16:07 ` Alberto Garcia
2020-11-13 16:11 ` Max Reitz
2020-11-13 16:26 ` Alberto Garcia
2020-11-13 16:35 ` Max Reitz [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=9a429c8a-c053-79fa-dc7f-e8650f1cdb77@redhat.com \
--to=mreitz@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=tao3.xu@intel.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).