Message ID | 20200909185930.26524-7-vsementsov@virtuozzo.com |
---|---|
State | Superseded |
Headers | show |
Series | block: deal with errp: part I | expand |
On Wed, 9 Sep 2020 21:59:22 +0300 Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> wrote: > Let's check return value of mirror_start_job to check for failure > instead of local_err. > > Rename ret to job, as ret is usually integer variable. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> > --- Reviewed-by: Greg Kurz <groug@kaod.org> > block/mirror.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/block/mirror.c b/block/mirror.c > index ca250f765d..529ba12b2a 100644 > --- a/block/mirror.c > +++ b/block/mirror.c > @@ -1788,8 +1788,7 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs, > bool auto_complete, Error **errp) > { > bool base_read_only; > - Error *local_err = NULL; > - BlockJob *ret; > + BlockJob *job; > > base_read_only = bdrv_is_read_only(base); > > @@ -1799,19 +1798,18 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs, > } > } > > - ret = mirror_start_job( > + job = mirror_start_job( > job_id, bs, creation_flags, base, NULL, speed, 0, 0, > MIRROR_LEAVE_BACKING_CHAIN, false, > on_error, on_error, true, cb, opaque, > &commit_active_job_driver, false, base, auto_complete, > filter_node_name, false, MIRROR_COPY_MODE_BACKGROUND, > - &local_err); > - if (local_err) { > - error_propagate(errp, local_err); > + errp); > + if (!job) { > goto error_restore_flags; > } > > - return ret; > + return job; > > error_restore_flags: > /* ignore error and errp for bdrv_reopen, because we want to propagate
On Wed 09 Sep 2020 08:59:22 PM CEST, Vladimir Sementsov-Ogievskiy wrote: > Let's check return value of mirror_start_job to check for failure > instead of local_err. > > Rename ret to job, as ret is usually integer variable. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Berto
diff --git a/block/mirror.c b/block/mirror.c index ca250f765d..529ba12b2a 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1788,8 +1788,7 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs, bool auto_complete, Error **errp) { bool base_read_only; - Error *local_err = NULL; - BlockJob *ret; + BlockJob *job; base_read_only = bdrv_is_read_only(base); @@ -1799,19 +1798,18 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs, } } - ret = mirror_start_job( + job = mirror_start_job( job_id, bs, creation_flags, base, NULL, speed, 0, 0, MIRROR_LEAVE_BACKING_CHAIN, false, on_error, on_error, true, cb, opaque, &commit_active_job_driver, false, base, auto_complete, filter_node_name, false, MIRROR_COPY_MODE_BACKGROUND, - &local_err); - if (local_err) { - error_propagate(errp, local_err); + errp); + if (!job) { goto error_restore_flags; } - return ret; + return job; error_restore_flags: /* ignore error and errp for bdrv_reopen, because we want to propagate
Let's check return value of mirror_start_job to check for failure instead of local_err. Rename ret to job, as ret is usually integer variable. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> --- block/mirror.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)