#include "ceph_debug.h"
+#include <linux/device.h>
+#include <linux/slab.h>
#include <linux/module.h>
#include <linux/ctype.h>
#include <linux/debugfs.h>
#include "super.h"
#include "mds_client.h"
+#include "mon_client.h"
+#include "auth.h"
#ifdef CONFIG_DEBUG_FS
* .../monc - mon client state
* .../dentry_lru - dump contents of dentry lru
* .../caps - expose cap (reservation) stats
+ * .../bdi - symlink to ../../bdi/something
*/
static struct dentry *ceph_debugfs_dir;
{
int i;
struct ceph_client *client = s->private;
+ struct rb_node *n;
if (client->osdc.osdmap == NULL)
return 0;
" NEARFULL" : "",
(client->osdc.osdmap->flags & CEPH_OSDMAP_FULL) ?
" FULL" : "");
- for (i = 0; i < client->osdc.osdmap->num_pools; i++) {
+ for (n = rb_first(&client->osdc.osdmap->pg_pools); n; n = rb_next(n)) {
struct ceph_pg_pool_info *pool =
- &client->osdc.osdmap->pg_pool[i];
+ rb_entry(n, struct ceph_pg_pool_info, node);
seq_printf(s, "pg_pool %d pg_num %d / %d, lpg_num %d / %d\n",
- i, pool->v.pg_num, pool->pg_num_mask,
+ pool->id, pool->v.pg_num, pool->pg_num_mask,
pool->v.lpg_num, pool->lpg_num_mask);
}
for (i = 0; i < client->osdc.osdmap->max_osd; i++) {
{
struct ceph_client *client = s->private;
struct ceph_mon_statfs_request *req;
- u64 nexttid = 0;
- int got;
struct ceph_mon_client *monc = &client->monc;
+ struct rb_node *rp;
mutex_lock(&monc->mutex);
if (monc->want_next_osdmap)
seq_printf(s, "want next osdmap\n");
- while (nexttid < monc->last_tid) {
- got = radix_tree_gang_lookup(&monc->statfs_request_tree,
- (void **)&req, nexttid, 1);
- if (got == 0)
- break;
- nexttid = req->tid + 1;
-
+ for (rp = rb_first(&monc->statfs_request_tree); rp; rp = rb_next(rp)) {
+ req = rb_entry(rp, struct ceph_mon_statfs_request, node);
seq_printf(s, "%lld statfs\n", req->tid);
}
- mutex_unlock(&monc->mutex);
+ mutex_unlock(&monc->mutex);
return 0;
}
static int mdsc_show(struct seq_file *s, void *p)
{
struct ceph_client *client = s->private;
- struct ceph_mds_request *req;
- u64 nexttid = 0;
- int got;
struct ceph_mds_client *mdsc = &client->mdsc;
+ struct ceph_mds_request *req;
+ struct rb_node *rp;
int pathlen;
u64 pathbase;
char *path;
mutex_lock(&mdsc->mutex);
- while (nexttid < mdsc->last_tid) {
- got = radix_tree_gang_lookup(&mdsc->request_tree,
- (void **)&req, nexttid, 1);
- if (got == 0)
- break;
- nexttid = req->r_tid + 1;
+ for (rp = rb_first(&mdsc->request_tree); rp; rp = rb_next(rp)) {
+ req = rb_entry(rp, struct ceph_mds_request, r_node);
if (req->r_request)
seq_printf(s, "%lld\tmds%d\t", req->r_tid, req->r_mds);
req = rb_entry(p, struct ceph_osd_request, r_node);
- seq_printf(s, "%lld\tosd%d\t", req->r_tid,
- req->r_osd ? req->r_osd->o_osd : -1);
+ seq_printf(s, "%lld\tosd%d\t%d.%x\t", req->r_tid,
+ req->r_osd ? req->r_osd->o_osd : -1,
+ le32_to_cpu(req->r_pgid.pool),
+ le16_to_cpu(req->r_pgid.ps));
head = req->r_request->front.iov_base;
op = (void *)(head + 1);
static int caps_show(struct seq_file *s, void *p)
{
struct ceph_client *client = p;
- int total, avail, used, reserved;
+ int total, avail, used, reserved, min;
- ceph_reservation_status(client, &total, &avail, &used, &reserved);
+ ceph_reservation_status(client, &total, &avail, &used, &reserved, &min);
seq_printf(s, "total\t\t%d\n"
- "avail\t\t%d\n"
- "used\t\t%d\n"
- "reserved\t%d\n",
- total, avail, used, reserved);
+ "avail\t\t%d\n"
+ "used\t\t%d\n"
+ "reserved\t%d\n"
+ "min\t%d\n",
+ total, avail, used, reserved, min);
return 0;
}
DEFINE_SHOW_FUNC(dentry_lru_show)
DEFINE_SHOW_FUNC(caps_show)
+static int congestion_kb_set(void *data, u64 val)
+{
+ struct ceph_client *client = (struct ceph_client *)data;
+
+ if (client)
+ client->mount_args->congestion_kb = (int)val;
+
+ return 0;
+}
+
+static int congestion_kb_get(void *data, u64 *val)
+{
+ struct ceph_client *client = (struct ceph_client *)data;
+
+ if (client)
+ *val = (u64)client->mount_args->congestion_kb;
+
+ return 0;
+}
+
+
+DEFINE_SIMPLE_ATTRIBUTE(congestion_kb_fops, congestion_kb_get,
+ congestion_kb_set, "%llu\n");
+
int __init ceph_debugfs_init(void)
{
ceph_debugfs_dir = debugfs_create_dir("ceph", NULL);
char name[80];
snprintf(name, sizeof(name), FSID_FORMAT ".client%lld",
- PR_FSID(&client->monc.monmap->fsid), client->whoami);
+ PR_FSID(&client->fsid), client->monc.auth->global_id);
client->debugfs_dir = debugfs_create_dir(name, ceph_debugfs_dir);
if (!client->debugfs_dir)
if (!client->debugfs_caps)
goto out;
+ client->debugfs_congestion_kb = debugfs_create_file("writeback_congestion_kb",
+ 0600,
+ client->debugfs_dir,
+ client,
+ &congestion_kb_fops);
+ if (!client->debugfs_congestion_kb)
+ goto out;
+
+ sprintf(name, "../../bdi/%s", dev_name(client->sb->s_bdi->dev));
+ client->debugfs_bdi = debugfs_create_symlink("bdi", client->debugfs_dir,
+ name);
+
return 0;
out:
void ceph_debugfs_client_cleanup(struct ceph_client *client)
{
+ debugfs_remove(client->debugfs_bdi);
debugfs_remove(client->debugfs_caps);
debugfs_remove(client->debugfs_dentry_lru);
debugfs_remove(client->debugfs_osdmap);
debugfs_remove(client->osdc.debugfs_file);
debugfs_remove(client->mdsc.debugfs_file);
debugfs_remove(client->monc.debugfs_file);
+ debugfs_remove(client->debugfs_congestion_kb);
debugfs_remove(client->debugfs_dir);
}