list_add_tail(&req->r_listener_item, &ci->i_listener_list);
spin_unlock(&ci->i_listener_lock);
}
+
+ ceph_sysfs_mds_req_init(mdsc, req);
}
static void __unregister_request(struct ceph_mds_client *mdsc,
list_del_init(&req->r_listener_item);
spin_unlock(&ci->i_listener_lock);
}
+
+ ceph_sysfs_mds_req_cleanup(req);
}
static bool __have_session(struct ceph_mds_client *mdsc, int mds)
ceph_mds_request_callback_t r_callback;
struct list_head r_unsafe_item; /* per-session unsafe list item */
bool r_got_unsafe, r_got_safe;
+
+ struct kobject kobj;
};
/*
spinlock_t cap_delay_lock; /* protects cap_delay_list */
struct list_head snap_flush_list; /* cap_snaps ready to flush */
spinlock_t snap_flush_lock;
+
+ struct kobject kobj;
};
extern const char *ceph_mds_op_name(int op);
extern void ceph_sysfs_client_cleanup(struct ceph_client *client);
extern int ceph_sysfs_init(void);
extern void ceph_sysfs_cleanup(void);
+extern int ceph_sysfs_mds_req_init(struct ceph_mds_client *mdsc, struct ceph_mds_request *req);
+extern void ceph_sysfs_mds_req_cleanup(struct ceph_mds_request *req);
static inline struct inode *get_dentry_parent_inode(struct dentry *dentry)
{
return pos;
}
+static struct kobj_type entity_type = {
+ .sysfs_ops = &generic_sysfs_ops,
+};
+
+
#define ADD_CLIENT_ATTR(a, n, m, sh, st) \
client->a.attr.name = n; \
client->a.attr.mode = m; \
if (ret)
goto out;
+ ret = kobject_init_and_add(&client->mdsc.kobj, &entity_type,
+ &client->kobj, "mdsc");
+ if (ret)
+ goto out;
+
ADD_CLIENT_ATTR(k_fsid, "fsid", 0400, fsid_show, NULL);
ADD_CLIENT_ATTR(k_monmap, "monmap", 0400, monmap_show, NULL);
ADD_CLIENT_ATTR(k_mdsmap, "mdsmap", 0400, mdsmap_show, NULL);
void ceph_sysfs_client_cleanup(struct ceph_client *client)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+ kobject_del(&client->mdsc.kobj);
kobject_del(&client->kobj);
#endif
}
+int ceph_sysfs_mds_req_init(struct ceph_mds_client *mdsc, struct ceph_mds_request *req)
+{
+ int ret = 0;
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+ ret = kobject_init_and_add(&req->kobj, &client_type,
+ &mdsc->kobj, "%d", req->r_tid);
+ if (ret)
+ goto out;
+
+ return 0;
+
+out:
+#endif
+ return ret;
+}
+
+void ceph_sysfs_mds_req_cleanup(struct ceph_mds_request *req)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
+ kobject_del(&req->kobj);
+#endif
+}
+
/*
* ceph attrs
*/