]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: debugfs for caps reservation system
authorYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 1 Apr 2009 21:22:41 +0000 (14:22 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 1 Apr 2009 21:22:41 +0000 (14:22 -0700)
src/kernel/caps.c
src/kernel/debugfs.c
src/kernel/super.h

index 4301628ad02aa2351b125a14ec0dbb49e007499f..66bf49235448e202de511f9e9f30e642898c6a8c 100644 (file)
@@ -2088,3 +2088,16 @@ void ceph_put_cap(struct ceph_cap *cap)
        list_add(&cap->caps_item, &caps_list);
        spin_unlock(&caps_list_lock);
 }
+
+void ceph_reservation_status(int *total, int *used, int *reserved)
+{
+       if (total)
+               *total = caps_count;
+
+       if (used)
+               *used = caps_use_count;
+
+       if (reserved)
+               *reserved = caps_reserve_count;
+}
+
index de664447cc6c5982caa4523a879f3d2d6b390705..0d95dc2a93665b6b46fcc80d0594842430721a95 100644 (file)
@@ -12,6 +12,7 @@ static struct dentry *ceph_debugfs_debug;
 static struct dentry *ceph_debugfs_debug_msgr;
 static struct dentry *ceph_debugfs_debug_console;
 static struct dentry *ceph_debugfs_debug_mask;
+static struct dentry *ceph_debugfs_caps_reservation;
 #ifdef CONFIG_CEPH_BOOKKEEPER
 static struct dentry *ceph_debugfs_bookkeeper;
 #endif
@@ -367,6 +368,19 @@ static int osdc_show(struct seq_file *s, void *p)
        return 0;
 }
 
+static int caps_reservation_show(struct seq_file *s, void *p)
+{
+       int total, used, reserved;
+
+       ceph_reservation_status(&total, &used, &reserved);
+
+       seq_printf(s, "total\t%d\n"
+                     "used\t%d\n"
+                     "reserved\t%d\n",
+                     total, used, reserved);
+       return 0;
+}
+
 #define DEFINE_SHOW_FUNC(name)                                                 \
 static int name##_open(struct inode *inode, struct file *file)         \
 {                                                                      \
@@ -393,6 +407,7 @@ DEFINE_SHOW_FUNC(osdmap_show)
 DEFINE_SHOW_FUNC(monc_show)
 DEFINE_SHOW_FUNC(mdsc_show)
 DEFINE_SHOW_FUNC(osdc_show)
+DEFINE_SHOW_FUNC(caps_reservation_show)
 
 #ifdef CONFIG_CEPH_BOOKKEEPER
 static int debugfs_bookkeeper_set(void *data, u64 val)
@@ -449,6 +464,14 @@ int ceph_debugfs_init(void)
        if (!ceph_debugfs_debug_mask)
                goto out;
 
+       ceph_debugfs_caps_reservation = debugfs_create_file("caps_reservation",
+                                       0400,
+                                       ceph_debugfs_dir,
+                                       NULL,
+                                       &caps_reservation_show_fops);
+       if (!ceph_debugfs_caps_reservation)
+               goto out;
+
 #ifdef CONFIG_CEPH_BOOKKEEPER
        ceph_debugfs_bookkeeper = debugfs_create_file("show_bookkeeper",
                                        0600,
@@ -467,6 +490,7 @@ out:
 
 void ceph_debugfs_cleanup(void)
 {
+       debugfs_remove(ceph_debugfs_caps_reservation);
        debugfs_remove(ceph_debugfs_debug_console);
        debugfs_remove(ceph_debugfs_debug_mask);
        debugfs_remove(ceph_debugfs_debug_msgr);
index 97502bbdb9f8515ee698ed1ffc1995a4fc41684c..17632e3c67d258f4996bb562a46cec1ea3986c27 100644 (file)
@@ -517,6 +517,7 @@ extern int ceph_unreserve_caps(struct ceph_caps_reservation *ctx);
 extern struct ceph_cap *ceph_get_cap(struct ceph_caps_reservation *ctx, int mode);
 extern struct ceph_cap *ceph_get_reserved_cap(struct ceph_caps_reservation *ctx);
 extern void ceph_put_cap(struct ceph_cap *cap);
+extern void ceph_reservation_status(int *total, int *used, int *reserved);
 
 static inline struct ceph_client *ceph_inode_to_client(struct inode *inode)
 {