]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: cleanup: use temp var for curstep
authorSage Weil <sage.weil@dreamhost.com>
Sun, 19 Feb 2012 19:59:11 +0000 (11:59 -0800)
committerSage Weil <sage.weil@dreamhost.com>
Sun, 19 Feb 2012 19:59:11 +0000 (11:59 -0800)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/crush/mapper.c

index eef875a35e86bac77b3b6a46a929f10491d47ae7..df195c7bff09b5e6591f38898d5781ef9389cbac 100644 (file)
@@ -519,10 +519,12 @@ int crush_do_rule(const struct crush_map *map,
        }
 
        for (step = 0; step < rule->len; step++) {
+               struct crush_rule_step *curstep = &rule->steps[step];
+
                firstn = 0;
-               switch (rule->steps[step].op) {
+               switch (curstep->op) {
                case CRUSH_RULE_TAKE:
-                       w[0] = rule->steps[step].arg1;
+                       w[0] = curstep->arg1;
 
                        /* find position in force_context/hierarchy */
                        while (force_pos >= 0 && force_context[force_pos] != w[0])
@@ -544,9 +546,9 @@ int crush_do_rule(const struct crush_map *map,
                                break;
 
                        recurse_to_leaf =
-                               rule->steps[step].op ==
+                               curstep->op ==
                                 CRUSH_RULE_CHOOSE_LEAF_FIRSTN ||
-                               rule->steps[step].op ==
+                               curstep->op ==
                                CRUSH_RULE_CHOOSE_LEAF_INDEP;
 
                        /* reset output */
@@ -558,7 +560,7 @@ int crush_do_rule(const struct crush_map *map,
                                 * basically, numrep <= 0 means relative to
                                 * the provided result_max
                                 */
-                               numrep = rule->steps[step].arg1;
+                               numrep = curstep->arg1;
                                if (numrep <= 0) {
                                        numrep += result_max;
                                        if (numrep <= 0)
@@ -569,7 +571,7 @@ int crush_do_rule(const struct crush_map *map,
                                        /* skip any intermediate types */
                                        while (force_pos &&
                                               force_context[force_pos] < 0 &&
-                                              rule->steps[step].arg2 !=
+                                              curstep->arg2 !=
                                               map->buckets[-1 -
                                               force_context[force_pos]]->type)
                                                force_pos--;
@@ -583,7 +585,7 @@ int crush_do_rule(const struct crush_map *map,
                                                      map->buckets[-1-w[i]],
                                                      weight,
                                                      x, numrep,
-                                                     rule->steps[step].arg2,
+                                                     curstep->arg2,
                                                      o+osize, j,
                                                      firstn,
                                                      recurse_to_leaf, c+osize);
@@ -611,7 +613,7 @@ int crush_do_rule(const struct crush_map *map,
 
                default:
                        dprintk(" unknown op %d at step %d\n",
-                               rule->steps[step].op, step);
+                               curstep->op, step);
                        break;
                }
        }