diff mbox

[v2,13/13] block: Don't check throttled reqs in bdrv_requests_pending()

Message ID 1461346962-4676-14-git-send-email-kwolf@redhat.com
State New
Headers show

Commit Message

Kevin Wolf April 22, 2016, 5:42 p.m. UTC
Checking whether there are throttled requests requires going to the
associated BlockBackend, which we want to avoid. All users of
bdrv_requests_pending() already call bdrv_parent_drained_begin() first,
which restarts all throttled requests, so no throttled requests can be
left here and this is removal of dead code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/io.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Alberto Garcia May 10, 2016, 12:20 p.m. UTC | #1
On Fri 22 Apr 2016 07:42:42 PM CEST, Kevin Wolf wrote:
> Checking whether there are throttled requests requires going to the
> associated BlockBackend, which we want to avoid. All users of
> bdrv_requests_pending() already call bdrv_parent_drained_begin()
> first,

There's a couple of assert(!bdrv_requests_pending()), is it also the
case with them?

Berto
Kevin Wolf May 11, 2016, 12:35 p.m. UTC | #2
Am 10.05.2016 um 14:20 hat Alberto Garcia geschrieben:
> On Fri 22 Apr 2016 07:42:42 PM CEST, Kevin Wolf wrote:
> > Checking whether there are throttled requests requires going to the
> > associated BlockBackend, which we want to avoid. All users of
> > bdrv_requests_pending() already call bdrv_parent_drained_begin()
> > first,
> 
> There's a couple of assert(!bdrv_requests_pending()), is it also the
> case with them?

I'm changing it into "all users in block/io.c" and adding this paragraph
to the commit message:

    The remaining users (assertions during graph manipulation in
    block.c) don't care about requests that are still queued in the
    BlockBackend and haven't been issued for a BlockDriverState yet.

Makes sense?

Kevin
diff mbox

Patch

diff --git a/block/io.c b/block/io.c
index b239e97..4224044 100644
--- a/block/io.c
+++ b/block/io.c
@@ -177,17 +177,10 @@  void bdrv_disable_copy_on_read(BlockDriverState *bs)
 bool bdrv_requests_pending(BlockDriverState *bs)
 {
     BdrvChild *child;
-    BlockBackendPublic *blkp = bs->blk ? blk_get_public(bs->blk) : NULL;
 
     if (!QLIST_EMPTY(&bs->tracked_requests)) {
         return true;
     }
-    if (blkp && !qemu_co_queue_empty(&blkp->throttled_reqs[0])) {
-        return true;
-    }
-    if (blkp && !qemu_co_queue_empty(&blkp->throttled_reqs[1])) {
-        return true;
-    }
 
     QLIST_FOREACH(child, &bs->children, next) {
         if (bdrv_requests_pending(child->bs)) {