diff mbox series

[v2,2/3] block/stream: refactor stream_run: drop goto

Message ID 1554120365-39119-3-git-send-email-andrey.shinkevich@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series block/stream: get rid of the base | expand

Commit Message

Andrey Shinkevich April 1, 2019, 12:06 p.m. UTC
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
---
 block/stream.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

Alberto Garcia April 2, 2019, 12:43 p.m. UTC | #1
On Mon 01 Apr 2019 02:06:04 PM CEST, Andrey Shinkevich wrote:
> From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> ---

You can also say in the log message that the goto is not necessary since
the common exit code was removed in commit eb23654dbe43b549ea2a9ebff9d8e

Reviewed-by: Alberto Garcia <berto@igalia.com>

Berto
Andrey Shinkevich April 3, 2019, 8:25 a.m. UTC | #2
On 02/04/2019 15:43, Alberto Garcia wrote:
> On Mon 01 Apr 2019 02:06:04 PM CEST, Andrey Shinkevich wrote:
>> From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>> ---
> 
> You can also say in the log message that the goto is not necessary since
> the common exit code was removed in commit eb23654dbe43b549ea2a9ebff9d8e
> 
> Reviewed-by: Alberto Garcia <berto@igalia.com>
> 
> Berto
> 

Alberto,
Thank you for the commit reference.
diff mbox series

Patch

diff --git a/block/stream.c b/block/stream.c
index 6253c86..c065e99 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -122,13 +122,12 @@  static int coroutine_fn stream_run(Job *job, Error **errp)
     void *buf;
 
     if (!bs->backing) {
-        goto out;
+        return 0;
     }
 
     len = bdrv_getlength(bs);
     if (len < 0) {
-        ret = len;
-        goto out;
+        return len;
     }
     job_progress_set_remaining(&s->common.job, len);
 
@@ -205,14 +204,10 @@  static int coroutine_fn stream_run(Job *job, Error **errp)
         bdrv_disable_copy_on_read(bs);
     }
 
-    /* Do not remove the backing file if an error was there but ignored.  */
-    ret = error;
-
     qemu_vfree(buf);
 
-out:
-    /* Modify backing chain and close BDSes in main loop */
-    return ret;
+    /* Do not remove the backing file if an error was there but ignored. */
+    return error;
 }
 
 static const BlockJobDriver stream_job_driver = {