qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v5 00/14] block: incremental backup transactions using BlockJobTxn
@ 2015-09-07  7:34 Fam Zheng
  2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 01/14] qapi: Add transaction support to block-dirty-bitmap operations Fam Zheng
                   ` (13 more replies)
  0 siblings, 14 replies; 33+ messages in thread
From: Fam Zheng @ 2015-09-07  7:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Jeff Cody, Max Reitz, vsementsov, stefanha, John Snow

v5: Address comments from Max Reitz:
    2.4 -> 2.5 in qapi docs.
    Don't leak txn object.
    English syntax fixes.
    Really leave the "cancelled" status of failed job.
    Remove a superfluous added line.

v4: Address comments from John and Stefan, including:
    Rename function: backup_cleanup_sync_bitmap.
    Rename and add comments for .commit and .abort.
    Call .commit and .abort for both txn and non-txn.
    Drop patch 9 in v3.
    Improve the txn implementation. Acquire context locks as accessing them.
    Add refcnt patch for BlockJob.
    Adjust txn unit test code.

This is based on top of the work by Stefan Hajnoczi and John Snow.

Recap: motivation for block job transactions
--------------------------------------------
If an incremental backup block job fails then we reclaim the bitmap so
the job can be retried.  The problem comes when multiple jobs are started as
part of a qmp 'transaction' command.  We need to group these jobs in a
transaction so that either all jobs complete successfully or all bitmaps are
reclaimed.

Without transactions, there is a case where some jobs complete successfully and
throw away their bitmaps, making it impossible to retry the backup by rerunning
the command if one of the jobs fails.

How does this implementation work?
----------------------------------
These patches add a BlockJobTxn object with the following API:

  txn = block_job_txn_new();
  block_job_txn_add_job(txn, job1);
  block_job_txn_add_job(txn, job2);

The jobs either both complete successfully or they both fail/cancel.  If the
user cancels job1 then job2 will also be cancelled and vice versa.

Jobs objects stay alive waiting for other jobs to complete, even if the
coroutines have returned.  They can be cancelled by the user during this time.
Job blockers are still in effect and no other block job can run on this device
in the meantime (since QEMU currently only allows 1 job per device).  This is
the main drawback to this approach but reasonable since you probably don't want
to run other jobs/operations until you're sure the backup was successful (you
won't be able to retry a failed backup if there's a new job running).



Fam Zheng (6):
  backup: Extract dirty bitmap handling as a separate function
  blockjob: Introduce reference count
  blockjob: Add .commit and .abort block job actions
  blockjob: Add "completed" and "ret" in BlockJob
  blockjob: Simplify block_job_finish_sync
  block: Add block job transactions

John Snow (4):
  qapi: Add transaction support to block-dirty-bitmap operations
  iotests: add transactional incremental backup test
  block: rename BlkTransactionState and BdrvActionOps
  iotests: 124 - transactional failure test

Kashyap Chamarthy (1):
  qmp-commands.hx: Update the supported 'transaction' operations

Stefan Hajnoczi (3):
  blockdev: make BlockJobTxn available to qmp 'transaction'
  block/backup: support block job transactions
  tests: add BlockJobTxn unit test

 block.c                    |  19 ++-
 block/backup.c             |  49 ++++--
 block/mirror.c             |   2 +-
 blockdev.c                 | 361 ++++++++++++++++++++++++++++++++++++---------
 blockjob.c                 | 184 +++++++++++++++++++----
 docs/bitmaps.md            |   6 +-
 hmp.c                      |   2 +-
 include/block/block.h      |   2 +-
 include/block/block_int.h  |   6 +-
 include/block/blockjob.h   |  83 ++++++++++-
 qapi-schema.json           |   6 +-
 qapi/block-core.json       |  16 +-
 qmp-commands.hx            |  21 ++-
 tests/Makefile             |   3 +
 tests/qemu-iotests/124     | 182 ++++++++++++++++++++++-
 tests/qemu-iotests/124.out |   4 +-
 tests/test-blockjob-txn.c  | 244 ++++++++++++++++++++++++++++++
 17 files changed, 1048 insertions(+), 142 deletions(-)
 create mode 100644 tests/test-blockjob-txn.c

-- 
2.4.3

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2015-09-18 11:15 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-07  7:34 [Qemu-devel] [PATCH v5 00/14] block: incremental backup transactions using BlockJobTxn Fam Zheng
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 01/14] qapi: Add transaction support to block-dirty-bitmap operations Fam Zheng
2015-09-11 18:56   ` Eric Blake
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 02/14] iotests: add transactional incremental backup test Fam Zheng
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 03/14] block: rename BlkTransactionState and BdrvActionOps Fam Zheng
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 04/14] backup: Extract dirty bitmap handling as a separate function Fam Zheng
2015-09-11 18:26   ` Max Reitz
2015-09-11 19:35   ` Eric Blake
2015-09-15  5:00     ` Fam Zheng
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 05/14] blockjob: Introduce reference count Fam Zheng
2015-09-11 18:26   ` Max Reitz
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 06/14] blockjob: Add .commit and .abort block job actions Fam Zheng
2015-09-11 18:27   ` Max Reitz
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 07/14] blockjob: Add "completed" and "ret" in BlockJob Fam Zheng
2015-09-11 18:27   ` Max Reitz
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 08/14] blockjob: Simplify block_job_finish_sync Fam Zheng
2015-09-11 18:28   ` Max Reitz
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 09/14] block: Add block job transactions Fam Zheng
2015-09-11 18:34   ` Max Reitz
2015-09-11 18:52   ` Max Reitz
2015-09-15  5:02     ` Fam Zheng
2015-09-18 11:09     ` Max Reitz
2015-09-18 11:15       ` Max Reitz
2015-09-11 19:58   ` Eric Blake
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 10/14] blockdev: make BlockJobTxn available to qmp 'transaction' Fam Zheng
2015-09-11 18:38   ` Max Reitz
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 11/14] block/backup: support block job transactions Fam Zheng
2015-09-11 18:50   ` Max Reitz
2015-09-11 21:26   ` Eric Blake
2015-09-15  5:08     ` Fam Zheng
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 12/14] iotests: 124 - transactional failure test Fam Zheng
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 13/14] qmp-commands.hx: Update the supported 'transaction' operations Fam Zheng
2015-09-07  7:34 ` [Qemu-devel] [PATCH v5 14/14] tests: add BlockJobTxn unit test Fam Zheng

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).