#include <algorithm>
#include "common/debug.h"
#include "ErasureCodeJerasure.h"
+#include "crush/CrushWrapper.h"
+#include "osd/osd_types.h"
#include "vectorop.h"
extern "C" {
#include "jerasure.h"
return *_dout << "ErasureCodeJerasure: ";
}
-void ErasureCodeJerasure::init(const map<std::string,std::string> ¶meters)
+int ErasureCodeJerasure::create_ruleset(const string &name,
+ CrushWrapper &crush,
+ ostream *ss) const
+{
+ return crush.add_simple_ruleset(name, ruleset_root, ruleset_failure_domain,
+ "indep", pg_pool_t::TYPE_ERASURE, ss);
+}
+
+void ErasureCodeJerasure::init(const map<string,string> ¶meters)
{
dout(10) << "technique=" << technique << dendl;
+ map<string,string>::const_iterator parameter;
+ parameter = parameters.find("erasure-code-ruleset-root");
+ if (parameter != parameters.end())
+ ruleset_root = parameter->second;
+ parameter = parameters.find("erasure-code-ruleset-failure-domain");
+ if (parameter != parameters.end())
+ ruleset_failure_domain = parameter->second;
parse(parameters);
prepare();
}
int m;
int w;
const char *technique;
+ string ruleset_root;
+ string ruleset_failure_domain;
ErasureCodeJerasure(const char *_technique) :
- technique(_technique)
+ technique(_technique),
+ ruleset_root("default"),
+ ruleset_failure_domain("host")
{}
virtual ~ErasureCodeJerasure() {}
+ virtual int create_ruleset(const string &name,
+ CrushWrapper &crush,
+ ostream *ss) const;
+
virtual unsigned int get_chunk_count() const {
return k + m;
}
libec_jerasure_la_CFLAGS = ${AM_CFLAGS}
libec_jerasure_la_CXXFLAGS= ${AM_CXXFLAGS}
-libec_jerasure_la_LIBADD = $(PTHREAD_LIBS) $(EXTRALIBS)
+libec_jerasure_la_LIBADD = $(LIBCRUSH) $(PTHREAD_LIBS) $(EXTRALIBS)
libec_jerasure_la_LDFLAGS = ${AM_LDFLAGS} -version-info 1:0:0
if LINUX
libec_jerasure_la_LDFLAGS += -export-symbols-regex '.*__erasure_code_.*'