Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309440
b: refs/heads/master
c: 41ebcc0
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed May 7, 2012
1 parent 2acd2f5 commit 40eb8f5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 50 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0668216efe16ab1adf077e5f138775cee2af927a
refs/heads/master: 41ebcc0907c58f75d0b25afcaf8b9c35c6b1ad14
1 change: 0 additions & 1 deletion trunk/include/linux/crush/mapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ extern int crush_find_rule(const struct crush_map *map, int ruleset, int type, i
extern int crush_do_rule(const struct crush_map *map,
int ruleno,
int x, int *result, int result_max,
int forcefeed, /* -1 for none */
const __u32 *weights);

#endif
48 changes: 1 addition & 47 deletions trunk/net/ceph/crush/mapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,15 +463,12 @@ static int crush_choose(const struct crush_map *map,
* @x: hash input
* @result: pointer to result vector
* @result_max: maximum result size
* @force: force initial replica choice; -1 for none
*/
int crush_do_rule(const struct crush_map *map,
int ruleno, int x, int *result, int result_max,
int force, const __u32 *weight)
const __u32 *weight)
{
int result_len;
int force_context[CRUSH_MAX_DEPTH];
int force_pos = -1;
int a[CRUSH_MAX_SET];
int b[CRUSH_MAX_SET];
int c[CRUSH_MAX_SET];
Expand All @@ -497,42 +494,13 @@ int crush_do_rule(const struct crush_map *map,
w = a;
o = b;

/*
* determine hierarchical context of force, if any. note
* that this may or may not correspond to the specific types
* referenced by the crush rule. it will also only affect
* the first descent (TAKE).
*/
if (force >= 0 &&
force < map->max_devices &&
map->device_parents[force] != 0 &&
!is_out(map, weight, force, x)) {
while (1) {
force_context[++force_pos] = force;
if (force >= 0)
force = map->device_parents[force];
else
force = map->bucket_parents[-1-force];
if (force == 0)
break;
}
}

for (step = 0; step < rule->len; step++) {
struct crush_rule_step *curstep = &rule->steps[step];

firstn = 0;
switch (curstep->op) {
case CRUSH_RULE_TAKE:
w[0] = curstep->arg1;

/* find position in force_context/hierarchy */
while (force_pos >= 0 && force_context[force_pos] != w[0])
force_pos--;
/* and move past it */
if (force_pos >= 0)
force_pos--;

wsize = 1;
break;

Expand Down Expand Up @@ -567,20 +535,6 @@ int crush_do_rule(const struct crush_map *map,
continue;
}
j = 0;
if (osize == 0 && force_pos >= 0) {
/* skip any intermediate types */
while (force_pos &&
force_context[force_pos] < 0 &&
curstep->arg2 !=
map->buckets[-1 -
force_context[force_pos]]->type)
force_pos--;
o[osize] = force_context[force_pos];
if (recurse_to_leaf)
c[osize] = force_context[0];
j++;
force_pos--;
}
osize += crush_choose(map,
map->buckets[-1-w[i]],
weight,
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ceph/osdmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
pps += poolid;
*num = crush_do_rule(osdmap->crush, ruleno, pps, osds,
min_t(int, pool->v.size, *num),
-1, osdmap->osd_weight);
osdmap->osd_weight);
return osds;
}

Expand Down

0 comments on commit 40eb8f5

Please sign in to comment.