qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 24/31] block: Propagate AioContext change to all children
Date: Thu, 19 May 2016 17:22:02 +0200	[thread overview]
Message-ID: <1463671329-22655-25-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1463671329-22655-1-git-send-email-kwolf@redhat.com>

From: Max Reitz <mreitz@redhat.com>

Instead of propagating any change of a BDS's AioContext only to its file
and backing children and letting driver-specific code do the rest, just
propagate it to all and drop the thus superfluous implementations of
bdrv_{at,de}tach_aio_context() in Quorum, blkverify and VMDK.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c           | 16 ++++++----------
 block/blkverify.c | 19 -------------------
 block/quorum.c    | 24 ------------------------
 block/vmdk.c      | 23 -----------------------
 4 files changed, 6 insertions(+), 76 deletions(-)

diff --git a/block.c b/block.c
index cbc10f7..1205ef8 100644
--- a/block.c
+++ b/block.c
@@ -3609,6 +3609,7 @@ AioContext *bdrv_get_aio_context(BlockDriverState *bs)
 void bdrv_detach_aio_context(BlockDriverState *bs)
 {
     BdrvAioNotifier *baf;
+    BdrvChild *child;
 
     if (!bs->drv) {
         return;
@@ -3621,11 +3622,8 @@ void bdrv_detach_aio_context(BlockDriverState *bs)
     if (bs->drv->bdrv_detach_aio_context) {
         bs->drv->bdrv_detach_aio_context(bs);
     }
-    if (bs->file) {
-        bdrv_detach_aio_context(bs->file->bs);
-    }
-    if (bs->backing) {
-        bdrv_detach_aio_context(bs->backing->bs);
+    QLIST_FOREACH(child, &bs->children, next) {
+        bdrv_detach_aio_context(child->bs);
     }
 
     bs->aio_context = NULL;
@@ -3635,6 +3633,7 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
                              AioContext *new_context)
 {
     BdrvAioNotifier *ban;
+    BdrvChild *child;
 
     if (!bs->drv) {
         return;
@@ -3642,11 +3641,8 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
 
     bs->aio_context = new_context;
 
-    if (bs->backing) {
-        bdrv_attach_aio_context(bs->backing->bs, new_context);
-    }
-    if (bs->file) {
-        bdrv_attach_aio_context(bs->file->bs, new_context);
+    QLIST_FOREACH(child, &bs->children, next) {
+        bdrv_attach_aio_context(child->bs, new_context);
     }
     if (bs->drv->bdrv_attach_aio_context) {
         bs->drv->bdrv_attach_aio_context(bs, new_context);
diff --git a/block/blkverify.c b/block/blkverify.c
index 9414b7a..4045396 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -293,22 +293,6 @@ static bool blkverify_recurse_is_first_non_filter(BlockDriverState *bs,
     return bdrv_recurse_is_first_non_filter(s->test_file->bs, candidate);
 }
 
-/* Propagate AioContext changes to ->test_file */
-static void blkverify_detach_aio_context(BlockDriverState *bs)
-{
-    BDRVBlkverifyState *s = bs->opaque;
-
-    bdrv_detach_aio_context(s->test_file->bs);
-}
-
-static void blkverify_attach_aio_context(BlockDriverState *bs,
-                                         AioContext *new_context)
-{
-    BDRVBlkverifyState *s = bs->opaque;
-
-    bdrv_attach_aio_context(s->test_file->bs, new_context);
-}
-
 static void blkverify_refresh_filename(BlockDriverState *bs, QDict *options)
 {
     BDRVBlkverifyState *s = bs->opaque;
@@ -356,9 +340,6 @@ static BlockDriver bdrv_blkverify = {
     .bdrv_aio_writev                  = blkverify_aio_writev,
     .bdrv_aio_flush                   = blkverify_aio_flush,
 
-    .bdrv_attach_aio_context          = blkverify_attach_aio_context,
-    .bdrv_detach_aio_context          = blkverify_detach_aio_context,
-
     .is_filter                        = true,
     .bdrv_recurse_is_first_non_filter = blkverify_recurse_is_first_non_filter,
 };
diff --git a/block/quorum.c b/block/quorum.c
index 1ec3511..ec6f3b9 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -989,27 +989,6 @@ static void quorum_close(BlockDriverState *bs)
     g_free(s->children);
 }
 
-static void quorum_detach_aio_context(BlockDriverState *bs)
-{
-    BDRVQuorumState *s = bs->opaque;
-    int i;
-
-    for (i = 0; i < s->num_children; i++) {
-        bdrv_detach_aio_context(s->children[i]->bs);
-    }
-}
-
-static void quorum_attach_aio_context(BlockDriverState *bs,
-                                      AioContext *new_context)
-{
-    BDRVQuorumState *s = bs->opaque;
-    int i;
-
-    for (i = 0; i < s->num_children; i++) {
-        bdrv_attach_aio_context(s->children[i]->bs, new_context);
-    }
-}
-
 static void quorum_add_child(BlockDriverState *bs, BlockDriverState *child_bs,
                              Error **errp)
 {
@@ -1127,9 +1106,6 @@ static BlockDriver bdrv_quorum = {
     .bdrv_aio_readv                     = quorum_aio_readv,
     .bdrv_aio_writev                    = quorum_aio_writev,
 
-    .bdrv_detach_aio_context            = quorum_detach_aio_context,
-    .bdrv_attach_aio_context            = quorum_attach_aio_context,
-
     .bdrv_add_child                     = quorum_add_child,
     .bdrv_del_child                     = quorum_del_child,
 
diff --git a/block/vmdk.c b/block/vmdk.c
index e6c97c2..5b3b067 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -2343,27 +2343,6 @@ static int vmdk_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
     return 0;
 }
 
-static void vmdk_detach_aio_context(BlockDriverState *bs)
-{
-    BDRVVmdkState *s = bs->opaque;
-    int i;
-
-    for (i = 0; i < s->num_extents; i++) {
-        bdrv_detach_aio_context(s->extents[i].file->bs);
-    }
-}
-
-static void vmdk_attach_aio_context(BlockDriverState *bs,
-                                    AioContext *new_context)
-{
-    BDRVVmdkState *s = bs->opaque;
-    int i;
-
-    for (i = 0; i < s->num_extents; i++) {
-        bdrv_attach_aio_context(s->extents[i].file->bs, new_context);
-    }
-}
-
 static QemuOptsList vmdk_create_opts = {
     .name = "vmdk-create-opts",
     .head = QTAILQ_HEAD_INITIALIZER(vmdk_create_opts.head),
@@ -2433,8 +2412,6 @@ static BlockDriver bdrv_vmdk = {
     .bdrv_get_specific_info       = vmdk_get_specific_info,
     .bdrv_refresh_limits          = vmdk_refresh_limits,
     .bdrv_get_info                = vmdk_get_info,
-    .bdrv_detach_aio_context      = vmdk_detach_aio_context,
-    .bdrv_attach_aio_context      = vmdk_attach_aio_context,
 
     .supports_backing             = true,
     .create_opts                  = &vmdk_create_opts,
-- 
1.8.3.1

  parent reply	other threads:[~2016-05-19 15:23 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-19 15:21 [Qemu-devel] [PULL 00/31] Block layer patches Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 01/31] block: Make sure throttled BDSes always have a BB Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 02/31] block: Introduce BlockBackendPublic Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 03/31] block: throttle-groups: Use BlockBackend pointers internally Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 04/31] block: Convert throttle_group_get_name() to BlockBackend Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 05/31] block: Move throttling fields from BDS to BB Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 06/31] block: Move actual I/O throttling to BlockBackend Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 07/31] block: Move I/O throttling configuration functions " Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 08/31] block: Introduce BdrvChild.opaque Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 09/31] block: Drain throttling queue with BdrvChild callback Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 10/31] block/io: Quiesce parents between drained_begin/end Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 11/31] block: Decouple throttling from BlockDriverState Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 12/31] block: Remove bdrv_move_feature_fields() Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 13/31] Revert "block: Forbid I/O throttling on nodes with multiple parents for 2.6" Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 14/31] block: Don't check throttled reqs in bdrv_requests_pending() Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 15/31] block: Use BdrvChild callbacks for change_media/resize Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 16/31] block: User BdrvChild callback for device name Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 17/31] blockjob: Don't set iostatus of target Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 18/31] blockjob: Don't touch BDS iostatus Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 19/31] block: Remove bdrv_aio_multiwrite() Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 20/31] block: Add bdrv_has_blk() Kevin Wolf
2016-05-19 15:21 ` [Qemu-devel] [PULL 21/31] block: Avoid bs->blk in bdrv_next() Kevin Wolf
2016-05-20  7:54   ` Paolo Bonzini
2016-05-20  8:05     ` Kevin Wolf
2016-05-20  8:10       ` Kevin Wolf
2016-05-20  9:39         ` Paolo Bonzini
2016-05-20 10:26           ` Kevin Wolf
2016-05-20 10:46             ` Paolo Bonzini
2016-05-19 15:22 ` [Qemu-devel] [PULL 22/31] block: Don't return throttling info in query-named-block-nodes Kevin Wolf
2016-05-19 15:22 ` [Qemu-devel] [PULL 23/31] block: Remove BlockDriverState.blk Kevin Wolf
2016-05-19 15:22 ` Kevin Wolf [this message]
2016-05-19 15:22 ` [Qemu-devel] [PULL 25/31] qcow2: fix condition in is_zero_cluster Kevin Wolf
2016-05-19 15:22 ` [Qemu-devel] [PULL 26/31] qcow2: Fix write_zeroes with partially allocated backing file cluster Kevin Wolf
2016-05-19 15:22 ` [Qemu-devel] [PULL 27/31] qemu-iotests: Some more write_zeroes tests Kevin Wolf
2016-05-19 15:22 ` [Qemu-devel] [PULL 28/31] block: clarify error message for qmp-eject Kevin Wolf
2016-05-19 15:22 ` [Qemu-devel] [PULL 29/31] qemu-io: Fix recent UI updates Kevin Wolf
2016-05-19 15:22 ` [Qemu-devel] [PULL 30/31] qemu-iotests: Simplify 109 with unaligned qemu-img compare Kevin Wolf
2016-05-19 15:22 ` [Qemu-devel] [PULL 31/31] qemu-iotests: Fix regression in 136 on aio_read invalid Kevin Wolf
2016-05-19 16:40 ` [Qemu-devel] [PULL 00/31] Block layer patches Peter Maydell

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=1463671329-22655-25-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).