diff options
author | Sage Weil <sage@newdream.net> | 2008-03-20 00:43:03 +0100 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2008-03-20 02:19:36 +0100 |
commit | a31efa9db60367ee76b8d53d5a25f2d3c10ae8cd (patch) | |
tree | 4819a69a8e017ee71ce9ad1796f5b93dac92e227 /src/crush/crush.c | |
parent | buffer::read_file into pages to avoid c++ allocator's disagreement with perl (diff) | |
download | ceph-a31efa9db60367ee76b8d53d5a25f2d3c10ae8cd.tar.xz ceph-a31efa9db60367ee76b8d53d5a25f2d3c10ae8cd.zip |
crush: store item_weight with straw buckets; crushtool progress
Diffstat (limited to 'src/crush/crush.c')
-rw-r--r-- | src/crush/crush.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/crush/crush.c b/src/crush/crush.c index 843f91da618..26ec8530f2a 100644 --- a/src/crush/crush.c +++ b/src/crush/crush.c @@ -8,6 +8,26 @@ #include "crush.h" +int crush_get_bucket_item_weight(struct crush_bucket *b, int pos) +{ + if (pos >= b->size) + return 0; + switch (b->alg) { + case CRUSH_BUCKET_UNIFORM: + return ((struct crush_bucket_uniform*)b)->item_weight; + case CRUSH_BUCKET_LIST: + return ((struct crush_bucket_list*)b)->item_weights[pos]; + case CRUSH_BUCKET_TREE: + if (pos & 1) + return ((struct crush_bucket_tree*)b)->node_weights[pos]; + return 0; + case CRUSH_BUCKET_STRAW: + return ((struct crush_bucket_straw*)b)->item_weights[pos]; + } + return 0; +} + + void crush_calc_parents(struct crush_map *map) { int i, b, c; @@ -48,6 +68,7 @@ void crush_destroy_bucket_tree(struct crush_bucket_tree *b) void crush_destroy_bucket_straw(struct crush_bucket_straw *b) { free(b->straws); + free(b->item_weights); free(b->h.items); free(b); } |