summaryrefslogtreecommitdiffstats
path: root/src/crush
diff options
context:
space:
mode:
authorAdam Kupczyk <akupczyk@mirantis.com>2016-03-14 13:55:29 +0100
committerAdam Kupczyk <akupczyk@mirantis.com>2016-03-30 08:58:11 +0200
commit17feefbcb3105553b763cb7ce123b20b77b95857 (patch)
tree69d34fa90afe1683a6f3d58672ac2360d0503e72 /src/crush
parentMerge pull request #7947 from saru95/patch---2 (diff)
downloadceph-17feefbcb3105553b763cb7ce123b20b77b95857.tar.xz
ceph-17feefbcb3105553b763cb7ce123b20b77b95857.zip
Add ability of precise testing of placement group calculation.
Now pool id can be passed and proper JENKINS hash is used. Signed-off-by: Adam Kupczyk akupczyk@mirantis.com
Diffstat (limited to 'src/crush')
-rw-r--r--src/crush/CrushTester.cc6
-rw-r--r--src/crush/CrushTester.h7
2 files changed, 12 insertions, 1 deletions
diff --git a/src/crush/CrushTester.cc b/src/crush/CrushTester.cc
index 2ebe8c23d87..532c55ec7b9 100644
--- a/src/crush/CrushTester.cc
+++ b/src/crush/CrushTester.cc
@@ -640,7 +640,11 @@ int CrushTester::test()
if (use_crush) {
if (output_mappings)
err << "CRUSH"; // prepend CRUSH to placement output
- crush.do_rule(r, x, out, nr, weight);
+ uint32_t real_x = x;
+ if (pool_id != -1) {
+ real_x = crush_hash32_2(CRUSH_HASH_RJENKINS1, x, (uint32_t)pool_id);
+ }
+ crush.do_rule(r, real_x, out, nr, weight);
} else {
if (output_mappings)
err << "RNG"; // prepend RNG to placement output to denote simulation
diff --git a/src/crush/CrushTester.h b/src/crush/CrushTester.h
index bd625f3dda8..b05d1c3d4e0 100644
--- a/src/crush/CrushTester.h
+++ b/src/crush/CrushTester.h
@@ -18,6 +18,7 @@ class CrushTester {
int ruleset;
int min_x, max_x;
int min_rep, max_rep;
+ int64_t pool_id;
int num_batches;
bool use_crush;
@@ -172,6 +173,7 @@ public:
ruleset(-1),
min_x(-1), max_x(-1),
min_rep(-1), max_rep(-1),
+ pool_id(-1),
num_batches(1),
use_crush(true),
mark_down_device_ratio(0.0),
@@ -302,6 +304,11 @@ public:
void set_min_x(int x) {
min_x = x;
}
+
+ void set_pool_id(int64_t x){
+ pool_id = x;
+ }
+
int get_min_x() const {
return min_x;
}