From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEmno-0000mC-RK for qemu-devel@nongnu.org; Mon, 13 Jul 2015 19:06:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEmnl-00062S-JM for qemu-devel@nongnu.org; Mon, 13 Jul 2015 19:06:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48584) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEmnl-00062F-Em for qemu-devel@nongnu.org; Mon, 13 Jul 2015 19:06:21 -0400 Message-ID: <55A4446A.7010407@redhat.com> Date: Mon, 13 Jul 2015 19:06:18 -0400 From: John Snow MIME-Version: 1.0 References: <1436500012-32593-1-git-send-email-famz@redhat.com> <1436500012-32593-6-git-send-email-famz@redhat.com> In-Reply-To: <1436500012-32593-6-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 05/15] backup: Extract dirty bitmap handling as a separate function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , vsementsov@parallels.com, stefanha@redhat.com, Max Reitz 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 > --- > 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