-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ceph#1477 from dachary/wip-erasure-code-profiles
replace properties with erasure code profiles Reviewed-by: Sage Weil <[email protected]>
- Loading branch information
Showing
34 changed files
with
1,030 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/* | ||
* Ceph - scalable distributed file system | ||
* | ||
* Copyright (C) 2013 Cloudwatt <[email protected]> | ||
* Copyright (C) 2013,2014 Cloudwatt <[email protected]> | ||
* | ||
* Author: Loic Dachary <[email protected]> | ||
* | ||
|
@@ -14,21 +14,11 @@ | |
* | ||
*/ | ||
|
||
#include "common/debug.h" | ||
|
||
#include <errno.h> | ||
#include <dlfcn.h> | ||
|
||
#include "ErasureCodePlugin.h" | ||
|
||
#define dout_subsys ceph_subsys_osd | ||
#undef dout_prefix | ||
#define dout_prefix _prefix(_dout) | ||
|
||
static ostream& _prefix(std::ostream* _dout) | ||
{ | ||
return *_dout << "ErasureCodePlugin: "; | ||
} | ||
|
||
#define PLUGIN_PREFIX "libec_" | ||
#define PLUGIN_SUFFIX ".so" | ||
#define PLUGIN_INIT_FUNCTION "__erasure_code_init" | ||
|
@@ -75,14 +65,15 @@ ErasureCodePlugin *ErasureCodePluginRegistry::get(const std::string &name) | |
|
||
int ErasureCodePluginRegistry::factory(const std::string &plugin_name, | ||
const map<std::string,std::string> ¶meters, | ||
ErasureCodeInterfaceRef *erasure_code) | ||
ErasureCodeInterfaceRef *erasure_code, | ||
ostream &ss) | ||
{ | ||
Mutex::Locker l(lock); | ||
ErasureCodePlugin *plugin = get(plugin_name); | ||
if (plugin == 0) { | ||
int r = 0; | ||
loading = true; | ||
r = load(plugin_name, parameters, &plugin); | ||
r = load(plugin_name, parameters, &plugin, ss); | ||
loading = false; | ||
if (r != 0) | ||
return r; | ||
|
@@ -93,18 +84,16 @@ int ErasureCodePluginRegistry::factory(const std::string &plugin_name, | |
|
||
int ErasureCodePluginRegistry::load(const std::string &plugin_name, | ||
const map<std::string,std::string> ¶meters, | ||
ErasureCodePlugin **plugin) | ||
ErasureCodePlugin **plugin, | ||
ostream &ss) | ||
{ | ||
assert(parameters.count("erasure-code-directory") != 0); | ||
std::string fname = parameters.find("erasure-code-directory")->second | ||
assert(parameters.count("directory") != 0); | ||
std::string fname = parameters.find("directory")->second | ||
+ "/" PLUGIN_PREFIX | ||
+ plugin_name + PLUGIN_SUFFIX; | ||
dout(10) << "load " << plugin_name << " from " << fname << dendl; | ||
|
||
void *library = dlopen(fname.c_str(), RTLD_NOW); | ||
if (!library) { | ||
derr << "load dlopen(" << fname | ||
<< "): " << dlerror() << dendl; | ||
ss << "load dlopen(" << fname << "): " << dlerror(); | ||
return -EIO; | ||
} | ||
|
||
|
@@ -114,23 +103,23 @@ int ErasureCodePluginRegistry::load(const std::string &plugin_name, | |
std::string name = plugin_name; | ||
int r = erasure_code_init(name.c_str()); | ||
if (r != 0) { | ||
derr << "erasure_code_init(" << plugin_name | ||
<< "): " << strerror(-r) << dendl; | ||
ss << "erasure_code_init(" << plugin_name | ||
<< "): " << strerror(-r); | ||
dlclose(library); | ||
return r; | ||
} | ||
} else { | ||
derr << "load dlsym(" << fname | ||
<< ", " << PLUGIN_INIT_FUNCTION | ||
<< "): " << dlerror() << dendl; | ||
ss << "load dlsym(" << fname | ||
<< ", " << PLUGIN_INIT_FUNCTION | ||
<< "): " << dlerror(); | ||
dlclose(library); | ||
return -ENOENT; | ||
} | ||
|
||
*plugin = get(plugin_name); | ||
if (*plugin == 0) { | ||
derr << "load " << PLUGIN_INIT_FUNCTION << "()" | ||
<< "did not register " << plugin_name << dendl; | ||
ss << "load " << PLUGIN_INIT_FUNCTION << "()" | ||
<< "did not register " << plugin_name; | ||
dlclose(library); | ||
return -EBADF; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/* | ||
* Ceph - scalable distributed file system | ||
* | ||
* Copyright (C) 2013 Cloudwatt <[email protected]> | ||
* Copyright (C) 2013,2014 Cloudwatt <[email protected]> | ||
* | ||
* Author: Loic Dachary <[email protected]> | ||
* | ||
|
@@ -56,14 +56,16 @@ namespace ceph { | |
|
||
int factory(const std::string &plugin, | ||
const map<std::string,std::string> ¶meters, | ||
ErasureCodeInterfaceRef *erasure_code); | ||
ErasureCodeInterfaceRef *erasure_code, | ||
ostream &ss); | ||
|
||
int add(const std::string &name, ErasureCodePlugin *plugin); | ||
ErasureCodePlugin *get(const std::string &name); | ||
|
||
int load(const std::string &plugin_name, | ||
const map<std::string,std::string> ¶meters, | ||
ErasureCodePlugin **plugin); | ||
ErasureCodePlugin **plugin, | ||
ostream &ss); | ||
|
||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/* | ||
* Ceph - scalable distributed file system | ||
* | ||
* Copyright (C) 2013 Cloudwatt <[email protected]> | ||
* Copyright (C) 2013,2014 Cloudwatt <[email protected]> | ||
* | ||
* Author: Loic Dachary <[email protected]> | ||
* | ||
|
@@ -50,10 +50,10 @@ 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"); | ||
parameter = parameters.find("ruleset-root"); | ||
if (parameter != parameters.end()) | ||
ruleset_root = parameter->second; | ||
parameter = parameters.find("erasure-code-ruleset-failure-domain"); | ||
parameter = parameters.find("ruleset-failure-domain"); | ||
if (parameter != parameters.end()) | ||
ruleset_failure_domain = parameter->second; | ||
parse(parameters); | ||
|
@@ -248,9 +248,9 @@ unsigned ErasureCodeJerasureReedSolomonVandermonde::get_alignment() const | |
|
||
void ErasureCodeJerasureReedSolomonVandermonde::parse(const map<std::string,std::string> ¶meters) | ||
{ | ||
k = to_int("erasure-code-k", parameters, DEFAULT_K); | ||
m = to_int("erasure-code-m", parameters, DEFAULT_M); | ||
w = to_int("erasure-code-w", parameters, DEFAULT_W); | ||
k = to_int("k", parameters, DEFAULT_K); | ||
m = to_int("m", parameters, DEFAULT_M); | ||
w = to_int("w", parameters, DEFAULT_W); | ||
if (w != 8 && w != 16 && w != 32) { | ||
derr << "ReedSolomonVandermonde: w=" << w | ||
<< " must be one of {8, 16, 32} : revert to 8 " << dendl; | ||
|
@@ -291,9 +291,9 @@ unsigned ErasureCodeJerasureReedSolomonRAID6::get_alignment() const | |
|
||
void ErasureCodeJerasureReedSolomonRAID6::parse(const map<std::string,std::string> ¶meters) | ||
{ | ||
k = to_int("erasure-code-k", parameters, DEFAULT_K); | ||
k = to_int("k", parameters, DEFAULT_K); | ||
m = 2; | ||
w = to_int("erasure-code-w", parameters, DEFAULT_W); | ||
w = to_int("w", parameters, DEFAULT_W); | ||
if (w != 8 && w != 16 && w != 32) { | ||
derr << "ReedSolomonRAID6: w=" << w | ||
<< " must be one of {8, 16, 32} : revert to 8 " << dendl; | ||
|
@@ -336,10 +336,10 @@ unsigned ErasureCodeJerasureCauchy::get_alignment() const | |
|
||
void ErasureCodeJerasureCauchy::parse(const map<std::string,std::string> ¶meters) | ||
{ | ||
k = to_int("erasure-code-k", parameters, DEFAULT_K); | ||
m = to_int("erasure-code-m", parameters, DEFAULT_M); | ||
w = to_int("erasure-code-w", parameters, DEFAULT_W); | ||
packetsize = to_int("erasure-code-packetsize", parameters, DEFAULT_PACKETSIZE); | ||
k = to_int("k", parameters, DEFAULT_K); | ||
m = to_int("m", parameters, DEFAULT_M); | ||
w = to_int("w", parameters, DEFAULT_W); | ||
packetsize = to_int("packetsize", parameters, DEFAULT_PACKETSIZE); | ||
} | ||
|
||
void ErasureCodeJerasureCauchy::prepare_schedule(int *matrix) | ||
|
@@ -406,10 +406,10 @@ unsigned ErasureCodeJerasureLiberation::get_alignment() const | |
|
||
void ErasureCodeJerasureLiberation::parse(const map<std::string,std::string> ¶meters) | ||
{ | ||
k = to_int("erasure-code-k", parameters, DEFAULT_K); | ||
m = to_int("erasure-code-m", parameters, DEFAULT_M); | ||
w = to_int("erasure-code-w", parameters, DEFAULT_W); | ||
packetsize = to_int("erasure-code-packetsize", parameters, DEFAULT_PACKETSIZE); | ||
k = to_int("k", parameters, DEFAULT_K); | ||
m = to_int("m", parameters, DEFAULT_M); | ||
w = to_int("w", parameters, DEFAULT_W); | ||
packetsize = to_int("packetsize", parameters, DEFAULT_PACKETSIZE); | ||
|
||
bool error = false; | ||
if (k > w) { | ||
|
@@ -458,10 +458,10 @@ void ErasureCodeJerasureBlaumRoth::prepare() | |
// | ||
void ErasureCodeJerasureLiber8tion::parse(const map<std::string,std::string> ¶meters) | ||
{ | ||
k = to_int("erasure-code-k", parameters, DEFAULT_K); | ||
k = to_int("k", parameters, DEFAULT_K); | ||
m = DEFAULT_M; | ||
w = DEFAULT_W; | ||
packetsize = to_int("erasure-code-packetsize", parameters, DEFAULT_PACKETSIZE); | ||
packetsize = to_int("packetsize", parameters, DEFAULT_PACKETSIZE); | ||
|
||
bool error = false; | ||
if (k > w) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
/* | ||
* Ceph - scalable distributed file system | ||
* | ||
* Copyright (C) 2013 Cloudwatt <[email protected]> | ||
* Copyright (C) 2013,2014 Cloudwatt <[email protected]> | ||
* | ||
* Author: Loic Dachary <[email protected]> | ||
* | ||
|
@@ -33,8 +33,8 @@ class ErasureCodePluginJerasure : public ErasureCodePlugin { | |
ErasureCodeInterfaceRef *erasure_code) { | ||
ErasureCodeJerasure *interface; | ||
std::string t; | ||
if (parameters.find("erasure-code-technique") != parameters.end()) | ||
t = parameters.find("erasure-code-technique")->second; | ||
if (parameters.find("technique") != parameters.end()) | ||
t = parameters.find("technique")->second; | ||
if (t == "reed_sol_van") { | ||
interface = new ErasureCodeJerasureReedSolomonVandermonde(); | ||
} else if (t == "reed_sol_r6_op") { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.