summaryrefslogtreecommitdiffstats
path: root/net/ceph/osdmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ceph/osdmap.c')
-rw-r--r--net/ceph/osdmap.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index b8c3fde5b04f..15796696d64e 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -122,6 +122,22 @@ bad:
122 return -EINVAL; 122 return -EINVAL;
123} 123}
124 124
125static int crush_decode_straw2_bucket(void **p, void *end,
126 struct crush_bucket_straw2 *b)
127{
128 int j;
129 dout("crush_decode_straw2_bucket %p to %p\n", *p, end);
130 b->item_weights = kcalloc(b->h.size, sizeof(u32), GFP_NOFS);
131 if (b->item_weights == NULL)
132 return -ENOMEM;
133 ceph_decode_need(p, end, b->h.size * sizeof(u32), bad);
134 for (j = 0; j < b->h.size; j++)
135 b->item_weights[j] = ceph_decode_32(p);
136 return 0;
137bad:
138 return -EINVAL;
139}
140
125static int skip_name_map(void **p, void *end) 141static int skip_name_map(void **p, void *end)
126{ 142{
127 int len; 143 int len;
@@ -204,6 +220,9 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
204 case CRUSH_BUCKET_STRAW: 220 case CRUSH_BUCKET_STRAW:
205 size = sizeof(struct crush_bucket_straw); 221 size = sizeof(struct crush_bucket_straw);
206 break; 222 break;
223 case CRUSH_BUCKET_STRAW2:
224 size = sizeof(struct crush_bucket_straw2);
225 break;
207 default: 226 default:
208 err = -EINVAL; 227 err = -EINVAL;
209 goto bad; 228 goto bad;
@@ -261,6 +280,12 @@ static struct crush_map *crush_decode(void *pbyval, void *end)
261 if (err < 0) 280 if (err < 0)
262 goto bad; 281 goto bad;
263 break; 282 break;
283 case CRUSH_BUCKET_STRAW2:
284 err = crush_decode_straw2_bucket(p, end,
285 (struct crush_bucket_straw2 *)b);
286 if (err < 0)
287 goto bad;
288 break;
264 } 289 }
265 } 290 }
266 291