ceph: use separate class for ceph sockets' sk_lock
[safe/jmp/linux-2.6] / fs / ceph / mds_client.h
index f566e9c..961cc6f 100644 (file)
@@ -2,9 +2,10 @@
 #define _FS_CEPH_MDS_CLIENT_H
 
 #include <linux/completion.h>
+#include <linux/kref.h>
 #include <linux/list.h>
 #include <linux/mutex.h>
-#include <linux/radix-tree.h>
+#include <linux/rbtree.h>
 #include <linux/spinlock.h>
 
 #include "types.h"
@@ -100,6 +101,10 @@ struct ceph_mds_session {
 
        struct ceph_connection s_con;
 
+       struct ceph_authorizer *s_authorizer;
+       void             *s_authorizer_buf, *s_authorizer_reply_buf;
+       size_t            s_authorizer_buf_len, s_authorizer_reply_buf_len;
+
        /* protected by s_cap_lock */
        spinlock_t        s_cap_lock;
        u32               s_cap_gen;  /* inc each time we get mds stale msg */
@@ -109,6 +114,7 @@ struct ceph_mds_session {
        int               s_num_cap_releases;
        struct list_head  s_cap_releases; /* waiting cap_release messages */
        struct list_head  s_cap_releases_done; /* ready to send */
+       struct ceph_cap  *s_cap_iterator;
 
        /* protected by mutex */
        struct list_head  s_cap_flushing;     /* inodes w/ flushing caps */
@@ -144,6 +150,7 @@ typedef void (*ceph_mds_request_callback_t) (struct ceph_mds_client *mdsc,
  */
 struct ceph_mds_request {
        u64 r_tid;                   /* transaction id */
+       struct rb_node r_node;
 
        int r_op;                    /* mds op code */
        int r_mds;
@@ -182,6 +189,7 @@ struct ceph_mds_request {
        struct ceph_msg  *r_reply;
        struct ceph_mds_reply_info_parsed r_reply_info;
        int r_err;
+       bool r_aborted;
 
        unsigned long r_timeout;  /* optional.  jiffies */
        unsigned long r_started;  /* start time to measure timeout against */
@@ -199,7 +207,7 @@ struct ceph_mds_request {
        int               r_num_stale;
        int               r_resend_mds; /* mds to resend to next, if any*/
 
-       atomic_t          r_ref;
+       struct kref       r_kref;
        struct list_head  r_wait;
        struct completion r_completion;
        struct completion r_safe_completion;
@@ -237,12 +245,12 @@ struct ceph_mds_client {
         * should be destroyed.
         */
        struct rw_semaphore     snap_rwsem;
-       struct radix_tree_root  snap_realms;
+       struct rb_root          snap_realms;
        struct list_head        snap_empty;
        spinlock_t              snap_empty_lock;  /* protect snap_empty */
 
        u64                    last_tid;      /* most recent mds request */
-       struct radix_tree_root request_tree;  /* pending mds requests */
+       struct rb_root         request_tree;  /* pending mds requests */
        struct delayed_work    delayed_work;  /* delayed work */
        unsigned long    last_renew_caps;  /* last time we renewed our caps */
        struct list_head cap_delay_list;   /* caps with delayed release */
@@ -256,7 +264,9 @@ struct ceph_mds_client {
        spinlock_t        cap_dirty_lock;   /* protects above items */
        wait_queue_head_t cap_flushing_wq;
 
+#ifdef CONFIG_DEBUG_FS
        struct dentry     *debugfs_file;
+#endif
 
        spinlock_t        dentry_lru_lock;
        struct list_head  dentry_lru;
@@ -280,7 +290,7 @@ extern void ceph_put_mds_session(struct ceph_mds_session *s);
 extern int ceph_send_msg_mds(struct ceph_mds_client *mdsc,
                             struct ceph_msg *msg, int mds);
 
-extern void ceph_mdsc_init(struct ceph_mds_client *mdsc,
+extern int ceph_mdsc_init(struct ceph_mds_client *mdsc,
                           struct ceph_client *client);
 extern void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc);
 extern void ceph_mdsc_stop(struct ceph_mds_client *mdsc);
@@ -300,9 +310,13 @@ extern int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,
                                struct ceph_mds_request *req);
 static inline void ceph_mdsc_get_request(struct ceph_mds_request *req)
 {
-       atomic_inc(&req->r_ref);
+       kref_get(&req->r_kref);
+}
+extern void ceph_mdsc_release_request(struct kref *kref);
+static inline void ceph_mdsc_put_request(struct ceph_mds_request *req)
+{
+       kref_put(&req->r_kref, ceph_mdsc_release_request);
 }
-extern void ceph_mdsc_put_request(struct ceph_mds_request *req);
 
 extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc);