Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309438
b: refs/heads/master
c: a1f4895
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed May 7, 2012
1 parent 37aaca1 commit 24ac6a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 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: c90f95ed46393e29d843686e21947d1c6fcb1164
refs/heads/master: a1f4895be8bf1ba56c2306b058f51619e9b0e8f8
33 changes: 24 additions & 9 deletions trunk/net/ceph/crush/mapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ static int bucket_list_choose(struct crush_bucket_list *bucket,
return bucket->h.items[i];
}

BUG_ON(1);
return 0;
dprintk("bad list sums for bucket %d\n", bucket->h.id);
return bucket->h.items[0];
}


Expand Down Expand Up @@ -239,6 +239,7 @@ static int bucket_straw_choose(struct crush_bucket_straw *bucket,
static int crush_bucket_choose(struct crush_bucket *in, int x, int r)
{
dprintk(" crush_bucket_choose %d x=%d r=%d\n", in->id, x, r);
BUG_ON(in->size == 0);
switch (in->alg) {
case CRUSH_BUCKET_UNIFORM:
return bucket_uniform_choose((struct crush_bucket_uniform *)in,
Expand All @@ -253,7 +254,7 @@ static int crush_bucket_choose(struct crush_bucket *in, int x, int r)
return bucket_straw_choose((struct crush_bucket_straw *)in,
x, r);
default:
BUG_ON(1);
dprintk("unknown bucket %d alg %d\n", in->id, in->alg);
return in->items[0];
}
}
Expand Down Expand Up @@ -354,7 +355,11 @@ static int crush_choose(const struct crush_map *map,
item = bucket_perm_choose(in, x, r);
else
item = crush_bucket_choose(in, x, r);
BUG_ON(item >= map->max_devices);
if (item >= map->max_devices) {
dprintk(" bad item %d\n", item);
skip_rep = 1;
break;
}

/* desired type? */
if (item < 0)
Expand All @@ -365,8 +370,12 @@ static int crush_choose(const struct crush_map *map,

/* keep going? */
if (itemtype != type) {
BUG_ON(item >= 0 ||
(-1-item) >= map->max_buckets);
if (item >= 0 ||
(-1-item) >= map->max_buckets) {
dprintk(" bad item type %d\n", type);
skip_rep = 1;
break;
}
in = map->buckets[-1-item];
retry_bucket = 1;
continue;
Expand Down Expand Up @@ -478,7 +487,10 @@ int crush_do_rule(const struct crush_map *map,
int numrep;
int firstn;

BUG_ON(ruleno >= map->max_rules);
if ((__u32)ruleno >= map->max_rules) {
dprintk(" bad ruleno %d\n", ruleno);
return 0;
}

rule = map->rules[ruleno];
result_len = 0;
Expand Down Expand Up @@ -528,7 +540,8 @@ int crush_do_rule(const struct crush_map *map,
firstn = 1;
case CRUSH_RULE_CHOOSE_LEAF_INDEP:
case CRUSH_RULE_CHOOSE_INDEP:
BUG_ON(wsize == 0);
if (wsize == 0)
break;

recurse_to_leaf =
rule->steps[step].op ==
Expand Down Expand Up @@ -597,7 +610,9 @@ int crush_do_rule(const struct crush_map *map,
break;

default:
BUG_ON(1);
dprintk(" unknown op %d at step %d\n",
curstep->op, step);
break;
}
}
return result_len;
Expand Down

0 comments on commit 24ac6a6

Please sign in to comment.