diff options
author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-03-21 13:05:29 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2014-04-05 00:07:58 -0400 |
commit | 9686f94c8cfc06e8afb7b2233ab8f1f6ac01957f (patch) | |
tree | 3564192f1d42c7ac6caeafa0becd3bac88704538 /net/ceph | |
parent | 35a935d75d51abe58d3427a8b4ae3745a5a14e1c (diff) |
libceph: primary_temp infrastructure
Add primary_temp mappings infrastructure. struct ceph_pg_mapping is
overloaded, primary_temp mappings are stored in an rb-tree, rooted at
ceph_osdmap, in a manner similar to pg_temp mappings.
Dump primary_temp mappings to /sys/kernel/debug/ceph/<client>/osdmap,
one 'primary_temp <pgid> <osd>' per line, e.g:
primary_temp 2.6 4
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/debugfs.c | 7 | ||||
-rw-r--r-- | net/ceph/osdmap.c | 10 |
2 files changed, 16 insertions, 1 deletions
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c index 5865f2c9580a..612bf55e6a8b 100644 --- a/net/ceph/debugfs.c +++ b/net/ceph/debugfs.c | |||
@@ -93,6 +93,13 @@ static int osdmap_show(struct seq_file *s, void *p) | |||
93 | pg->pg_temp.osds[i]); | 93 | pg->pg_temp.osds[i]); |
94 | seq_printf(s, "]\n"); | 94 | seq_printf(s, "]\n"); |
95 | } | 95 | } |
96 | for (n = rb_first(&map->primary_temp); n; n = rb_next(n)) { | ||
97 | struct ceph_pg_mapping *pg = | ||
98 | rb_entry(n, struct ceph_pg_mapping, node); | ||
99 | |||
100 | seq_printf(s, "primary_temp %llu.%x %d\n", pg->pgid.pool, | ||
101 | pg->pgid.seed, pg->primary_temp.osd); | ||
102 | } | ||
96 | 103 | ||
97 | return 0; | 104 | return 0; |
98 | } | 105 | } |
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index c67a309fdfc2..c0fc517ab321 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
@@ -343,7 +343,7 @@ bad: | |||
343 | 343 | ||
344 | /* | 344 | /* |
345 | * rbtree of pg_mapping for handling pg_temp (explicit mapping of pgid | 345 | * rbtree of pg_mapping for handling pg_temp (explicit mapping of pgid |
346 | * to a set of osds) | 346 | * to a set of osds) and primary_temp (explicit primary setting) |
347 | */ | 347 | */ |
348 | static int pgid_cmp(struct ceph_pg l, struct ceph_pg r) | 348 | static int pgid_cmp(struct ceph_pg l, struct ceph_pg r) |
349 | { | 349 | { |
@@ -633,6 +633,13 @@ void ceph_osdmap_destroy(struct ceph_osdmap *map) | |||
633 | rb_erase(&pg->node, &map->pg_temp); | 633 | rb_erase(&pg->node, &map->pg_temp); |
634 | kfree(pg); | 634 | kfree(pg); |
635 | } | 635 | } |
636 | while (!RB_EMPTY_ROOT(&map->primary_temp)) { | ||
637 | struct ceph_pg_mapping *pg = | ||
638 | rb_entry(rb_first(&map->primary_temp), | ||
639 | struct ceph_pg_mapping, node); | ||
640 | rb_erase(&pg->node, &map->primary_temp); | ||
641 | kfree(pg); | ||
642 | } | ||
636 | while (!RB_EMPTY_ROOT(&map->pg_pools)) { | 643 | while (!RB_EMPTY_ROOT(&map->pg_pools)) { |
637 | struct ceph_pg_pool_info *pi = | 644 | struct ceph_pg_pool_info *pi = |
638 | rb_entry(rb_first(&map->pg_pools), | 645 | rb_entry(rb_first(&map->pg_pools), |
@@ -966,6 +973,7 @@ struct ceph_osdmap *ceph_osdmap_decode(void **p, void *end) | |||
966 | return ERR_PTR(-ENOMEM); | 973 | return ERR_PTR(-ENOMEM); |
967 | 974 | ||
968 | map->pg_temp = RB_ROOT; | 975 | map->pg_temp = RB_ROOT; |
976 | map->primary_temp = RB_ROOT; | ||
969 | mutex_init(&map->crush_scratch_mutex); | 977 | mutex_init(&map->crush_scratch_mutex); |
970 | 978 | ||
971 | ret = osdmap_decode(p, end, map); | 979 | ret = osdmap_decode(p, end, map); |