summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Dryomov <ilya.dryomov@inktank.com>2014-03-21 19:05:29 +0200
committerSage Weil <sage@inktank.com>2014-04-04 21:07:57 -0700
commit35a935d75d51abe58d3427a8b4ae3745a5a14e1c (patch)
tree0ad881fa4d6c3417e10d07cd6423751cf68e6a1f
parentec7af97258396161e6effba7e788c3fc3cb55263 (diff)
libceph: generalize ceph_pg_mapping
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>
-rw-r--r--include/linux/ceph/osdmap.h9
-rw-r--r--net/ceph/debugfs.c4
-rw-r--r--net/ceph/osdmap.c8
3 files changed, 13 insertions, 8 deletions
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 46c3e304c3d8..4837e58e3203 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -60,8 +60,13 @@ struct ceph_object_id {
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 {
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c
index c45d235e774e..5865f2c9580a 100644
--- a/net/ceph/debugfs.c
+++ b/net/ceph/debugfs.c
@@ -88,9 +88,9 @@ static int osdmap_show(struct seq_file *s, void *p)
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");
}
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index be2a65fbd902..c67a309fdfc2 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -822,9 +822,9 @@ static int __decode_pg_temp(void **p, void *end, struct ceph_osdmap *map,
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) {
@@ -1281,8 +1281,8 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
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 */