diff options
author | Sage Weil <sage@newdream.net> | 2010-02-16 18:55:03 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-02-17 13:02:49 -0500 |
commit | 4fc51be8fa7043ff9a1e34fef0e99214373332ac (patch) | |
tree | beba3bc83b5a07a16bb63c6e80713cb2b42bf4fb /fs/ceph/debugfs.c | |
parent | 9794b146fa7b93f8ab74fb62d67fdefad760769f (diff) |
ceph: use rbtree for pg pools; decode new osdmap format
Since we can now create and destroy pg pools, the pool ids will be sparse,
and an array no longer makes sense for looking up by pool id. Use an
rbtree instead.
The OSDMap encoding also no longer has a max pool count (previously used to
allocate the array). There is a new pool_max, that is the largest pool id
we've ever used, although we don't actually need it in the client.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/debugfs.c')
-rw-r--r-- | fs/ceph/debugfs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c index 1a47b5c25b5f..e159f1415110 100644 --- a/fs/ceph/debugfs.c +++ b/fs/ceph/debugfs.c | |||
@@ -78,6 +78,7 @@ static int osdmap_show(struct seq_file *s, void *p) | |||
78 | { | 78 | { |
79 | int i; | 79 | int i; |
80 | struct ceph_client *client = s->private; | 80 | struct ceph_client *client = s->private; |
81 | struct rb_node *n; | ||
81 | 82 | ||
82 | if (client->osdc.osdmap == NULL) | 83 | if (client->osdc.osdmap == NULL) |
83 | return 0; | 84 | return 0; |
@@ -87,11 +88,11 @@ static int osdmap_show(struct seq_file *s, void *p) | |||
87 | " NEARFULL" : "", | 88 | " NEARFULL" : "", |
88 | (client->osdc.osdmap->flags & CEPH_OSDMAP_FULL) ? | 89 | (client->osdc.osdmap->flags & CEPH_OSDMAP_FULL) ? |
89 | " FULL" : ""); | 90 | " FULL" : ""); |
90 | for (i = 0; i < client->osdc.osdmap->num_pools; i++) { | 91 | for (n = rb_first(&client->osdc.osdmap->pg_pools); n; n = rb_next(n)) { |
91 | struct ceph_pg_pool_info *pool = | 92 | struct ceph_pg_pool_info *pool = |
92 | &client->osdc.osdmap->pg_pool[i]; | 93 | rb_entry(n, struct ceph_pg_pool_info, node); |
93 | seq_printf(s, "pg_pool %d pg_num %d / %d, lpg_num %d / %d\n", | 94 | seq_printf(s, "pg_pool %d pg_num %d / %d, lpg_num %d / %d\n", |
94 | i, pool->v.pg_num, pool->pg_num_mask, | 95 | pool->id, pool->v.pg_num, pool->pg_num_mask, |
95 | pool->v.lpg_num, pool->lpg_num_mask); | 96 | pool->v.lpg_num, pool->lpg_num_mask); |
96 | } | 97 | } |
97 | for (i = 0; i < client->osdc.osdmap->max_osd; i++) { | 98 | for (i = 0; i < client->osdc.osdmap->max_osd; i++) { |