[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen master] rbd: make the code more readable



commit e38f643a1de9b5afc1d133b12bcfdf205bc27654
Author:     Xiubo Li <lixiubo@xxxxxxxxxxxxxxxxxxxx>
AuthorDate: Sat Oct 15 16:26:13 2016 +0800
Commit:     Jeff Cody <jcody@xxxxxxxxxx>
CommitDate: Tue Nov 1 07:55:57 2016 -0400

    rbd: make the code more readable
    
    Make it a bit clearer and more readable.
    
    Signed-off-by: Xiubo Li <lixiubo@xxxxxxxxxxxxxxxxxxxx>
    Reviewed-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
    Reviewed-by: John Snow <jsnow@xxxxxxxxxx>
    Reviewed-by: Jeff Cody <jcody@xxxxxxxxxx>
    Message-id: 1476519973-6436-1-git-send-email-lixiubo@xxxxxxxxxxxxxxxxxxxx
    CC: John Snow <jsnow@xxxxxxxxxx>
    Signed-off-by: Jeff Cody <jcody@xxxxxxxxxx>
---
 block/rbd.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/block/rbd.c b/block/rbd.c
index f6e1d4b..a57b3e3 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -365,45 +365,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;
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.