From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: s.reiter@proxmox.com, qemu-devel@nongnu.org, dietmar@proxmox.com,
stefanha@redhat.com, mreitz@redhat.com, t.lamprecht@proxmox.com
Subject: Re: [PATCH for-5.0 v2 2/3] block: Increase BB.in_flight for coroutine interfaces
Date: Tue, 7 Apr 2020 09:41:32 +0300 [thread overview]
Message-ID: <9d0aa9cc-61a1-fd14-357e-6fb0ba2742dd@virtuozzo.com> (raw)
In-Reply-To: <20200406171403.6761-3-kwolf@redhat.com>
06.04.2020 20:14, Kevin Wolf wrote:
> External callers of blk_co_*() don't currently increase the
> BlockBackend.in_flight counter, but calls from blk_aio_*() do, so there
> is an inconsistency whether the counter has been increased or not.
>
> This patch moves the actual operations to static functions that can
> later know they will always be called with in_flight increased exactly
> once, even for external callers using the blk_co_*() coroutine
> interfaces.
>
> If the public blk_co_*() interface is unused, remove it.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Still, did you consider instead just move inc/dec to _co_ functions, like
@@ -1154,6 +1154,7 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
int ret;
BlockDriverState *bs;
+ blk_inc_in_flight(blk);
blk_wait_while_drained(blk);
/* Call blk_bs() only after waiting, the graph may have changed */
@@ -1175,6 +1176,7 @@ int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset,
ret = bdrv_co_preadv(blk->root, offset, bytes, qiov, flags);
bdrv_dec_in_flight(bs);
+ blk_dec_in_flight(blk);
return ret;
}
@@ -1337,7 +1339,6 @@ static void blk_aio_complete(BlkAioEmAIOCB *acb)
{
if (acb->has_returned) {
acb->common.cb(acb->common.opaque, acb->rwco.ret);
- blk_dec_in_flight(acb->rwco.blk);
qemu_aio_unref(acb);
}
}
@@ -1357,7 +1358,6 @@ static BlockAIOCB *blk_aio_prwv(BlockBackend *blk, int64_t offset, int bytes,
BlkAioEmAIOCB *acb;
Coroutine *co;
- blk_inc_in_flight(blk);
acb = blk_aio_get(&blk_aio_em_aiocb_info, blk, cb, opaque);
acb->rwco = (BlkRwCo) {
.blk = blk,
@@ -1388,9 +1388,7 @@ static void blk_aio_read_entry(void *opaque)
QEMUIOVector *qiov = rwco->iobuf;
if (rwco->blk->quiesce_counter) {
- blk_dec_in_flight(rwco->blk);
blk_wait_while_drained(rwco->blk);
- blk_inc_in_flight(rwco->blk);
}
assert(qiov->size == acb->bytes);
(and same for write, ioctl, flush, discard). It seems more consistent.. Should it work?
--
Best regards,
Vladimir
next prev parent reply other threads:[~2020-04-07 6:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 17:14 [PATCH for-5.0 v2 0/3] block: Fix blk->in_flight during blk_wait_while_drained() Kevin Wolf
2020-04-06 17:14 ` [PATCH for-5.0 v2 1/3] block-backend: Reorder flush/pdiscard function definitions Kevin Wolf
2020-04-07 5:45 ` Vladimir Sementsov-Ogievskiy
2020-04-07 9:22 ` Max Reitz
2020-04-06 17:14 ` [PATCH for-5.0 v2 2/3] block: Increase BB.in_flight for coroutine interfaces Kevin Wolf
2020-04-07 6:41 ` Vladimir Sementsov-Ogievskiy [this message]
2020-04-07 8:52 ` Kevin Wolf
2020-04-07 9:10 ` Vladimir Sementsov-Ogievskiy
2020-04-07 9:48 ` Kevin Wolf
2020-04-07 10:00 ` Vladimir Sementsov-Ogievskiy
2020-04-07 10:04 ` Max Reitz
2020-04-07 10:15 ` Max Reitz
2020-04-07 11:13 ` Kevin Wolf
2020-04-07 11:27 ` Max Reitz
2020-04-06 17:14 ` [PATCH for-5.0 v2 3/3] block: Fix blk->in_flight during blk_wait_while_drained() Kevin Wolf
2020-04-07 6:52 ` Vladimir Sementsov-Ogievskiy
2020-04-07 8:59 ` Kevin Wolf
2020-04-07 9:15 ` Vladimir Sementsov-Ogievskiy
2020-04-07 10:12 ` Max Reitz
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=9d0aa9cc-61a1-fd14-357e-6fb0ba2742dd@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=dietmar@proxmox.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=s.reiter@proxmox.com \
--cc=stefanha@redhat.com \
--cc=t.lamprecht@proxmox.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).