In preparation for adding support for primary_temp mappings, generalize
struct ceph_pg_mapping so it can hold mappings other than pg_temp.
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
struct ceph_pg_mapping {
struct rb_node node;
struct ceph_pg pgid;
- int len;
- int osds[];
+
+ union {
+ struct {
+ int len;
+ int osds[];
+ } pg_temp;
+ };
};
struct ceph_osdmap {
seq_printf(s, "pg_temp %llu.%x [", pg->pgid.pool,
pg->pgid.seed);
- for (i = 0; i < pg->len; i++)
+ for (i = 0; i < pg->pg_temp.len; i++)
seq_printf(s, "%s%d", (i == 0 ? "" : ","),
- pg->osds[i]);
+ pg->pg_temp.osds[i]);
seq_printf(s, "]\n");
}
return -ENOMEM;
pg->pgid = pgid;
- pg->len = len;
+ pg->pg_temp.len = len;
for (i = 0; i < len; i++)
- pg->osds[i] = ceph_decode_32(p);
+ pg->pg_temp.osds[i] = ceph_decode_32(p);
ret = __insert_pg_mapping(pg, &map->pg_temp);
if (ret) {
pool->pg_num_mask);
pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid);
if (pg) {
- *num = pg->len;
- return pg->osds;
+ *num = pg->pg_temp.len;
+ return pg->pg_temp.osds;
}
/* crush */