From 8e07dbc083656a8437259495f6794ed127bd309b Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Mon, 3 Mar 2014 14:46:48 +0100 Subject: [PATCH] mon: crush_ruleset_create_erasure error codes Replace goto reply with error return and meaningfull error codes. Signed-off-by: Loic Dachary --- src/mon/OSDMonitor.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index ff4c887301880..7654000e621eb 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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; } } -- 2.39.5