Skip to content

Commit

Permalink
libceph: move msgr1 protocol specific fields to its own struct
Browse files Browse the repository at this point in the history
A couple whitespace fixups, no functional changes.

Signed-off-by: Ilya Dryomov <[email protected]>
  • Loading branch information
idryomov committed Dec 14, 2020
1 parent 2f71361 commit a56dd9b
Show file tree
Hide file tree
Showing 3 changed files with 257 additions and 247 deletions.
76 changes: 41 additions & 35 deletions include/linux/ceph/messenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,43 @@ struct ceph_msg {
#define BASE_DELAY_INTERVAL (HZ / 4)
#define MAX_DELAY_INTERVAL (15 * HZ)

struct ceph_connection_v1_info {
struct kvec out_kvec[8], /* sending header/footer data */
*out_kvec_cur;
int out_kvec_left; /* kvec's left in out_kvec */
int out_skip; /* skip this many bytes */
int out_kvec_bytes; /* total bytes left */
bool out_more; /* there is more data after the kvecs */
bool out_msg_done;

struct ceph_auth_handshake *auth;
int auth_retry; /* true if we need a newer authorizer */

/* connection negotiation temps */
u8 in_banner[CEPH_BANNER_MAX_LEN];
struct ceph_entity_addr actual_peer_addr;
struct ceph_entity_addr peer_addr_for_me;
struct ceph_msg_connect out_connect;
struct ceph_msg_connect_reply in_reply;

int in_base_pos; /* bytes read */

/* message in temps */
u8 in_tag; /* protocol control byte */
struct ceph_msg_header in_hdr;
__le64 in_temp_ack; /* for reading an ack */

/* message out temps */
struct ceph_msg_header out_hdr;
__le64 out_temp_ack; /* for writing an ack */
struct ceph_timespec out_temp_keepalive2; /* for writing keepalive2
stamp */

u32 connect_seq; /* identify the most recent connection
attempt for this session */
u32 peer_global_seq; /* peer's global seq for this connection */
};

/*
* A single connection with another host.
*
Expand All @@ -281,21 +318,13 @@ struct ceph_connection {
int state; /* CEPH_CON_S_* */
atomic_t sock_state;
struct socket *sock;
struct ceph_entity_addr peer_addr; /* peer address */
struct ceph_entity_addr peer_addr_for_me;

unsigned long flags; /* CEPH_CON_F_* */
const char *error_msg; /* error message, if any */

struct ceph_entity_name peer_name; /* peer name */

struct ceph_entity_addr peer_addr; /* peer address */
u64 peer_features;
u32 connect_seq; /* identify the most recent connection
attempt for this connection, client */
u32 peer_global_seq; /* peer's global seq for this connection */

struct ceph_auth_handshake *auth;
int auth_retry; /* true if we need a newer authorizer */

struct mutex mutex;

Expand All @@ -306,41 +335,18 @@ struct ceph_connection {

u64 in_seq, in_seq_acked; /* last message received, acked */

/* connection negotiation temps */
char in_banner[CEPH_BANNER_MAX_LEN];
struct ceph_msg_connect out_connect;
struct ceph_msg_connect_reply in_reply;
struct ceph_entity_addr actual_peer_addr;

/* message out temps */
struct ceph_msg_header out_hdr;
struct ceph_msg *in_msg;
struct ceph_msg *out_msg; /* sending message (== tail of
out_sent) */
bool out_msg_done;

struct kvec out_kvec[8], /* sending header/footer data */
*out_kvec_cur;
int out_kvec_left; /* kvec's left in out_kvec */
int out_skip; /* skip this many bytes */
int out_kvec_bytes; /* total bytes left */
int out_more; /* there is more data after the kvecs */
__le64 out_temp_ack; /* for writing an ack */
struct ceph_timespec out_temp_keepalive2; /* for writing keepalive2
stamp */

/* message in temps */
struct ceph_msg_header in_hdr;
struct ceph_msg *in_msg;
u32 in_front_crc, in_middle_crc, in_data_crc; /* calculated crc */

char in_tag; /* protocol control byte */
int in_base_pos; /* bytes read */
__le64 in_temp_ack; /* for reading an ack */

struct timespec64 last_keepalive_ack; /* keepalive2 ack stamp */

struct delayed_work work; /* send|recv work */
unsigned long delay; /* current delay interval */

struct ceph_connection_v1_info v1;
};

extern struct page *ceph_zero_page;
Expand Down
8 changes: 4 additions & 4 deletions net/ceph/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -1448,11 +1448,11 @@ static void con_fault_finish(struct ceph_connection *con)
* in case we faulted due to authentication, invalidate our
* current tickets so that we can get new ones.
*/
if (con->auth_retry) {
dout("auth_retry %d, invalidating\n", con->auth_retry);
if (con->v1.auth_retry) {
dout("auth_retry %d, invalidating\n", con->v1.auth_retry);
if (con->ops->invalidate_authorizer)
con->ops->invalidate_authorizer(con);
con->auth_retry = 0;
con->v1.auth_retry = 0;
}

if (con->ops->fault)
Expand Down Expand Up @@ -1631,7 +1631,7 @@ static void clear_standby(struct ceph_connection *con)
if (con->state == CEPH_CON_S_STANDBY) {
dout("clear_standby %p and ++connect_seq\n", con);
con->state = CEPH_CON_S_PREOPEN;
con->connect_seq++;
con->v1.connect_seq++;
WARN_ON(ceph_con_flag_test(con, CEPH_CON_F_WRITE_PENDING));
WARN_ON(ceph_con_flag_test(con, CEPH_CON_F_KEEPALIVE_PENDING));
}
Expand Down
Loading

0 comments on commit a56dd9b

Please sign in to comment.