All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Hanna Reitz <hreitz@redhat.com>
Cc: Emanuele Giuseppe Esposito <eesposit@redhat.com>,
	Fam Zheng <fam@euphon.net>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [RFC PATCH 0/6] Removal of Aiocontext lock and usage of subtree drains in aborted transactions
Date: Thu, 16 Dec 2021 11:37:04 +0100	[thread overview]
Message-ID: <YbsW0C2N8xUd3Lsk@redhat.com> (raw)
In-Reply-To: <3b8029b1-8c24-4495-4433-a4dd19d3b28b@redhat.com>

Am 15.12.2021 um 13:34 hat Hanna Reitz geschrieben:
> On 14.12.21 19:10, Emanuele Giuseppe Esposito wrote:
> > 
> > 
> > On 13/12/2021 15:52, Stefan Hajnoczi wrote:
> > > Off-topic: I don't understand the difference between the effects of
> > > bdrv_drained_begin() and bdrv_subtree_drained_begin(). Both call
> > > aio_disable_external(aio_context) and aio_poll(). bdrv_drained_begin()
> > > only polls parents and itself, while bdrv_subtree_drained_begin() also
> > > polls children. But why does that distinction matter? I wouldn't know
> > > when to use one over the other.
> > 
> > Good point. Now I am wondering the same, so it would be great if anyone
> > could clarify it.
> 
> As far as I understand, bdrv_drained_begin() is used to drain and stop
> requests on a single BDS, whereas bdrv_subtree_drained_begin() drains the
> BDS and all of its children.  So when you don’t care about lingering
> requests in child nodes, then bdrv_drained_begin() suffices.

Right. This is different in practice when a child node has multiple
parents. Usually, when you want to quiesce one parent, the other parent
can keep using the child without being in the way.

For example, two qcow2 overlays based on a single template:

    vda             vdb
     |               |
     v               v
   qcow2           qcow2
(vda.qcow2)     (vdb.qcow2)
     |               |
     +-----+   +-----+
           |   |
           v   v
           qcow2
      (template.qcow2)

If you drain vdb.qcow2 because you want to safely modify something in
its BlockDriverState, there is nothing that should stop vda.qcow2 from
processing requests.

If you're not sure which one to use, bdrv_drained_begin() is what you
want. If you want bdrv_subtree_drained_begin(), you'll know. (It's
currently only used by reopen and by drop_intermediates, which both
operate on more than one node.)

Kevin



  reply	other threads:[~2021-12-16 10:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 10:40 [RFC PATCH 0/6] Removal of Aiocontext lock and usage of subtree drains in aborted transactions Emanuele Giuseppe Esposito
2021-12-13 10:40 ` [RFC PATCH 1/6] tests/unit/test-bdrv-drain.c: graph setup functions can't run in coroutines Emanuele Giuseppe Esposito
2021-12-13 10:40 ` [RFC PATCH 2/6] introduce BDRV_POLL_WHILE_UNLOCKED Emanuele Giuseppe Esposito
2021-12-13 10:40 ` [RFC PATCH 3/6] block/io.c: introduce bdrv_subtree_drained_{begin/end}_unlocked Emanuele Giuseppe Esposito
2021-12-13 10:40 ` [RFC PATCH 4/6] block.c: add subtree_drains where needed Emanuele Giuseppe Esposito
2021-12-13 10:40 ` [RFC PATCH 5/6] test-bdrv-drain.c: adapt test to the new subtree drains Emanuele Giuseppe Esposito
2021-12-13 10:40 ` [RFC PATCH 6/6] block/io.c: enable assert_bdrv_graph_writable Emanuele Giuseppe Esposito
2021-12-13 14:52 ` [RFC PATCH 0/6] Removal of Aiocontext lock and usage of subtree drains in aborted transactions Stefan Hajnoczi
2021-12-14 18:10   ` Emanuele Giuseppe Esposito
2021-12-15 12:34     ` Hanna Reitz
2021-12-16 10:37       ` Kevin Wolf [this message]
2021-12-14 16:47 ` Stefan Hajnoczi

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=YbsW0C2N8xUd3Lsk@redhat.com \
    --to=kwolf@redhat.com \
    --cc=eesposit@redhat.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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.