[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 05/15] backup: Extract dirty bitmap handling
From: |
John Snow |
Subject: |
Re: [Qemu-devel] [PATCH v3 05/15] backup: Extract dirty bitmap handling as a separate function |
Date: |
Mon, 13 Jul 2015 19:06:18 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 |
On 07/09/2015 11:46 PM, Fam Zheng wrote:
> This will be reused by the coming new transactional completion code.
>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
> block/backup.c | 26 ++++++++++++++++----------
> 1 file changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/block/backup.c b/block/backup.c
> index 965654d..6e24384 100644
> --- a/block/backup.c
> +++ b/block/backup.c
> @@ -210,6 +210,21 @@ static void backup_iostatus_reset(BlockJob *job)
>
> bdrv_iostatus_reset(s->target);
> }
> +static void backup_handle_dirty_bitmap(BackupBlockJob *job, int ret)
> +{
> + BdrvDirtyBitmap *bm;
> + BlockDriverState *bs = job->common.bs;
> +
> + if (ret < 0 || block_job_is_cancelled(&job->common)) {
> + /* Merge the successor back into the parent, delete nothing. */
> + bm = bdrv_reclaim_dirty_bitmap(bs, job->sync_bitmap, NULL);
> + assert(bm);
> + } else {
> + /* Everything is fine, delete this bitmap and install the backup. */
> + bm = bdrv_dirty_bitmap_abdicate(bs, job->sync_bitmap, NULL);
> + assert(bm);
> + }
> +}
>
> static const BlockJobDriver backup_job_driver = {
> .instance_size = sizeof(BackupBlockJob),
> @@ -430,16 +445,7 @@ static void coroutine_fn backup_run(void *opaque)
> qemu_co_rwlock_unlock(&job->flush_rwlock);
>
> if (job->sync_bitmap) {
> - BdrvDirtyBitmap *bm;
> - if (ret < 0 || block_job_is_cancelled(&job->common)) {
> - /* Merge the successor back into the parent, delete nothing. */
> - bm = bdrv_reclaim_dirty_bitmap(bs, job->sync_bitmap, NULL);
> - assert(bm);
> - } else {
> - /* Everything is fine, delete this bitmap and install the
> backup. */
> - bm = bdrv_dirty_bitmap_abdicate(bs, job->sync_bitmap, NULL);
> - assert(bm);
> - }
> + backup_handle_dirty_bitmap(job, ret);
> }
> hbitmap_free(job->bitmap);
>
>
Bike-shedding: strange name, I may have used 'cleanup' or 'finalize' or
so, but that's neither here nor there.
Reviewed-by: John Snow <address@hidden>
- [Qemu-devel] [PATCH v3 00/15] block: incremental backup transactions using BlockJobTxn, Fam Zheng, 2015/07/09
- [Qemu-devel] [PATCH v3 01/15] qapi: Add transaction support to block-dirty-bitmap operations, Fam Zheng, 2015/07/09
- [Qemu-devel] [PATCH v3 02/15] iotests: add transactional incremental backup test, Fam Zheng, 2015/07/09
- [Qemu-devel] [PATCH v3 03/15] block: rename BlkTransactionState and BdrvActionOps, Fam Zheng, 2015/07/09
- [Qemu-devel] [PATCH v3 04/15] block: keep bitmap if incremental backup job is cancelled, Fam Zheng, 2015/07/09
- [Qemu-devel] [PATCH v3 05/15] backup: Extract dirty bitmap handling as a separate function, Fam Zheng, 2015/07/09
- [Qemu-devel] [PATCH v3 06/15] blockjob: Add .txn_commit and .txn_abort transaction actions, Fam Zheng, 2015/07/09
- [Qemu-devel] [PATCH v3 07/15] blockjob: Add "completed" and "ret" in BlockJob, Fam Zheng, 2015/07/09
- [Qemu-devel] [PATCH v3 08/15] blockjob: Simplify block_job_finish_sync, Fam Zheng, 2015/07/09