All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Xiubo Li <lixiubo@cmss.chinamobile.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, jdurgin@redhat.com,
	jcody@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2] rbd: make the code more readable
Date: Tue, 18 Oct 2016 15:53:53 +0200	[thread overview]
Message-ID: <20161018135353.GI4706@noname.str.redhat.com> (raw)
In-Reply-To: <1476519973-6436-1-git-send-email-lixiubo@cmss.chinamobile.com>

Am 15.10.2016 um 10:26 hat Xiubo Li geschrieben:
> Make it a bit clearer and more readable.
> 
> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
> CC: John Snow <jsnow@redhat.com>
> ---
> 
> V2:
> - Advice from John Snow. Thanks.

Copying the official maintainers:

$ scripts/get_maintainer.pl -f block/rbd.c
Josh Durgin <jdurgin@redhat.com> (supporter:RBD)
Jeff Cody <jcody@redhat.com> (supporter:RBD)
...

> 
>  block/rbd.c | 25 ++++++++++++-------------
>  1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/block/rbd.c b/block/rbd.c
> index 0a5840d..d0d4b39 100644
> --- a/block/rbd.c
> +++ b/block/rbd.c
> @@ -366,45 +366,44 @@ static int qemu_rbd_create(const char *filename, QemuOpts *opts, Error **errp)
>          rados_conf_read_file(cluster, NULL);
>      } else if (conf[0] != '\0' &&
>                 qemu_rbd_set_conf(cluster, conf, true, &local_err) < 0) {
> -        rados_shutdown(cluster);
>          error_propagate(errp, local_err);
> -        return -EIO;
> +        ret = -EIO;
> +        goto shutdown;
>      }
>  
>      if (conf[0] != '\0' &&
>          qemu_rbd_set_conf(cluster, conf, false, &local_err) < 0) {
> -        rados_shutdown(cluster);
>          error_propagate(errp, local_err);
> -        return -EIO;
> +        ret = -EIO;
> +        goto shutdown;
>      }
>  
>      if (qemu_rbd_set_auth(cluster, secretid, errp) < 0) {
> -        rados_shutdown(cluster);
> -        return -EIO;
> +        ret = -EIO;
> +        goto shutdown;
>      }
>  
>      ret = rados_connect(cluster);
>      if (ret < 0) {
>          error_setg_errno(errp, -ret, "error connecting");
> -        rados_shutdown(cluster);
> -        return ret;
> +        goto shutdown;
>      }
>  
>      ret = rados_ioctx_create(cluster, pool, &io_ctx);
>      if (ret < 0) {
>          error_setg_errno(errp, -ret, "error opening pool %s", pool);
> -        rados_shutdown(cluster);
> -        return ret;
> +        goto shutdown;
>      }
>  
>      ret = rbd_create(io_ctx, name, bytes, &obj_order);
> -    rados_ioctx_destroy(io_ctx);
> -    rados_shutdown(cluster);
>      if (ret < 0) {
>          error_setg_errno(errp, -ret, "error rbd create");
> -        return ret;
>      }
>  
> +    rados_ioctx_destroy(io_ctx);
> +
> +shutdown:
> +    rados_shutdown(cluster);
>      return ret;
>  }
>  
> -- 
> 1.8.3.1
> 
> 
> 
> 

  parent reply	other threads:[~2016-10-18 13:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15  8:26 [Qemu-devel] [PATCH v2] rbd: make the code more readable Xiubo Li
2016-10-16 16:46 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-10-17 16:25 ` [Qemu-devel] " John Snow
2016-10-18 13:53 ` Kevin Wolf [this message]
2016-10-18 19:28 ` [Qemu-devel] [Qemu-block] " Jeff Cody

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161018135353.GI4706@noname.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jdurgin@redhat.com \
    --cc=lixiubo@cmss.chinamobile.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.