Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200844
b: refs/heads/master
c: a1a31e7
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed Jun 24, 2010
1 parent 94fc886 commit 5f7b392
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 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: 55bda7aacd13f5fdfeaafc16934953171405c692
refs/heads/master: a1a31e734241aefcb2b30fb0cc0376977b6d2ba8
38 changes: 25 additions & 13 deletions trunk/fs/ceph/crush/mapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,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("choose %d x=%d r=%d\n", in->id, x, r);
dprintk(" crush_bucket_choose %d x=%d r=%d\n", in->id, x, r);
switch (in->alg) {
case CRUSH_BUCKET_UNIFORM:
return bucket_uniform_choose((struct crush_bucket_uniform *)in,
Expand Down Expand Up @@ -305,7 +305,9 @@ static int crush_choose(struct crush_map *map,
int itemtype;
int collide, reject;
const int orig_tries = 5; /* attempts before we fall back to search */
dprintk("choose bucket %d x %d outpos %d\n", bucket->id, x, outpos);

dprintk("CHOOSE%s bucket %d x %d outpos %d numrep %d\n", recurse_to_leaf ? "_LEAF" : "",
bucket->id, x, outpos, numrep);

for (rep = outpos; rep < numrep; rep++) {
/* keep trying until we get a non-out, non-colliding item */
Expand Down Expand Up @@ -378,15 +380,25 @@ static int crush_choose(struct crush_map *map,
}
}

if (recurse_to_leaf &&
item < 0 &&
crush_choose(map, map->buckets[-1-item],
weight,
x, outpos+1, 0,
out2, outpos,
firstn, 0, NULL) <= outpos) {
reject = 1;
} else {
reject = 0;
if (recurse_to_leaf) {
if (item < 0) {
if (crush_choose(map,
map->buckets[-1-item],
weight,
x, outpos+1, 0,
out2, outpos,
firstn, 0,
NULL) <= outpos)
/* didn't get leaf */
reject = 1;
} else {
/* we already have a leaf! */
out2[outpos] = item;
}
}

if (!reject) {
/* out? */
if (itemtype == 0)
reject = is_out(map, weight,
Expand Down Expand Up @@ -425,12 +437,12 @@ static int crush_choose(struct crush_map *map,
continue;
}

dprintk("choose got %d\n", item);
dprintk("CHOOSE got %d\n", item);
out[outpos] = item;
outpos++;
}

dprintk("choose returns %d\n", outpos);
dprintk("CHOOSE returns %d\n", outpos);
return outpos;
}

Expand Down

0 comments on commit 5f7b392

Please sign in to comment.