Skip to content

jobs: Job Exit Refactoring Pt 1

John Snow qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest9 patches 13 repliesIn review
  2. v17 patches 41 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9jobs: change start callback to run callbackblock/backup.c block/commit.c block/create.c +7 more+43 -343 replies
2/9jobs: canonize Error objectblock/backup.c block/commit.c block/create.c +8 more+22 -302 replies
3/9jobs: add exit shiminclude/qemu/job.h job.c+29 -01 reply
4/9block/commit: utilize job_exit shimblock/commit.c+5 -171 reply
5/9block/mirror: utilize job_exit shimblock/mirror.c+9 -161 reply
6/9jobs: utilize job_exit shimblock/backup.c block/create.c block/stream.c +3 more+16 -631 reply
7/9block/backup: make function variables consistently namedblock/backup.c+31 -311 reply
8/9jobs: remove ret argument to job_completed; privatize itinclude/qemu/job.h job.c trace-events+18 -192 replies
9/9jobs: remove job_defer_to_main_loopinclude/qemu/job.h job.c+2 -551 reply

Reviews trailers per patch

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

PatchMax Reitz
1/9R-b
2/9
3/9R-b
4/9R-b
5/9
6/9R-b
7/9R-b
8/9
9/9R-b

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

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/9] jobs: Job Exit Refactoring Pt 1

This is part one of a two part series that refactors the exit logic of jobs.

Part one removes job_defer_to_main_loop.
Part two removes the job->exit() callback introduced in part one.

It's redundant to have each job manage deferring to the main loop itself. Unifying this makes sense from an API standpoint. Doing so also allows us to remove a tricky case where the completion code is called under an aio_context lock, which then calls the finalization code which is itself executed under a second aio_context lock, leading to deadlocks.

Removing this recursive lock acquisition is necessary for converting mirror to only modify its graph post-finalization, but it's also just safer and will bite us less in the future.

This series introduces a job->exit callback, but after jobs are fully transitioned to using the .commit/.abort callbacks in Pt 2, this new completion callback will be removed again. It's only here as a crutch to let us investigate the completion refactoring in Pt 2 more carefully.

V2:

001/9:[----] [--] 'jobs: change start callback to run callback' 002/9:[0003] [FC] 'jobs: canonize Error object'
003/9:[0005] [FC] 'jobs: add exit shim'
004/9:[0002] [FC] 'block/commit: utilize job_exit shim' 005/9:[----] [--] 'block/mirror: utilize job_exit shim' 006/9:[----] [--] 'jobs: utilize job_exit shim'
007/9:[down] 'block/backup: make function variables consistently named' 008/9:[down] 'jobs: remove ret argument to job_completed; privatize it' 009/9:[----] [--] 'jobs: remove job_defer_to_main_loop'

002: Update commit message
Remove errant space (Eric, Max)
Update error message setting (Kevin)
003: Add comment clarifying that .exit is temporary/transitional (Max, Eric) 004: change reference from ret to job->ret
(Note: most of these references go away in Pt 2 of the series,
except for those in mirror_exit.) (for Max.)
007: Added, at Eric's suggestion.
008: Moved forward from Pt 2 of the series. (Max.)

Hopefully this version makes the trajectory clearer. --js

John Snow (9):
jobs: change start callback to run callback
jobs: canonize Error object
jobs: add exit shim
block/commit: utilize job_exit shim block/mirror: utilize job_exit shim
jobs: utilize job_exit shim
block/backup: make function variables consistently named
jobs: remove ret argument to job_completed; privatize it
jobs: remove job_defer_to_main_loop

 block/backup.c            | 81 +++++++++++++++++++----------------------------
 block/commit.c            | 29 ++++++-----------
 block/create.c            | 19 ++++-------
 block/mirror.c            | 35 +++++++++-----------
 block/stream.c            | 29 +++++++----------
 include/qemu/job.h        | 62 +++++++++++++++---------------------
 job-qmp.c                 |  5 +--
 job.c                     | 73 +++++++++++++++---------------------------
 tests/test-bdrv-drain.c   | 13 +++-----
 tests/test-blockjob-txn.c | 25 ++++++---------
 tests/test-blockjob.c     | 17 +++++-----
 trace-events              |  2 +-
 12 files changed, 150 insertions(+), 240 deletions(-)
Signature · 1 line
2.14.4