}
}
+__u32 AsyncMessenger::get_global_seq(__u32 old_global_seq)
+{
+ __u32 ret;
+ // These are only used for logging.
+ __u32 prev_global = 0;
+ __u32 updated_to = 0;
+ bool did_update_to_old = false;
+
+ { // acquire lock
+ std::lock_guard<ceph::spinlock> lg(global_seq_lock);
+
+ if (old_global_seq > global_seq) {
+ // These are all for logging purposes
+ prev_global = global_seq;
+ updated_to = old_global_seq;
+ did_update_to_old = true;
+ // global_seq and ret are the only that matters.
+ global_seq = old_global_seq;
+ }
+ ret = ++global_seq;
+ } // release lock
+
+ if (did_update_to_old) {
+ ldout(cct, 10) << __func__ << " old_global_seq=" << old_global_seq
+ << " > global_seq=" << global_seq
+ << "; new global_seq=" << updated_to << dendl;
+ }
+ ldout(cct, 10) << __func__ << " increment to global_seq=" << global_seq << dendl;
+ return ret;
+}
+
int AsyncMessenger::get_proto_version(int peer_type, bool connect) const
{
int my_type = my_name.type();
*
* @return a global sequence ID that nobody else has seen.
*/
- __u32 get_global_seq(__u32 old=0) {
- std::lock_guard<ceph::spinlock> lg(global_seq_lock);
+ __u32 get_global_seq(__u32 old=0);
- if (old > global_seq)
- global_seq = old;
- __u32 ret = ++global_seq;
-
- return ret;
- }
/**
* Get the protocol version we support for the given peer type: either
* a peer protocol (if it matches our own), the protocol version for the
<< " conn("
<< connection << " " << this
<< " :" << connection->port << " s=" << get_state_name(state)
- << " pgs=" << peer_global_seq << " cs=" << connect_seq
- << " l=" << connection->policy.lossy << ").";
+ << " pgs=" << peer_global_seq << " gs=" << global_seq
+ << " cs=" << connect_seq << " l=" << connection->policy.lossy << ").";
}
#define WRITE(B, C) write(CONTINUATION(C), B)