Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 309442
b: refs/heads/master
c: f671d4c
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed May 7, 2012
1 parent 6102a4b commit 0b9451d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 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: fc7c3ae5ab9246ad96aab4d0d57f67e9255cfb56
refs/heads/master: f671d4cd9b36691ac4ef42cde44c1b7a84e13631
5 changes: 5 additions & 0 deletions trunk/include/linux/crush/crush.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,9 @@ extern void crush_destroy_bucket_straw(struct crush_bucket_straw *b);
extern void crush_destroy_bucket(struct crush_bucket *b);
extern void crush_destroy(struct crush_map *map);

static inline int crush_calc_tree_node(int i)
{
return ((i+1) << 1)-1;
}

#endif
4 changes: 1 addition & 3 deletions trunk/net/ceph/crush/crush.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ int crush_get_bucket_item_weight(const struct crush_bucket *b, int p)
case CRUSH_BUCKET_LIST:
return ((struct crush_bucket_list *)b)->item_weights[p];
case CRUSH_BUCKET_TREE:
if (p & 1)
return ((struct crush_bucket_tree *)b)->node_weights[p];
return 0;
return ((struct crush_bucket_tree *)b)->node_weights[crush_calc_tree_node(p)];
case CRUSH_BUCKET_STRAW:
return ((struct crush_bucket_straw *)b)->item_weights[p];
}
Expand Down

0 comments on commit 0b9451d

Please sign in to comment.