From nobody Tue Apr 8 16:37:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153572591918953.46972060912924; Fri, 31 Aug 2018 07:31:59 -0700 (PDT) Received: from localhost ([::1]:53967 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvkSr-0002f2-Ij for importer@patchew.org; Fri, 31 Aug 2018 10:31:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvkQN-0001AA-7L for qemu-devel@nongnu.org; Fri, 31 Aug 2018 10:29:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvkMN-0000s1-Cg for qemu-devel@nongnu.org; Fri, 31 Aug 2018 10:25:16 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36552 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvkMI-0000pI-CX; Fri, 31 Aug 2018 10:25:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EFCB987A70; Fri, 31 Aug 2018 14:25:09 +0000 (UTC) Received: from localhost (ovpn-117-235.ams2.redhat.com [10.36.117.235]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D64B63A62; Fri, 31 Aug 2018 14:25:09 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Fri, 31 Aug 2018 16:24:44 +0200 Message-Id: <20180831142446.22264-10-mreitz@redhat.com> In-Reply-To: <20180831142446.22264-1-mreitz@redhat.com> References: <20180831142446.22264-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 31 Aug 2018 14:25:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 31 Aug 2018 14:25:10 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mreitz@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 09/11] block/backup: make function variables consistently named X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: John Snow Rename opaque_job to job to be consistent with other job implementations. Rename 'job', the BackupBlockJob object, to 's' to also be consistent. Suggested-by: Eric Blake Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20180830015734.19765-8-jsnow@redhat.com Signed-off-by: Max Reitz --- block/backup.c | 62 +++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/block/backup.c b/block/backup.c index a67b7fa96b..4d084f6ca6 100644 --- a/block/backup.c +++ b/block/backup.c @@ -468,59 +468,59 @@ static void backup_incremental_init_copy_bitmap(Backu= pBlockJob *job) bdrv_dirty_iter_free(dbi); } =20 -static int coroutine_fn backup_run(Job *opaque_job, Error **errp) +static int coroutine_fn backup_run(Job *job, Error **errp) { - BackupBlockJob *job =3D container_of(opaque_job, BackupBlockJob, commo= n.job); - BlockDriverState *bs =3D blk_bs(job->common.blk); + BackupBlockJob *s =3D container_of(job, BackupBlockJob, common.job); + BlockDriverState *bs =3D blk_bs(s->common.blk); int64_t offset, nb_clusters; int ret =3D 0; =20 - QLIST_INIT(&job->inflight_reqs); - qemu_co_rwlock_init(&job->flush_rwlock); + QLIST_INIT(&s->inflight_reqs); + qemu_co_rwlock_init(&s->flush_rwlock); =20 - nb_clusters =3D DIV_ROUND_UP(job->len, job->cluster_size); - job_progress_set_remaining(&job->common.job, job->len); + nb_clusters =3D DIV_ROUND_UP(s->len, s->cluster_size); + job_progress_set_remaining(job, s->len); =20 - job->copy_bitmap =3D hbitmap_alloc(nb_clusters, 0); - if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_INCREMENTAL) { - backup_incremental_init_copy_bitmap(job); + s->copy_bitmap =3D hbitmap_alloc(nb_clusters, 0); + if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_INCREMENTAL) { + backup_incremental_init_copy_bitmap(s); } else { - hbitmap_set(job->copy_bitmap, 0, nb_clusters); + hbitmap_set(s->copy_bitmap, 0, nb_clusters); } =20 =20 - job->before_write.notify =3D backup_before_write_notify; - bdrv_add_before_write_notifier(bs, &job->before_write); + s->before_write.notify =3D backup_before_write_notify; + bdrv_add_before_write_notifier(bs, &s->before_write); =20 - if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_NONE) { + if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_NONE) { /* All bits are set in copy_bitmap to allow any cluster to be copi= ed. * This does not actually require them to be copied. */ - while (!job_is_cancelled(&job->common.job)) { + while (!job_is_cancelled(job)) { /* Yield until the job is cancelled. We just let our before_w= rite * notify callback service CoW requests. */ - job_yield(&job->common.job); + job_yield(job); } - } else if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_INCREMENTAL) { - ret =3D backup_run_incremental(job); + } else if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_INCREMENTAL) { + ret =3D backup_run_incremental(s); } else { /* Both FULL and TOP SYNC_MODE's require copying.. */ - for (offset =3D 0; offset < job->len; - offset +=3D job->cluster_size) { + for (offset =3D 0; offset < s->len; + offset +=3D s->cluster_size) { bool error_is_read; int alloced =3D 0; =20 - if (yield_and_check(job)) { + if (yield_and_check(s)) { break; } =20 - if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP) { + if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP) { int i; int64_t n; =20 /* Check to see if these blocks are already in the * backing file. */ =20 - for (i =3D 0; i < job->cluster_size;) { + for (i =3D 0; i < s->cluster_size;) { /* bdrv_is_allocated() only returns true/false based * on the first set of sectors it comes across that * are are all in the same state. @@ -529,7 +529,7 @@ static int coroutine_fn backup_run(Job *opaque_job, Err= or **errp) * needed but at some point that is always the case. */ alloced =3D bdrv_is_allocated(bs, offset + i, - job->cluster_size - i, &n); + s->cluster_size - i, &n); i +=3D n; =20 if (alloced || n =3D=3D 0) { @@ -547,29 +547,29 @@ static int coroutine_fn backup_run(Job *opaque_job, E= rror **errp) if (alloced < 0) { ret =3D alloced; } else { - ret =3D backup_do_cow(job, offset, job->cluster_size, + ret =3D backup_do_cow(s, offset, s->cluster_size, &error_is_read, false); } if (ret < 0) { /* Depending on error action, fail now or retry cluster */ BlockErrorAction action =3D - backup_error_action(job, error_is_read, -ret); + backup_error_action(s, error_is_read, -ret); if (action =3D=3D BLOCK_ERROR_ACTION_REPORT) { break; } else { - offset -=3D job->cluster_size; + offset -=3D s->cluster_size; continue; } } } } =20 - notifier_with_return_remove(&job->before_write); + notifier_with_return_remove(&s->before_write); =20 /* wait until pending backup_do_cow() calls have completed */ - qemu_co_rwlock_wrlock(&job->flush_rwlock); - qemu_co_rwlock_unlock(&job->flush_rwlock); - hbitmap_free(job->copy_bitmap); + qemu_co_rwlock_wrlock(&s->flush_rwlock); + qemu_co_rwlock_unlock(&s->flush_rwlock); + hbitmap_free(s->copy_bitmap); =20 return ret; } --=20 2.17.1