Re: [PATCH v2 11/11] block: remove bdrv_try_set_aio_context and replace it with bdrv_try_change_aio_context

2022-10-10 Thread Kevin Wolf
Am 25.07.2022 um 14:21 hat Emanuele Giuseppe Esposito geschrieben:
> No functional change intended.
> 
> Signed-off-by: Emanuele Giuseppe Esposito 

Reviewed-by: Kevin Wolf 




[PATCH v2 11/11] block: remove bdrv_try_set_aio_context and replace it with bdrv_try_change_aio_context

2022-07-25 Thread Emanuele Giuseppe Esposito
No functional change intended.

Signed-off-by: Emanuele Giuseppe Esposito 
---
 block.c| 14 --
 block/export/export.c  |  2 +-
 blockdev.c | 22 +++---
 docs/devel/multiple-iothreads.txt  |  4 ++--
 include/block/block-global-state.h |  2 --
 job.c  |  2 +-
 tests/unit/test-bdrv-drain.c   |  6 +++---
 tests/unit/test-block-iothread.c   | 10 +-
 8 files changed, 27 insertions(+), 35 deletions(-)

diff --git a/block.c b/block.c
index b82eb0ba6d..435e8fe731 100644
--- a/block.c
+++ b/block.c
@@ -2950,7 +2950,7 @@ static void bdrv_attach_child_common_abort(void *opaque)
 bdrv_replace_child_noperm(s->child, NULL, false);
 
 if (bdrv_get_aio_context(bs) != s->old_child_ctx) {
-bdrv_try_set_aio_context(bs, s->old_child_ctx, _abort);
+bdrv_try_change_aio_context(bs, s->old_child_ctx, NULL, _abort);
 }
 
 if (bdrv_child_get_parent_aio_context(child) != s->old_parent_ctx) {
@@ -3027,7 +3027,8 @@ static int bdrv_attach_child_common(BlockDriverState 
*child_bs,
 parent_ctx = bdrv_child_get_parent_aio_context(new_child);
 if (child_ctx != parent_ctx) {
 Error *local_err = NULL;
-int ret = bdrv_try_set_aio_context(child_bs, parent_ctx, _err);
+int ret = bdrv_try_change_aio_context(child_bs, parent_ctx, NULL,
+  _err);
 
 if (ret < 0 && child_class->change_aio_ctx) {
 Transaction *tran = tran_new();
@@ -3130,7 +3131,7 @@ static void bdrv_detach_child(BdrvChild **childp)
  * When the parent requiring a non-default AioContext is removed, the
  * node moves back to the main AioContext
  */
-bdrv_try_set_aio_context(old_bs, qemu_get_aio_context(), NULL);
+bdrv_try_change_aio_context(old_bs, qemu_get_aio_context(), NULL, 
NULL);
 }
 }
 
@@ -7535,13 +7536,6 @@ int bdrv_try_change_aio_context(BlockDriverState *bs, 
AioContext *ctx,
 return 0;
 }
 
-int bdrv_try_set_aio_context(BlockDriverState *bs, AioContext *ctx,
- Error **errp)
-{
-GLOBAL_STATE_CODE();
-return bdrv_try_change_aio_context(bs, ctx, NULL, errp);
-}
-
 void bdrv_add_aio_context_notifier(BlockDriverState *bs,
 void (*attached_aio_context)(AioContext *new_context, void *opaque),
 void (*detach_aio_context)(void *opaque), void *opaque)
diff --git a/block/export/export.c b/block/export/export.c
index 4744862915..7cc0c25c1c 100644
--- a/block/export/export.c
+++ b/block/export/export.c
@@ -129,7 +129,7 @@ BlockExport *blk_exp_add(BlockExportOptions *export, Error 
**errp)
 
 /* Ignore errors with fixed-iothread=false */
 set_context_errp = fixed_iothread ? errp : NULL;
-ret = bdrv_try_set_aio_context(bs, new_ctx, set_context_errp);
+ret = bdrv_try_change_aio_context(bs, new_ctx, NULL, set_context_errp);
 if (ret == 0) {
 aio_context_release(ctx);
 aio_context_acquire(new_ctx);
diff --git a/blockdev.c b/blockdev.c
index 2cd84d206c..fb0ec67523 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1619,8 +1619,8 @@ static void external_snapshot_abort(BlkActionState 
*common)
 aio_context_release(aio_context);
 aio_context_acquire(tmp_context);
 
-ret = bdrv_try_set_aio_context(state->old_bs,
-   aio_context, NULL);
+ret = bdrv_try_change_aio_context(state->old_bs,
+  aio_context, NULL, NULL);
 assert(ret == 0);
 
 aio_context_release(tmp_context);
@@ -1781,12 +1781,12 @@ static void drive_backup_prepare(BlkActionState 
*common, Error **errp)
 goto out;
 }
 
-/* Honor bdrv_try_set_aio_context() context acquisition requirements. */
+/* Honor bdrv_try_change_aio_context() context acquisition requirements. */
 old_context = bdrv_get_aio_context(target_bs);
 aio_context_release(aio_context);
 aio_context_acquire(old_context);
 
-ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
+ret = bdrv_try_change_aio_context(target_bs, aio_context, NULL, errp);
 if (ret < 0) {
 bdrv_unref(target_bs);
 aio_context_release(old_context);
@@ -1881,12 +1881,12 @@ static void blockdev_backup_prepare(BlkActionState 
*common, Error **errp)
 return;
 }
 
-/* Honor bdrv_try_set_aio_context() context acquisition requirements. */
+/* Honor bdrv_try_change_aio_context() context acquisition requirements. */
 aio_context = bdrv_get_aio_context(bs);
 old_context = bdrv_get_aio_context(target_bs);
 aio_context_acquire(old_context);
 
-ret = bdrv_try_set_aio_context(target_bs, aio_context, errp);
+ret = bdrv_try_change_aio_context(target_bs, aio_context, NULL, errp);
 if (ret < 0) {