aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/crush/crush.h5
-rw-r--r--net/ceph/crush/crush.c4
2 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h
index 158a4d25ca83..7c4750811b96 100644
--- a/include/linux/crush/crush.h
+++ b/include/linux/crush/crush.h
@@ -166,4 +166,9 @@ extern void crush_destroy_bucket_straw(struct crush_bucket_straw *b);
166extern void crush_destroy_bucket(struct crush_bucket *b); 166extern void crush_destroy_bucket(struct crush_bucket *b);
167extern void crush_destroy(struct crush_map *map); 167extern void crush_destroy(struct crush_map *map);
168 168
169static inline int crush_calc_tree_node(int i)
170{
171 return ((i+1) << 1)-1;
172}
173
169#endif 174#endif
diff --git a/net/ceph/crush/crush.c b/net/ceph/crush/crush.c
index 2160791acf03..b93575f4eb13 100644
--- a/net/ceph/crush/crush.c
+++ b/net/ceph/crush/crush.c
@@ -37,9 +37,7 @@ int crush_get_bucket_item_weight(const struct crush_bucket *b, int p)
37 case CRUSH_BUCKET_LIST: 37 case CRUSH_BUCKET_LIST:
38 return ((struct crush_bucket_list *)b)->item_weights[p]; 38 return ((struct crush_bucket_list *)b)->item_weights[p];
39 case CRUSH_BUCKET_TREE: 39 case CRUSH_BUCKET_TREE:
40 if (p & 1) 40 return ((struct crush_bucket_tree *)b)->node_weights[crush_calc_tree_node(p)];
41 return ((struct crush_bucket_tree *)b)->node_weights[p];
42 return 0;
43 case CRUSH_BUCKET_STRAW: 41 case CRUSH_BUCKET_STRAW:
44 return ((struct crush_bucket_straw *)b)->item_weights[p]; 42 return ((struct crush_bucket_straw *)b)->item_weights[p];
45 } 43 }