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

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