}
static struct proc_dir_entry *proc_fs_ceph;
+static struct proc_dir_entry *proc_fs_ceph_clients;
int ceph_proc_init(void)
{
if (pde)
pde->write_proc = ceph_debug_mask_write;
+ proc_fs_ceph_clients = proc_mkdir("clients", proc_fs_ceph);
+
return 0;
}
void ceph_proc_cleanup(void)
{
+ struct list_head *p;
+ struct ceph_client *client;
+ char str[16];
+
+ spin_lock(&ceph_clients_list_lock);
+ list_for_each(p, &ceph_clients) {
+ client = list_entry(p, struct ceph_client, clients_all);
+ snprintf(str, sizeof(str), "%d", client->whoami);
+ remove_proc_entry(str, proc_fs_ceph_clients);
+ }
+ spin_unlock(&ceph_clients_list_lock);
+ remove_proc_entry("clients", proc_fs_ceph_clients);
+
remove_proc_entry("debug", proc_fs_ceph);
remove_proc_entry("debug_msgr", proc_fs_ceph);
remove_proc_entry("debug_console", proc_fs_ceph);
remove_proc_entry("debug_mask", proc_fs_ceph);
remove_proc_entry("fs/ceph", NULL);
}
+
+void ceph_proc_register_client(struct ceph_client *client)
+{
+ char str[16];
+
+ snprintf(str, sizeof(str), "%d", client->whoami);
+ client->proc_entry = proc_mkdir(str, proc_fs_ceph_clients);
+}
int ceph_debug_super = -1; /* for this file */
struct list_head ceph_clients;
-static spinlock_t _clients_list_lock = SPIN_LOCK_UNLOCKED;
+spinlock_t ceph_clients_list_lock = SPIN_LOCK_UNLOCKED;
#define DOUT_MASK DOUT_MASK_SUPER
#define DOUT_VAR ceph_debug_super
if (first) {
char name[10];
client->whoami = le32_to_cpu(msg->hdr.dst.name.num);
+ ceph_proc_register_client(client);
client->msgr->inst.name = msg->hdr.dst.name;
sprintf(name, "client%d", client->whoami);
dout(1, "i am %s, fsid is %llx.%llx\n", name,
dout(20, "get_sb got existing client %p\n", client);
} else {
dout(20, "get_sb using new client %p\n", client);
- spin_lock(&_clients_list_lock);
+ spin_lock(&ceph_clients_list_lock);
list_add(&client->clients_all, &ceph_clients);
- spin_unlock(&_clients_list_lock);
+ spin_unlock(&ceph_clients_list_lock);
err = ceph_init_bdi(sb, client);
if (err < 0)
extern struct kobject *ceph_kobj;
+extern struct list_head ceph_clients;
+extern spinlock_t ceph_clients_list_lock;
+
+
/*
* per-filesystem client state
*
struct backing_dev_info backing_dev_info;
struct list_head clients_all;
+ struct proc_dir_entry *proc_entry;
};
static inline struct ceph_client *ceph_client(struct super_block *sb)
/* proc.c */
extern int ceph_proc_init(void);
extern void ceph_proc_cleanup(void);
+extern void ceph_proc_register_client(struct ceph_client *client);
static inline struct inode *get_dentry_parent_inode(struct dentry *dentry)
{