From: John Snow <jsnow@redhat.com>
To: Xiubo Li <lixiubo@cmss.chinamobile.com>, qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH] rbd: make the code better readable
Date: Fri, 14 Oct 2016 15:28:44 -0400 [thread overview]
Message-ID: <6eb7ea5f-2194-a99b-88c5-d21369827533@redhat.com> (raw)
In-Reply-To: <1476438669-6490-1-git-send-email-lixiubo@cmss.chinamobile.com>
On 10/14/2016 05:51 AM, Xiubo Li wrote:
> Make it a bit clear and better readable.
>
Suggestion: "Make it clearer and more readable."
> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
> ---
> block/rbd.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/block/rbd.c b/block/rbd.c
> index 0a5840d..de8ca1b 100644
> --- a/block/rbd.c
> +++ b/block/rbd.c
> @@ -366,45 +366,45 @@ 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 failed_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 failed_shutdown;
> }
>
> if (qemu_rbd_set_auth(cluster, secretid, errp) < 0) {
> rados_shutdown(cluster);
Did you mean to remove rados_shutdown() here, too?
> - return -EIO;
> + ret = -EIO;
> + goto failed_shutdown;
> }
>
> ret = rados_connect(cluster);
> if (ret < 0) {
> error_setg_errno(errp, -ret, "error connecting");
> - rados_shutdown(cluster);
> - return ret;
> + goto failed_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 failed_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);
> +
> +failed_shutdown:
Since this executes on the non-error pathway too, I might just call this
'shutdown'.
> + rados_shutdown(cluster);
> return ret;
> }
>
>
--
—js
next prev parent reply other threads:[~2016-10-14 19:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 9:51 [Qemu-devel] [PATCH] rbd: make the code better readable Xiubo Li
2016-10-14 19:28 ` John Snow [this message]
2016-10-14 23:51 ` [Qemu-devel] [Qemu-block] " 李秀波
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=6eb7ea5f-2194-a99b-88c5-d21369827533@redhat.com \
--to=jsnow@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).