diff mbox

[03/33] libceph: dump pg_temp mappings to debugfs

Message ID 1395944299-21970-4-git-send-email-ilya.dryomov@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov March 27, 2014, 6:17 p.m. UTC
Dump pg_temp mappings to /sys/kernel/debug/ceph/<client>/osdmap,
one 'pg_temp <pgid> [<osd>, ..., <osd>]' per line, e.g:

    pg_temp 2.6 [2,3,4]

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
---
 net/ceph/debugfs.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Alex Elder March 27, 2014, 7:11 p.m. UTC | #1
On 03/27/2014 01:17 PM, Ilya Dryomov wrote:
> Dump pg_temp mappings to /sys/kernel/debug/ceph/<client>/osdmap,
> one 'pg_temp <pgid> [<osd>, ..., <osd>]' per line, e.g:
> 
>     pg_temp 2.6 [2,3,4]
> 
> Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>

I didn't look at the broader context, but the new code looks good.

Reviewed-by: Alex Elder <elder@linaro.org>

> ---
>  net/ceph/debugfs.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c
> index 112d98edb156..c45d235e774e 100644
> --- a/net/ceph/debugfs.c
> +++ b/net/ceph/debugfs.c
> @@ -82,6 +82,17 @@ static int osdmap_show(struct seq_file *s, void *p)
>  			   ((map->osd_weight[i]*100) >> 16),
>  			   ceph_osdmap_state_str(sb, sizeof(sb), state));
>  	}
> +	for (n = rb_first(&map->pg_temp); n; n = rb_next(n)) {
> +		struct ceph_pg_mapping *pg =
> +			rb_entry(n, struct ceph_pg_mapping, node);
> +
> +		seq_printf(s, "pg_temp %llu.%x [", pg->pgid.pool,
> +			   pg->pgid.seed);
> +		for (i = 0; i < pg->len; i++)
> +			seq_printf(s, "%s%d", (i == 0 ? "" : ","),
> +				   pg->osds[i]);
> +		seq_printf(s, "]\n");
> +	}
>  
>  	return 0;
>  }
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c
index 112d98edb156..c45d235e774e 100644
--- a/net/ceph/debugfs.c
+++ b/net/ceph/debugfs.c
@@ -82,6 +82,17 @@  static int osdmap_show(struct seq_file *s, void *p)
 			   ((map->osd_weight[i]*100) >> 16),
 			   ceph_osdmap_state_str(sb, sizeof(sb), state));
 	}
+	for (n = rb_first(&map->pg_temp); n; n = rb_next(n)) {
+		struct ceph_pg_mapping *pg =
+			rb_entry(n, struct ceph_pg_mapping, node);
+
+		seq_printf(s, "pg_temp %llu.%x [", pg->pgid.pool,
+			   pg->pgid.seed);
+		for (i = 0; i < pg->len; i++)
+			seq_printf(s, "%s%d", (i == 0 ? "" : ","),
+				   pg->osds[i]);
+		seq_printf(s, "]\n");
+	}
 
 	return 0;
 }