Skip to content

Refactor bdrv_try_set_aio_context using transactions

Emanuele Giuseppe Esposito qemu-devel 3 versions – Applied

Status from this message: Thanks, applied to the block branch.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest10 patches 1 replyApplied
  2. v211 patches 23 repliesSuperseded
  3. v1 RFC8 patches 21 repliesSuperseded

Changes in v3 from the cover letter

* add aiocontext lock acquire/remove around bdrv_detach_aio_context
* typos and nitpicks
* remove patch 4: bdrv_child_try_change_aio_context: add transaction parameter

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/10block.c: assert bs->aio_context is written under BQL and drainsblock.c+2 -00 replies
2/10block: use transactions as a replacement of ->{can_}set_aio_context()block.c include/block/block-global-state.h include/block/block_int-common.h+228 -10 replies
3/10bdrv_change_aio_context: use hash table instead of list of visited nodesblock.c include/block/block-global-state.h include/block/block_int-common.h+19 -140 replies
4/10blockjob: implement .change_aio_ctx in child_jobblockjob.c+45 -00 replies
5/10block: implement .change_aio_ctx in child_of_bdsblock.c+9 -00 replies
6/10block-backend: implement .change_aio_ctx in child_rootblock/block-backend.c+52 -00 replies
7/10block: use the new _change_ API instead of _can_set_ and _set_block.c block/block-backend.c+31 -210 replies
8/10block: remove all unused ->can_set_aio_ctx and ->set_aio_ctx callbacksblock.c block/block-backend.c blockjob.c +2 more+0 -2770 replies
9/10block: rename bdrv_child_try_change_aio_context in bdrv_try_change_aio_contextblock.c block/block-backend.c include/block/block-global-state.h+6 -70 replies
10/10block: remove bdrv_try_set_aio_context and replace it with bdrv_try_change_aio_contextblock.c block/export/export.c blockdev.c +5 more+27 -350 replies

Reviews trailers per patch

9 of 10 patches have a Reviewed-by or Acked-by.

PatchHanna ReitzKevin Wolf
1/10R-b R-b
2/10
3/10R-b
4/10R-b R-b
5/10R-b R-b
6/10R-b
7/10R-b
8/10R-b
9/10R-b
10/10R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/10] Refactor bdrv_try_set_aio_context using transactions

The aim of this series is to reorganize bdrv_try_set_aio_context and drop BDS ->set_aio_context and ->can_set_aio_ctx callbacks in favour of a new one, ->change_aio_ctx.

More informations in patch 3 (which is also RFC, due to the doubts I have with AioContext locks).

Patch 1 just add assertions in the code, 2 extends the transactions API to be able to add also transactions in the tail of the list.
Patch 3 is the core of this series, and introduces the new callback.
It is marked as RFC and the reason is explained in the commit message.
Patches 4-5-6 implement ->change_aio_ctx in the various block, blockjob
and block-backend BDSes.
Patch 7 substitutes ->change_aio_ctx with the old callbacks, and
patch 8 takes care of deleting the old callbacks and unused code.

This series is based on "job: replace AioContext lock with job_mutex", but just because it uses job_set_aio_context() introduced there.

Based-on: <[email protected]>
---
v3:
* add aiocontext lock acquire/remove around bdrv_detach_aio_context
* typos and nitpicks
* remove patch 4: bdrv_child_try_change_aio_context: add transaction parameter

v2:
* remove transaction patch, and drain transactions
* re-add old AioContext lock/unlock, since it makes sense to have it
* typos in commit message
* various cleanups in block-backend callbacks
* use hash map instead of glist when marking visited nodes
* 2 more additional patches, getting rid of bdrv_try_set_aio_context and bdrv_child_try_change_aio_context

Emanuele Giuseppe Esposito (10):
block.c: assert bs->aio_context is written under BQL and drains
block: use transactions as a replacement of ->{can_}set_aio_context()
bdrv_change_aio_context: use hash table instead of list of visited
nodes
blockjob: implement .change_aio_ctx in child_job
block: implement .change_aio_ctx in child_of_bds
block-backend: implement .change_aio_ctx in child_root
block: use the new _change_ API instead of _can_set_ and _set_
block: remove all unused ->can_set_aio_ctx and ->set_aio_ctx callbacks
block: rename bdrv_child_try_change_aio_context in
bdrv_try_change_aio_context
block: remove bdrv_try_set_aio_context and replace it with
bdrv_try_change_aio_context

 block.c                            | 363 ++++++++++++++++-------------
 block/block-backend.c              |  74 +++---
 block/export/export.c              |   2 +-
 blockdev.c                         |  22 +-
 blockjob.c                         |  50 ++--
 docs/devel/multiple-iothreads.txt  |   4 +-
 include/block/block-global-state.h |  15 +-
 include/block/block_int-common.h   |   6 +-
 job.c                              |   2 +-
 tests/unit/test-bdrv-drain.c       |   6 +-
 tests/unit/test-block-iothread.c   |  10 +-
 11 files changed, 309 insertions(+), 245 deletions(-)
Signature · 1 line
2.31.1