From: Sage Weil Date: Thu, 10 Sep 2009 21:44:52 +0000 (-0700) Subject: msgr: make ack le64 to match seq X-Git-Tag: v0.15~79 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b40b64d5d1aed380ec94fc404be7ce746c6b596a;p=ceph.git msgr: make ack le64 to match seq --- diff --git a/src/include/msgr.h b/src/include/msgr.h index 8e9fc934186a..968b4ba0849f 100644 --- a/src/include/msgr.h +++ b/src/include/msgr.h @@ -21,7 +21,7 @@ * whenever the wire protocol changes. try to keep this string length * constant. */ -#define CEPH_BANNER "ceph v018" +#define CEPH_BANNER "ceph v019" #define CEPH_BANNER_MAX_LEN 30 diff --git a/src/kernel/messenger.c b/src/kernel/messenger.c index ba4d0656d7d7..9d51b6eaa7cd 100644 --- a/src/kernel/messenger.c +++ b/src/kernel/messenger.c @@ -384,10 +384,10 @@ static void prepare_write_message(struct ceph_connection *con) con->in_seq_acked = con->in_seq; con->out_kvec[v].iov_base = &tag_ack; con->out_kvec[v++].iov_len = 1; - con->out_temp_ack = cpu_to_le32(con->in_seq_acked); + con->out_temp_ack = cpu_to_le64(con->in_seq_acked); con->out_kvec[v].iov_base = &con->out_temp_ack; - con->out_kvec[v++].iov_len = 4; - con->out_kvec_bytes = 1 + 4; + con->out_kvec[v++].iov_len = sizeof(con->out_temp_ack); + con->out_kvec_bytes = 1 + sizeof(con->out_temp_ack); } /* move message to sending/sent list */ @@ -461,17 +461,17 @@ static void prepare_write_message(struct ceph_connection *con) */ static void prepare_write_ack(struct ceph_connection *con) { - dout("prepare_write_ack %p %u -> %u\n", con, + dout("prepare_write_ack %p %llu -> %llu\n", con, con->in_seq_acked, con->in_seq); con->in_seq_acked = con->in_seq; con->out_kvec[0].iov_base = &tag_ack; con->out_kvec[0].iov_len = 1; - con->out_temp_ack = cpu_to_le32(con->in_seq_acked); + con->out_temp_ack = cpu_to_le64(con->in_seq_acked); con->out_kvec[1].iov_base = &con->out_temp_ack; - con->out_kvec[1].iov_len = 4; + con->out_kvec[1].iov_len = sizeof(con->out_temp_ack); con->out_kvec_left = 2; - con->out_kvec_bytes = 1 + 4; + con->out_kvec_bytes = 1 + sizeof(con->out_temp_ack); con->out_kvec_cur = con->out_kvec; con->out_more = 1; /* more will follow.. eventually.. */ set_bit(WRITE_PENDING, &con->state); diff --git a/src/kernel/messenger.h b/src/kernel/messenger.h index 317fe89c8682..574ccbbdd82e 100644 --- a/src/kernel/messenger.h +++ b/src/kernel/messenger.h @@ -168,7 +168,7 @@ struct ceph_connection { u64 out_seq_sent; /* last message sent */ bool out_keepalive_pending; - u32 in_seq, in_seq_acked; /* last message received, acked */ + u64 in_seq, in_seq_acked; /* last message received, acked */ /* connection negotiation temps */ char in_banner[CEPH_BANNER_MAX_LEN]; @@ -196,7 +196,7 @@ struct ceph_connection { int out_kvec_bytes; /* total bytes left */ bool out_kvec_is_msg; /* kvec refers to out_msg */ int out_more; /* there is more data after the kvecs */ - __le32 out_temp_ack; /* for writing an ack */ + __le64 out_temp_ack; /* for writing an ack */ /* message in temps */ struct ceph_msg_header in_hdr; @@ -206,7 +206,7 @@ struct ceph_connection { char in_tag; /* protocol control byte */ int in_base_pos; /* bytes read */ - __le32 in_temp_ack; /* for reading an ack */ + __le64 in_temp_ack; /* for reading an ack */ struct delayed_work work; /* send|recv work */ unsigned long delay; /* current delay interval */ diff --git a/src/msg/SimpleMessenger.cc b/src/msg/SimpleMessenger.cc index ceda59f836c5..c4158c33d9fb 100644 --- a/src/msg/SimpleMessenger.cc +++ b/src/msg/SimpleMessenger.cc @@ -1279,7 +1279,7 @@ void SimpleMessenger::Pipe::reader() // open ... if (tag == CEPH_MSGR_TAG_ACK) { dout(20) << "reader got ACK" << dendl; - __u32 seq; + __le64 seq; int rc = tcp_read( sd, (char*)&seq, sizeof(seq)); lock.Lock(); if (rc < 0) { @@ -1748,12 +1748,12 @@ int SimpleMessenger::Pipe::do_sendmsg(int sd, struct msghdr *msg, int len) } -int SimpleMessenger::Pipe::write_ack(unsigned seq) +int SimpleMessenger::Pipe::write_ack(__u64 seq) { dout(10) << "write_ack " << seq << dendl; char c = CEPH_MSGR_TAG_ACK; - __le32 s; + __le64 s; s = seq; struct msghdr msg; @@ -1766,7 +1766,7 @@ int SimpleMessenger::Pipe::write_ack(unsigned seq) msg.msg_iov = msgvec; msg.msg_iovlen = 2; - if (do_sendmsg(sd, &msg, 5) < 0) + if (do_sendmsg(sd, &msg, 1 + sizeof(s)) < 0) return -1; return 0; } diff --git a/src/msg/SimpleMessenger.h b/src/msg/SimpleMessenger.h index b64b0a58a8e6..6f8242ba1fd3 100644 --- a/src/msg/SimpleMessenger.h +++ b/src/msg/SimpleMessenger.h @@ -150,8 +150,8 @@ private: bool keepalive; __u32 connect_seq, peer_global_seq; - __u32 out_seq; - __u32 in_seq, in_seq_acked; + __u64 out_seq; + __u64 in_seq, in_seq_acked; int accept(); // server handshake int connect(); // client handshake @@ -161,7 +161,7 @@ private: Message *read_message(); int write_message(Message *m); int do_sendmsg(int sd, struct msghdr *msg, int len); - int write_ack(unsigned s); + int write_ack(__u64 s); int write_keepalive(); void fault(bool silent=false, bool reader=false);