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;
+}
+
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
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) \
{ \
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)
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,
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);
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)
{