From: Sage Weil Date: Fri, 20 May 2011 23:41:16 +0000 (-0700) Subject: crush: fix tree bucket encoding X-Git-Tag: v0.29~42^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9a14402a08b39f201c0de388eb1a20056baeaffd;p=ceph.git crush: fix tree bucket encoding I wonder how long this has been broken! Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index e9075c56198..193b7c8507d 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -439,6 +439,9 @@ public: ::encode(((crush_bucket_straw*)crush->buckets[i])->straws[j], bl); } break; + default: + assert(0); + break; } } @@ -579,12 +582,10 @@ public: } case CRUSH_BUCKET_TREE: { - unsigned num_nodes; crush_bucket_tree* cbt = (crush_bucket_tree*)bucket; - ::decode(num_nodes, blp); - cbt->num_nodes = num_nodes; - cbt->node_weights = (__u32*)calloc(1, num_nodes * sizeof(__u32)); - for (unsigned j=0; jnum_nodes, blp); + cbt->node_weights = (__u32*)calloc(1, cbt->num_nodes * sizeof(__u32)); + for (unsigned j=0; jnum_nodes; j++) { ::decode(cbt->node_weights[j], blp); } break;