]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: crush_ruleset_create_erasure error codes
authorLoic Dachary <loic@dachary.org>
Mon, 3 Mar 2014 13:46:48 +0000 (14:46 +0100)
committerLoic Dachary <loic@dachary.org>
Mon, 17 Mar 2014 08:48:02 +0000 (09:48 +0100)
Replace goto reply with error return and meaningfull error codes.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/mon/OSDMonitor.cc

index ff4c887301880470175cc239a34bb14e331f91e6..7654000e621eb6f4f168bc0a3b717feaaa657537 100644 (file)
@@ -2812,32 +2812,29 @@ int OSDMonitor::crush_ruleset_create_erasure(const string &name,
                                             int *ruleset,
                                             stringstream &ss)
 {
-    if (osdmap.crush->rule_exists(name)) {
-      err = 0;
-      goto reply;
-    }
+    if (osdmap.crush->rule_exists(name))
+      return -EEXIST;
 
     CrushWrapper newcrush;
     _get_pending_crush(newcrush);
 
     if (newcrush.rule_exists(name)) {
-      err = 0;
+      return -EALREADY;
     } else {
       ErasureCodeInterfaceRef erasure_code;
       err = get_erasure_code(properties_map, &erasure_code, ss);
       if (err) {
        ss << "failed to load plugin using properties " << properties_map;
-       goto reply;
+       return err;
       }
 
       int rule = erasure_code->create_ruleset(name, newcrush, &ss);
       erasure_code.reset();
-      if (rule < 0) {
-       err = rule;
-       goto reply;
-      }
+      if (rule < 0)
+       return rule;
       pending_inc.crush.clear();
       newcrush.encode(pending_inc.crush);
+      return 0;
     }
 
 }