]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: beginnings of sysfs
authorSage Weil <sage@newdream.net>
Tue, 29 Apr 2008 20:20:06 +0000 (13:20 -0700)
committerSage Weil <sage@newdream.net>
Tue, 29 Apr 2008 20:20:06 +0000 (13:20 -0700)
src/TODO
src/kernel/client.c
src/kernel/super.c
src/kernel/super.h

index 79bd0f9a8f6ff353cc65bbb2e5203a40bb6be6cb..c6f9f2d63728e7c14d60ee4b5509f606710a05b0 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -18,7 +18,6 @@ userspace client
 - reference count lease validations on path lookup?
 
 kernel client
-- flush all WRITE caps on session close
 - flush caps on sync, fsync, etc.
   - hmm, should these go in a per-session "check" list, instead of independently scheduling delayed_work for each inode?
 - fsync should flush cap file size to mds.  not sure how to block on that, however.. maybe a want_reply flag in the cap msg?
index 31fb9e34557c5160d9bc7d09bea590859eac707a..e7a78699cce6bc288d64511982a9bb7af3e6192a 100644 (file)
@@ -162,11 +162,17 @@ static void handle_monmap(struct ceph_client *client, struct ceph_msg *msg)
        client->monc.monmap = new;
 
        if (first) {
+               char name[10];
                client->whoami = le32_to_cpu(msg->hdr.dst.name.num);
                client->msgr->inst.name = msg->hdr.dst.name;
-               dout(1, "i am client%d, fsid is %llx.%llx\n", client->whoami,
+               sprintf(name, "client%d", client->whoami);
+               dout(1, "i am %s, fsid is %llx.%llx\n", name,
                     le64_to_cpu(client->monc.monmap->fsid.major),
                     le64_to_cpu(client->monc.monmap->fsid.minor));
+
+               client->client_kobj = kobject_create_and_add(name, ceph_kobj);
+               //client->fsid_kobj = kobject_create_and_add("fsid", 
+               //client->client_kobj);
        }
 }
 
@@ -245,6 +251,8 @@ void ceph_destroy_client(struct ceph_client *cl)
        /* unmount */
        /* ... */
 
+       if (cl->client_kobj)
+               kobject_put(cl->client_kobj);
        if (cl->wb_wq)
                destroy_workqueue(cl->wb_wq);
        ceph_messenger_destroy(cl->msgr);
index cf4111beb66d593cc3256aa290efe4bc5a3c6d52..2a7218d99a09971a536d7e296d337f862643296f 100644 (file)
@@ -554,14 +554,19 @@ static struct file_system_type ceph_fs_type = {
        .fs_flags       = FS_RENAME_DOES_D_MOVE,
 };
 
+struct kobject *ceph_kobj;
+
 static int __init init_ceph(void)
 {
        int ret = 0;
 
        dout(1, "init_ceph\n");
-
        spin_lock_init(&ceph_client_spinlock);
 
+       ceph_kobj = kobject_create_and_add("ceph", fs_kobj);
+       if (!ceph_kobj)
+               return -ENOMEM;
+       
        ceph_fs_proc_init();
 
        ret = init_inodecache();
@@ -578,6 +583,9 @@ static void __exit exit_ceph(void)
 {
        dout(1, "exit_ceph\n");
 
+       kobject_put(ceph_kobj);
+       ceph_kobj = 0;
+
        unregister_filesystem(&ceph_fs_type);
        destroy_inodecache();
 }
index 4d563ca0aff3ae5d38078cb38d0323a1f60e9417..ec4949c404147882a1f3997ed5437748990a2508 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/completion.h>
 #include <linux/pagemap.h>
 #include <linux/exportfs.h>
+#include <linux/sysfs.h>
 
 #include "ceph_fs.h"
 #include "messenger.h"
@@ -92,6 +93,9 @@ enum {
        CEPH_MOUNT_UNMOUNTED,
 };
 
+
+extern struct kobject *ceph_kobj;
+
 /*
  * per-filesystem client state
  *
@@ -117,6 +121,8 @@ struct ceph_client {
        /* writeback */
        struct workqueue_struct *wb_wq;
 
+       struct kobject *client_kobj;
+
        /* lets ignore all this until later */
        spinlock_t sb_lock;
        int num_sb;      /* ref count (for each sb_info that points to me) */