]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/mapper: pass parent r value for indep call
authorSage Weil <sage@inktank.com>
Tue, 3 Dec 2013 01:17:13 +0000 (17:17 -0800)
committerSage Weil <sage@inktank.com>
Tue, 3 Dec 2013 22:41:25 +0000 (14:41 -0800)
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).

Signed-off-by: Sage Weil <sage@inktank.com>
src/crush/mapper.c

index 61ea18753e4881670653fefaa2fbbf4db2c0832a..0aa07b742e5385458fbbc2a580ec00c5802e0cd2 100644 (file)
@@ -458,8 +458,9 @@ static void crush_choose_indep(const struct crush_map *map,
                              const __u32 *weight, int weight_max,
                              int *out, int outpos,
                              int recurse_to_leaf,
-                             int *out2)
                               int x, int left, int numrep, int type,
+                              int *out2,
+                              int parent_r)
 {
        struct crush_bucket *in = bucket;
        int endpos = outpos + left;
@@ -498,7 +499,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 &&
@@ -565,8 +566,8 @@ static void crush_choose_indep(const struct crush_map *map,
                                                                   map->buckets[-1-item],
                                                                   weight, weight_max,
                                                                   out2, rep,
-                                                                  0, NULL);
                                                   x, 1, numrep, 0,
+                                                  0, NULL, r);
                                                if (out2[rep] == CRUSH_ITEM_NONE) {
                                                        /* placed nothing; no leaf */
                                                        break;
@@ -698,7 +699,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;
                                }
                        }