Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crush: fix tree node weight lookup

Fix the node weight lookup for tree buckets by using a correct accessor.

Reflects ceph.git commit d287ade5bcbdca82a3aef145b92924cf1e856733.

Reviewed-by: Alex Elder <elder@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>

Sage Weil f671d4cd fc7c3ae5

+6 -3
+5
include/linux/crush/crush.h
··· 166 166 extern void crush_destroy_bucket(struct crush_bucket *b); 167 167 extern void crush_destroy(struct crush_map *map); 168 168 169 + static inline int crush_calc_tree_node(int i) 170 + { 171 + return ((i+1) << 1)-1; 172 + } 173 + 169 174 #endif
+1 -3
net/ceph/crush/crush.c
··· 37 37 case CRUSH_BUCKET_LIST: 38 38 return ((struct crush_bucket_list *)b)->item_weights[p]; 39 39 case CRUSH_BUCKET_TREE: 40 - if (p & 1) 41 - return ((struct crush_bucket_tree *)b)->node_weights[p]; 42 - return 0; 40 + return ((struct crush_bucket_tree *)b)->node_weights[crush_calc_tree_node(p)]; 43 41 case CRUSH_BUCKET_STRAW: 44 42 return ((struct crush_bucket_straw *)b)->item_weights[p]; 45 43 }