Commit b4f34795 authored by Ilya Dryomov's avatar Ilya Dryomov

libceph: take osdc->lock in osdmap_show() and dump flags in hex

There is now about a dozen CEPH_OSDMAP_* flags.  This is a debugging
interface, so just dump in hex instead of spelling each flag out.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 4609245e
...@@ -54,16 +54,15 @@ static int osdmap_show(struct seq_file *s, void *p) ...@@ -54,16 +54,15 @@ static int osdmap_show(struct seq_file *s, void *p)
{ {
int i; int i;
struct ceph_client *client = s->private; struct ceph_client *client = s->private;
struct ceph_osdmap *map = client->osdc.osdmap; struct ceph_osd_client *osdc = &client->osdc;
struct ceph_osdmap *map = osdc->osdmap;
struct rb_node *n; struct rb_node *n;
if (map == NULL) if (map == NULL)
return 0; return 0;
seq_printf(s, "epoch %d\n", map->epoch); down_read(&osdc->lock);
seq_printf(s, "flags%s%s\n", seq_printf(s, "epoch %d flags 0x%x\n", map->epoch, map->flags);
(map->flags & CEPH_OSDMAP_NEARFULL) ? " NEARFULL" : "",
(map->flags & CEPH_OSDMAP_FULL) ? " FULL" : "");
for (n = rb_first(&map->pg_pools); n; n = rb_next(n)) { for (n = rb_first(&map->pg_pools); n; n = rb_next(n)) {
struct ceph_pg_pool_info *pi = struct ceph_pg_pool_info *pi =
...@@ -105,6 +104,7 @@ static int osdmap_show(struct seq_file *s, void *p) ...@@ -105,6 +104,7 @@ static int osdmap_show(struct seq_file *s, void *p)
pg->pgid.seed, pg->primary_temp.osd); pg->pgid.seed, pg->primary_temp.osd);
} }
up_read(&osdc->lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment