Merge branch 'topic/core-cleanup' into for-linus
[safe/jmp/linux-2.6] / fs / ceph / osd_client.h
index 9a4addf..ce77698 100644 (file)
@@ -2,6 +2,7 @@
 #define _FS_CEPH_OSD_CLIENT_H
 
 #include <linux/completion.h>
+#include <linux/kref.h>
 #include <linux/mempool.h>
 #include <linux/rbtree.h>
 
@@ -13,6 +14,7 @@ struct ceph_msg;
 struct ceph_snap_context;
 struct ceph_osd_request;
 struct ceph_osd_client;
+struct ceph_authorizer;
 
 /*
  * completion callback for async writepages
@@ -29,23 +31,36 @@ struct ceph_osd {
        struct rb_node o_node;
        struct ceph_connection o_con;
        struct list_head o_requests;
+       struct list_head o_osd_lru;
+       struct ceph_authorizer *o_authorizer;
+       void *o_authorizer_buf, *o_authorizer_reply_buf;
+       size_t o_authorizer_buf_len, o_authorizer_reply_buf_len;
+       unsigned long lru_ttl;
+       int o_marked_for_keepalive;
+       struct list_head o_keepalive_item;
 };
 
 /* an in-flight request */
 struct ceph_osd_request {
        u64             r_tid;              /* unique for this client */
        struct rb_node  r_node;
+       struct list_head r_req_lru_item;
        struct list_head r_osd_item;
        struct ceph_osd *r_osd;
+       struct ceph_pg   r_pgid;
+       int              r_pg_osds[CEPH_PG_MAX_SIZE];
+       int              r_num_pg_osds;
+
+       struct ceph_connection *r_con_filling_msg;
 
        struct ceph_msg  *r_request, *r_reply;
        int               r_result;
        int               r_flags;     /* any additional flags for the osd */
        u32               r_sent;      /* >0 if r_request is sending/sent */
-       int r_prepared_pages, r_got_reply;
+       int               r_got_reply;
 
        struct ceph_osd_client *r_osdc;
-       atomic_t          r_ref;
+       struct kref       r_kref;
        bool              r_mempool;
        struct completion r_completion, r_safe_completion;
        ceph_osdc_callback_t r_callback, r_safe_callback;
@@ -53,11 +68,10 @@ struct ceph_osd_request {
        struct list_head  r_unsafe_item;
 
        struct inode *r_inode;                /* for use by callbacks */
-       struct writeback_control *r_wbc;      /* ditto */
 
        char              r_oid[40];          /* object name */
        int               r_oid_len;
-       unsigned long     r_timeout_stamp;
+       unsigned long     r_stamp;            /* send OR check time */
        bool              r_resend;           /* msg send failed, needs retry */
 
        struct ceph_file_layout r_file_layout;
@@ -78,17 +92,22 @@ struct ceph_osd_client {
 
        struct mutex           request_mutex;
        struct rb_root         osds;          /* osds */
+       struct list_head       osd_lru;       /* idle osds */
        u64                    timeout_tid;   /* tid of timeout triggering rq */
        u64                    last_tid;      /* tid of last request */
        struct rb_root         requests;      /* pending requests */
+       struct list_head       req_lru;       /* pending requests lru */
        int                    num_requests;
        struct delayed_work    timeout_work;
+       struct delayed_work    osds_timeout_work;
+#ifdef CONFIG_DEBUG_FS
        struct dentry          *debugfs_file;
+#endif
 
        mempool_t              *req_mempool;
 
-       struct ceph_msgpool   msgpool_op;
-       struct ceph_msgpool   msgpool_op_reply;
+       struct ceph_msgpool     msgpool_op;
+       struct ceph_msgpool     msgpool_op_reply;
 };
 
 extern int ceph_osdc_init(struct ceph_osd_client *osdc,
@@ -112,9 +131,13 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
 
 static inline void ceph_osdc_get_request(struct ceph_osd_request *req)
 {
-       atomic_inc(&req->r_ref);
+       kref_get(&req->r_kref);
+}
+extern void ceph_osdc_release_request(struct kref *kref);
+static inline void ceph_osdc_put_request(struct ceph_osd_request *req)
+{
+       kref_put(&req->r_kref, ceph_osdc_release_request);
 }
-extern void ceph_osdc_put_request(struct ceph_osd_request *req);
 
 extern int ceph_osdc_start_request(struct ceph_osd_client *osdc,
                                   struct ceph_osd_request *req,