From 0b9451de1d300934b9ea1217a8f9a56d14d49974 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 7 May 2012 15:36:49 -0700 Subject: [PATCH] --- yaml --- r: 309442 b: refs/heads/master c: f671d4cd9b36691ac4ef42cde44c1b7a84e13631 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/crush/crush.h | 5 +++++ trunk/net/ceph/crush/crush.c | 4 +--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index df1d32447034..8b8b69c54358 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fc7c3ae5ab9246ad96aab4d0d57f67e9255cfb56 +refs/heads/master: f671d4cd9b36691ac4ef42cde44c1b7a84e13631 diff --git a/trunk/include/linux/crush/crush.h b/trunk/include/linux/crush/crush.h index 158a4d25ca83..7c4750811b96 100644 --- a/trunk/include/linux/crush/crush.h +++ b/trunk/include/linux/crush/crush.h @@ -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 diff --git a/trunk/net/ceph/crush/crush.c b/trunk/net/ceph/crush/crush.c index 2160791acf03..b93575f4eb13 100644 --- a/trunk/net/ceph/crush/crush.c +++ b/trunk/net/ceph/crush/crush.c @@ -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]; }