]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: avoid redundant value assignement
authorChangcheng Liu <changcheng.liu@aliyun.com>
Thu, 20 Aug 2020 02:07:16 +0000 (10:07 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Thu, 20 Aug 2020 03:27:52 +0000 (11:27 +0800)
memset(bucket, 0, sizeof(*bucket)) has set all bucket
field to be zero

Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
src/crush/builder.c

index 68dfcb69bc1749d23461fc344341f90db7e19dcb..27b1319ce5ebb4a703691b3a26553180bda8020b 100644 (file)
@@ -339,10 +339,6 @@ crush_make_tree_bucket(int hash, int type, int size,
        bucket->h.size = size;
 
        if (size == 0) {
-               bucket->h.items = NULL;
-               bucket->h.weight = 0;
-               bucket->node_weights = NULL;
-               bucket->num_nodes = 0;
                /* printf("size 0 depth 0 nodes 0\n"); */
                return bucket;
        }
@@ -572,7 +568,6 @@ crush_make_straw_bucket(struct crush_map *map,
         if (!bucket->straws)
                 goto err;
 
-        bucket->h.weight = 0;
        for (i=0; i<size; i++) {
                bucket->h.items[i] = items[i];
                bucket->h.weight += weights[i];
@@ -618,7 +613,6 @@ crush_make_straw2_bucket(struct crush_map *map,
         if (!bucket->item_weights)
                 goto err;
 
-        bucket->h.weight = 0;
        for (i=0; i<size; i++) {
                bucket->h.items[i] = items[i];
                bucket->h.weight += weights[i];