summaryrefslogtreecommitdiffstats
path: root/net/ceph/crush
diff options
context:
space:
mode:
authorIlya Dryomov <ilya.dryomov@inktank.com>2013-12-24 21:19:25 +0200
committerIlya Dryomov <ilya.dryomov@inktank.com>2013-12-31 20:32:20 +0200
commit4158608139de02f5265ec4f41774af7418911016 (patch)
treefe6b1afc043898e2e8de75dfa59dc32024ebe1af /net/ceph/crush
parentab4ce2b5bdb5ca416756df3df6f5c63667a05065 (diff)
downloadlinux-4158608139de02f5265ec4f41774af7418911016.tar.gz
linux-4158608139de02f5265ec4f41774af7418911016.tar.bz2
linux-4158608139de02f5265ec4f41774af7418911016.zip
crush: pass parent r value for indep call
Pass down the parent's 'r' value so that we will sample different values in the recursive call when the parent tries multiple times. This avoids doing useless work (calling multiple times and trying the same values). Reflects ceph.git commit 2731d3030d7a3e80922b7f1b7756f9a4a124bac5. Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph/crush')
-rw-r--r--net/ceph/crush/mapper.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c
index 125dbd04f2b6..c727836b5860 100644
--- a/net/ceph/crush/mapper.c
+++ b/net/ceph/crush/mapper.c
@@ -460,7 +460,8 @@ static void crush_choose_indep(const struct crush_map *map,
int x, int left, int numrep, int type,
int *out, int outpos,
int recurse_to_leaf,
- int *out2)
+ int *out2,
+ int parent_r)
{
struct crush_bucket *in = bucket;
int endpos = outpos + left;
@@ -499,7 +500,7 @@ static void crush_choose_indep(const struct crush_map *map,
* this will involve more devices in data
* movement and tend to distribute the load.
*/
- r = rep;
+ r = rep + parent_r;
/* be careful */
if (in->alg == CRUSH_BUCKET_UNIFORM &&
@@ -567,7 +568,7 @@ static void crush_choose_indep(const struct crush_map *map,
weight, weight_max,
x, 1, numrep, 0,
out2, rep,
- 0, NULL);
+ 0, NULL, r);
if (out2[rep] == CRUSH_ITEM_NONE) {
/* placed nothing; no leaf */
break;
@@ -702,7 +703,8 @@ int crush_do_rule(const struct crush_map *map,
curstep->arg2,
o+osize, j,
recurse_to_leaf,
- c+osize);
+ c+osize,
+ 0);
osize += numrep;
}
}