ceph: reuse mon subscribe message instead of allocated anew
[safe/jmp/linux-2.6] / fs / ceph / mon_client.h
index 9f6db45..174d794 100644 (file)
@@ -2,13 +2,14 @@
 #define _FS_CEPH_MON_CLIENT_H
 
 #include <linux/completion.h>
-#include <linux/radix-tree.h>
+#include <linux/kref.h>
+#include <linux/rbtree.h>
 
 #include "messenger.h"
-#include "msgpool.h"
 
 struct ceph_client;
 struct ceph_mount_args;
+struct ceph_auth_client;
 
 /*
  * The monitor map enumerates the set of all monitors.
@@ -21,7 +22,7 @@ struct ceph_monmap {
 };
 
 struct ceph_mon_client;
-struct ceph_mon_statfs_request;
+struct ceph_mon_generic_request;
 
 
 /*
@@ -39,16 +40,19 @@ struct ceph_mon_request {
 };
 
 /*
- * statfs() is done a bit differently because we need to get data back
+ * ceph_mon_generic_request is being used for the statfs and poolop requests
+ * which are bening done a bit differently because we need to get data back
  * to the caller
  */
-struct ceph_mon_statfs_request {
+struct ceph_mon_generic_request {
+       struct kref kref;
        u64 tid;
+       struct rb_node node;
        int result;
-       struct ceph_statfs *buf;
+       void *buf;
        struct completion completion;
-       unsigned long last_attempt, delay; /* jiffies */
        struct ceph_msg *request;  /* original request */
+       struct ceph_msg *reply;    /* and reply */
 };
 
 struct ceph_mon_client {
@@ -58,23 +62,22 @@ struct ceph_mon_client {
        struct mutex mutex;
        struct delayed_work delayed_work;
 
+       struct ceph_auth_client *auth;
+       struct ceph_msg *m_auth, *m_auth_reply, *m_subscribe, *m_subscribe_ack;
+       int pending_auth;
+
        bool hunting;
        int cur_mon;                       /* last monitor i contacted */
        unsigned long sub_sent, sub_renew_after;
        struct ceph_connection *con;
+       bool have_fsid;
 
-       /* msg pools */
-       struct ceph_msgpool msgpool_mount_ack;
-       struct ceph_msgpool msgpool_subscribe_ack;
-       struct ceph_msgpool msgpool_statfs_reply;
-
-       /* pending statfs requests */
-       struct radix_tree_root statfs_request_tree;
-       int num_statfs_requests;
+       /* pending generic requests */
+       struct rb_root generic_request_tree;
+       int num_generic_requests;
        u64 last_tid;
 
-       /* mds/osd map or mount requests */
-       bool want_mount;
+       /* mds/osd map */
        int want_next_osdmap; /* 1 = want, 2 = want+asked */
        u32 have_osdmap, have_mdsmap;
 
@@ -101,11 +104,13 @@ extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, u32 have);
 
 extern void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc);
 
-extern int ceph_monc_request_mount(struct ceph_mon_client *monc);
-
 extern int ceph_monc_do_statfs(struct ceph_mon_client *monc,
                               struct ceph_statfs *buf);
 
+extern int ceph_monc_open_session(struct ceph_mon_client *monc);
+
+extern int ceph_monc_validate_auth(struct ceph_mon_client *monc);
+
 
 
 #endif