From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Jeff Cody <jcody@redhat.com>,
Max Reitz <mreitz@redhat.com>,
vsementsov@parallels.com, stefanha@redhat.com,
John Snow <jsnow@redhat.com>
Subject: [Qemu-devel] [PATCH v7 00/14] block: incremental backup transactions using BlockJobTxn
Date: Tue, 22 Sep 2015 10:46:02 +0800 [thread overview]
Message-ID: <1442889976-8733-1-git-send-email-famz@redhat.com> (raw)
v7: Add Eric's rev-by in 1, 11.
Add Max's rev-by in 4, 5, 9, 10, 11.
Add John's rev-by in 5, 6, 8.
Fix wording for 6. [John]
Fix comment of block_job_txn_add_job() in 9. [Max]
Remove superfluous hunks, and document default value in 11. [Eric]
Update Makefile dep in 14. [Max]
v6: Address comments from Max and Eric (many thanks for reviewing!):
Add Max's reviews.
Don't leak txn. [Max]
Unusual comment ending "**/" -> "*/". [Eric]
Fix the stale block_job_txn_prepare_to_complete comment. [Max]
Move "block_job_txn_unref" to below FOREACH block. [Max]
Split "base" and "txn" in qapi schema, so that transactional-cancel is only
visible in transaction. [Eric]
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.
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 | 50 +++++--
block/mirror.c | 2 +-
blockdev.c | 354 +++++++++++++++++++++++++++++++++++----------
blockjob.c | 185 +++++++++++++++++++----
docs/bitmaps.md | 6 +-
include/block/block.h | 2 +-
include/block/block_int.h | 6 +-
include/block/blockjob.h | 85 ++++++++++-
qapi-schema.json | 10 +-
qapi/block-core.json | 27 +++-
qmp-commands.hx | 21 ++-
tests/Makefile | 3 +
tests/qemu-iotests/124 | 182 ++++++++++++++++++++++-
tests/qemu-iotests/124.out | 4 +-
tests/test-blockjob-txn.c | 244 +++++++++++++++++++++++++++++++
16 files changed, 1056 insertions(+), 144 deletions(-)
create mode 100644 tests/test-blockjob-txn.c
--
2.4.3
next reply other threads:[~2015-09-22 2:46 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-22 2:46 Fam Zheng [this message]
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 01/14] qapi: Add transaction support to block-dirty-bitmap operations Fam Zheng
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 02/14] iotests: add transactional incremental backup test Fam Zheng
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 03/14] block: rename BlkTransactionState and BdrvActionOps Fam Zheng
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 04/14] backup: Extract dirty bitmap handling as a separate function Fam Zheng
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 05/14] blockjob: Introduce reference count Fam Zheng
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 06/14] blockjob: Add .commit and .abort block job actions Fam Zheng
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 07/14] blockjob: Add "completed" and "ret" in BlockJob Fam Zheng
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 08/14] blockjob: Simplify block_job_finish_sync Fam Zheng
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 09/14] block: Add block job transactions Fam Zheng
2015-09-22 19:09 ` John Snow
2015-09-24 8:29 ` Fam Zheng
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 10/14] blockdev: make BlockJobTxn available to qmp 'transaction' Fam Zheng
2015-09-22 19:13 ` John Snow
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 11/14] block/backup: support block job transactions Fam Zheng
2015-09-22 16:03 ` Eric Blake
2015-09-22 21:08 ` John Snow
2015-09-22 22:34 ` Eric Blake
2015-09-22 23:27 ` John Snow
2015-09-23 11:09 ` Markus Armbruster
2015-09-23 16:14 ` John Snow
2015-09-24 6:34 ` Markus Armbruster
2015-09-25 16:05 ` John Snow
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 12/14] iotests: 124 - transactional failure test Fam Zheng
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 13/14] qmp-commands.hx: Update the supported 'transaction' operations Fam Zheng
2015-09-30 18:56 ` John Snow
2015-10-01 10:57 ` Kashyap Chamarthy
2015-09-22 2:46 ` [Qemu-devel] [PATCH v7 14/14] tests: add BlockJobTxn unit test Fam Zheng
2015-09-22 23:33 ` John Snow
2015-09-22 20:48 ` [Qemu-devel] [PATCH v7 00/14] block: incremental backup transactions using BlockJobTxn John Snow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1442889976-8733-1-git-send-email-famz@redhat.com \
--to=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@parallels.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).