* [Qemu-devel] [PATCH] block: Propagate AioContext change to all children
@ 2016-05-17 11:38 Max Reitz
2016-05-17 12:02 ` Paolo Bonzini
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Max Reitz @ 2016-05-17 11:38 UTC (permalink / raw)
To: qemu-block
Cc: qemu-devel, Max Reitz, Kevin Wolf, Stefan Hajnoczi,
Alberto Garcia, Fam Zheng
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>
---
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 18a497f..16855a2 100644
--- a/block.c
+++ b/block.c
@@ -3653,6 +3653,7 @@ AioContext *bdrv_get_aio_context(BlockDriverState *bs)
void bdrv_detach_aio_context(BlockDriverState *bs)
{
BdrvAioNotifier *baf;
+ BdrvChild *child;
if (!bs->drv) {
return;
@@ -3668,11 +3669,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;
@@ -3682,6 +3680,7 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
AioContext *new_context)
{
BdrvAioNotifier *ban;
+ BdrvChild *child;
if (!bs->drv) {
return;
@@ -3689,11 +3688,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,
--
2.8.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Propagate AioContext change to all children
2016-05-17 11:38 [Qemu-devel] [PATCH] block: Propagate AioContext change to all children Max Reitz
@ 2016-05-17 12:02 ` Paolo Bonzini
2016-05-17 14:37 ` Alberto Garcia
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2016-05-17 12:02 UTC (permalink / raw)
To: Max Reitz, qemu-block; +Cc: Kevin Wolf, Fam Zheng, qemu-devel, Stefan Hajnoczi
On 17/05/2016 13:38, Max Reitz wrote:
> 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.
See, young lad, when I was young we had no bs->children!
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Propagate AioContext change to all children
2016-05-17 11:38 [Qemu-devel] [PATCH] block: Propagate AioContext change to all children Max Reitz
2016-05-17 12:02 ` Paolo Bonzini
@ 2016-05-17 14:37 ` Alberto Garcia
2016-05-17 14:52 ` Kevin Wolf
2016-05-17 21:20 ` Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Alberto Garcia @ 2016-05-17 14:37 UTC (permalink / raw)
To: Max Reitz, qemu-block; +Cc: qemu-devel, Kevin Wolf, Stefan Hajnoczi, Fam Zheng
On Tue 17 May 2016 01:38:04 PM CEST, Max Reitz wrote:
> 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: Alberto Garcia <berto@igalia.com>
Berto
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Propagate AioContext change to all children
2016-05-17 11:38 [Qemu-devel] [PATCH] block: Propagate AioContext change to all children Max Reitz
2016-05-17 12:02 ` Paolo Bonzini
2016-05-17 14:37 ` Alberto Garcia
@ 2016-05-17 14:52 ` Kevin Wolf
2016-05-17 21:20 ` Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Kevin Wolf @ 2016-05-17 14:52 UTC (permalink / raw)
To: Max Reitz
Cc: qemu-block, qemu-devel, Stefan Hajnoczi, Alberto Garcia,
Fam Zheng
Am 17.05.2016 um 13:38 hat Max Reitz geschrieben:
> 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>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: Propagate AioContext change to all children
2016-05-17 11:38 [Qemu-devel] [PATCH] block: Propagate AioContext change to all children Max Reitz
` (2 preceding siblings ...)
2016-05-17 14:52 ` Kevin Wolf
@ 2016-05-17 21:20 ` Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2016-05-17 21:20 UTC (permalink / raw)
To: Max Reitz; +Cc: qemu-block, qemu-devel, Kevin Wolf, Alberto Garcia, Fam Zheng
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
On Tue, May 17, 2016 at 01:38:04PM +0200, Max Reitz wrote:
> 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>
> ---
> block.c | 16 ++++++----------
> block/blkverify.c | 19 -------------------
> block/quorum.c | 24 ------------------------
> block/vmdk.c | 23 -----------------------
> 4 files changed, 6 insertions(+), 76 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-05-18 1:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17 11:38 [Qemu-devel] [PATCH] block: Propagate AioContext change to all children Max Reitz
2016-05-17 12:02 ` Paolo Bonzini
2016-05-17 14:37 ` Alberto Garcia
2016-05-17 14:52 ` Kevin Wolf
2016-05-17 21:20 ` Stefan Hajnoczi
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).