Blame SOURCES/kvm-block-backup-make-function-variables-consistently-na.patch

357786
From d829a781a2832a72264ade11062dad0e5ef578da Mon Sep 17 00:00:00 2001
357786
From: John Snow <jsnow@redhat.com>
357786
Date: Mon, 10 Sep 2018 18:17:45 +0200
357786
Subject: [PATCH 07/25] block/backup: make function variables consistently
357786
 named
357786
357786
RH-Author: John Snow <jsnow@redhat.com>
357786
Message-id: <20180910181803.11781-8-jsnow@redhat.com>
357786
Patchwork-id: 82086
357786
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 07/25] block/backup: make function variables consistently named
357786
Bugzilla: 1626061
357786
RH-Acked-by: Max Reitz <mreitz@redhat.com>
357786
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
357786
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
357786
357786
Rename opaque_job to job to be consistent with other job implementations.
357786
Rename 'job', the BackupBlockJob object, to 's' to also be consistent.
357786
357786
Suggested-by: Eric Blake <eblake@redhat.com>
357786
Signed-off-by: John Snow <jsnow@redhat.com>
357786
Reviewed-by: Max Reitz <mreitz@redhat.com>
357786
Message-id: 20180830015734.19765-8-jsnow@redhat.com
357786
Signed-off-by: Max Reitz <mreitz@redhat.com>
357786
(cherry picked from commit 6870277535493fea31761d8d11ec23add2de0fb0)
357786
Signed-off-by: John Snow <jsnow@redhat.com>
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 block/backup.c | 62 +++++++++++++++++++++++++++++-----------------------------
357786
 1 file changed, 31 insertions(+), 31 deletions(-)
357786
357786
diff --git a/block/backup.c b/block/backup.c
357786
index 08a5b74..524e0ff 100644
357786
--- a/block/backup.c
357786
+++ b/block/backup.c
357786
@@ -468,59 +468,59 @@ static void backup_incremental_init_copy_bitmap(BackupBlockJob *job)
357786
     bdrv_dirty_iter_free(dbi);
357786
 }
357786
 
357786
-static int coroutine_fn backup_run(Job *opaque_job, Error **errp)
357786
+static int coroutine_fn backup_run(Job *job, Error **errp)
357786
 {
357786
-    BackupBlockJob *job = container_of(opaque_job, BackupBlockJob, common.job);
357786
-    BlockDriverState *bs = blk_bs(job->common.blk);
357786
+    BackupBlockJob *s = container_of(job, BackupBlockJob, common.job);
357786
+    BlockDriverState *bs = blk_bs(s->common.blk);
357786
     int64_t offset, nb_clusters;
357786
     int ret = 0;
357786
 
357786
-    QLIST_INIT(&job->inflight_reqs);
357786
-    qemu_co_rwlock_init(&job->flush_rwlock);
357786
+    QLIST_INIT(&s->inflight_reqs);
357786
+    qemu_co_rwlock_init(&s->flush_rwlock);
357786
 
357786
-    nb_clusters = DIV_ROUND_UP(job->len, job->cluster_size);
357786
-    job_progress_set_remaining(&job->common.job, job->len);
357786
+    nb_clusters = DIV_ROUND_UP(s->len, s->cluster_size);
357786
+    job_progress_set_remaining(job, s->len);
357786
 
357786
-    job->copy_bitmap = hbitmap_alloc(nb_clusters, 0);
357786
-    if (job->sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
357786
-        backup_incremental_init_copy_bitmap(job);
357786
+    s->copy_bitmap = hbitmap_alloc(nb_clusters, 0);
357786
+    if (s->sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
357786
+        backup_incremental_init_copy_bitmap(s);
357786
     } else {
357786
-        hbitmap_set(job->copy_bitmap, 0, nb_clusters);
357786
+        hbitmap_set(s->copy_bitmap, 0, nb_clusters);
357786
     }
357786
 
357786
 
357786
-    job->before_write.notify = backup_before_write_notify;
357786
-    bdrv_add_before_write_notifier(bs, &job->before_write);
357786
+    s->before_write.notify = backup_before_write_notify;
357786
+    bdrv_add_before_write_notifier(bs, &s->before_write);
357786
 
357786
-    if (job->sync_mode == MIRROR_SYNC_MODE_NONE) {
357786
+    if (s->sync_mode == MIRROR_SYNC_MODE_NONE) {
357786
         /* All bits are set in copy_bitmap to allow any cluster to be copied.
357786
          * This does not actually require them to be copied. */
357786
-        while (!job_is_cancelled(&job->common.job)) {
357786
+        while (!job_is_cancelled(job)) {
357786
             /* Yield until the job is cancelled.  We just let our before_write
357786
              * notify callback service CoW requests. */
357786
-            job_yield(&job->common.job);
357786
+            job_yield(job);
357786
         }
357786
-    } else if (job->sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
357786
-        ret = backup_run_incremental(job);
357786
+    } else if (s->sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
357786
+        ret = backup_run_incremental(s);
357786
     } else {
357786
         /* Both FULL and TOP SYNC_MODE's require copying.. */
357786
-        for (offset = 0; offset < job->len;
357786
-             offset += job->cluster_size) {
357786
+        for (offset = 0; offset < s->len;
357786
+             offset += s->cluster_size) {
357786
             bool error_is_read;
357786
             int alloced = 0;
357786
 
357786
-            if (yield_and_check(job)) {
357786
+            if (yield_and_check(s)) {
357786
                 break;
357786
             }
357786
 
357786
-            if (job->sync_mode == MIRROR_SYNC_MODE_TOP) {
357786
+            if (s->sync_mode == MIRROR_SYNC_MODE_TOP) {
357786
                 int i;
357786
                 int64_t n;
357786
 
357786
                 /* Check to see if these blocks are already in the
357786
                  * backing file. */
357786
 
357786
-                for (i = 0; i < job->cluster_size;) {
357786
+                for (i = 0; i < s->cluster_size;) {
357786
                     /* bdrv_is_allocated() only returns true/false based
357786
                      * on the first set of sectors it comes across that
357786
                      * are are all in the same state.
357786
@@ -529,7 +529,7 @@ static int coroutine_fn backup_run(Job *opaque_job, Error **errp)
357786
                      * needed but at some point that is always the case. */
357786
                     alloced =
357786
                         bdrv_is_allocated(bs, offset + i,
357786
-                                          job->cluster_size - i, &n);
357786
+                                          s->cluster_size - i, &n);
357786
                     i += n;
357786
 
357786
                     if (alloced || n == 0) {
357786
@@ -547,29 +547,29 @@ static int coroutine_fn backup_run(Job *opaque_job, Error **errp)
357786
             if (alloced < 0) {
357786
                 ret = alloced;
357786
             } else {
357786
-                ret = backup_do_cow(job, offset, job->cluster_size,
357786
+                ret = backup_do_cow(s, offset, s->cluster_size,
357786
                                     &error_is_read, false);
357786
             }
357786
             if (ret < 0) {
357786
                 /* Depending on error action, fail now or retry cluster */
357786
                 BlockErrorAction action =
357786
-                    backup_error_action(job, error_is_read, -ret);
357786
+                    backup_error_action(s, error_is_read, -ret);
357786
                 if (action == BLOCK_ERROR_ACTION_REPORT) {
357786
                     break;
357786
                 } else {
357786
-                    offset -= job->cluster_size;
357786
+                    offset -= s->cluster_size;
357786
                     continue;
357786
                 }
357786
             }
357786
         }
357786
     }
357786
 
357786
-    notifier_with_return_remove(&job->before_write);
357786
+    notifier_with_return_remove(&s->before_write);
357786
 
357786
     /* wait until pending backup_do_cow() calls have completed */
357786
-    qemu_co_rwlock_wrlock(&job->flush_rwlock);
357786
-    qemu_co_rwlock_unlock(&job->flush_rwlock);
357786
-    hbitmap_free(job->copy_bitmap);
357786
+    qemu_co_rwlock_wrlock(&s->flush_rwlock);
357786
+    qemu_co_rwlock_unlock(&s->flush_rwlock);
357786
+    hbitmap_free(s->copy_bitmap);
357786
 
357786
     return ret;
357786
 }
357786
-- 
357786
1.8.3.1
357786