ceph: preserve seq # on requeued messages after transient transport errors
[safe/jmp/linux-2.6] / fs / ceph / messenger.h
index 981b7c0..a5caf91 100644 (file)
@@ -32,6 +32,7 @@ struct ceph_connection_operations {
                               void **buf, int *len, int *proto,
                               void **reply_buf, int *reply_len, int force_new);
        int (*verify_authorizer_reply) (struct ceph_connection *con, int len);
+       int (*invalidate_authorizer)(struct ceph_connection *con);
 
        /* protocol version mismatch */
        void (*bad_proto) (struct ceph_connection *con);
@@ -44,13 +45,8 @@ struct ceph_connection_operations {
        void (*peer_reset) (struct ceph_connection *con);
 
        struct ceph_msg * (*alloc_msg) (struct ceph_connection *con,
-                                       struct ceph_msg_header *hdr);
-       int (*alloc_middle) (struct ceph_connection *con,
-                            struct ceph_msg *msg);
-       /* an incoming message has a data payload; tell me what pages I
-        * should read the data into. */
-       int (*prepare_pages) (struct ceph_connection *con, struct ceph_msg *m,
-                             int want);
+                                       struct ceph_msg_header *hdr,
+                                       int *skip);
 };
 
 extern const char *ceph_name_type_str(int t);
@@ -85,10 +81,12 @@ struct ceph_msg {
        struct ceph_buffer *middle;
        struct page **pages;            /* data payload.  NOT OWNER. */
        unsigned nr_pages;              /* size of page array */
+       struct ceph_pagelist *pagelist; /* instead of pages */
        struct list_head list_head;
        struct kref kref;
        bool front_is_vmalloc;
        bool more_to_follow;
+       bool needs_out_seq;
        int front_max;
 
        struct ceph_msgpool *pool;
@@ -122,7 +120,6 @@ struct ceph_msg_pos {
                            * state with the peer. */
 #define CLOSED         10 /* we've closed the connection */
 #define SOCK_CLOSED    11 /* socket state changed to closed */
-#define REGISTERED      12 /* connection appears in con_tree */
 #define OPENING         13 /* open connection w/ (possibly new) peer */
 #define DEAD            14 /* dead, about to kfree */
 
@@ -155,8 +152,9 @@ struct ceph_connection {
        void *auth_reply_buf;   /* where to put the authorizer reply */
        int auth_reply_buf_len;
 
+       struct mutex mutex;
+
        /* out queue */
-       struct mutex out_mutex;
        struct list_head out_queue;
        struct list_head out_sent;   /* sending or sent but unacked */
        u64 out_seq;                 /* last message queued for send */
@@ -182,6 +180,7 @@ struct ceph_connection {
        /* message out temps */
        struct ceph_msg *out_msg;        /* sending message (== tail of
                                            out_sent) */
+       bool out_msg_done;
        struct ceph_msg_pos out_msg_pos;
 
        struct kvec out_kvec[8],         /* sending header/footer data */
@@ -225,9 +224,12 @@ extern void ceph_con_init(struct ceph_messenger *msgr,
                          struct ceph_connection *con);
 extern void ceph_con_open(struct ceph_connection *con,
                          struct ceph_entity_addr *addr);
+extern bool ceph_con_opened(struct ceph_connection *con);
 extern void ceph_con_close(struct ceph_connection *con);
 extern void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg);
 extern void ceph_con_revoke(struct ceph_connection *con, struct ceph_msg *msg);
+extern void ceph_con_revoke_message(struct ceph_connection *con,
+                                 struct ceph_msg *msg);
 extern void ceph_con_keepalive(struct ceph_connection *con);
 extern struct ceph_connection *ceph_con_get(struct ceph_connection *con);
 extern void ceph_con_put(struct ceph_connection *con);
@@ -237,10 +239,6 @@ extern struct ceph_msg *ceph_msg_new(int type, int front_len,
                                     struct page **pages);
 extern void ceph_msg_kfree(struct ceph_msg *m);
 
-extern struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con,
-                                      struct ceph_msg_header *hdr);
-extern int ceph_alloc_middle(struct ceph_connection *con, struct ceph_msg *msg);
-
 
 static inline struct ceph_msg *ceph_msg_get(struct ceph_msg *msg)
 {
@@ -253,4 +251,6 @@ static inline void ceph_msg_put(struct ceph_msg *msg)
        kref_put(&msg->kref, ceph_msg_last_put);
 }
 
+extern void ceph_msg_dump(struct ceph_msg *msg);
+
 #endif