From 20ac2e35fa19b749a1e14a141edde78f43582029 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 25 Oct 2021 14:45:01 -0700 Subject: [PATCH] Remove clock_sync field from net message As we freeze the format let's remove this old experiment to try and make it easier to line up traces from different mounts. It never worked particularly well and I think it could be argued that trying to merge trace logs on different machines isn't a particularly meaningful thing to do. You care about how they interact not what they were doing at the same time with their indepdendent resources. Signed-off-by: Zach Brown --- kmod/src/format.h | 1 - kmod/src/net.c | 5 ----- kmod/src/scoutfs_trace.h | 26 -------------------------- kmod/src/super.c | 32 -------------------------------- kmod/src/super.h | 2 -- 5 files changed, 66 deletions(-) diff --git a/kmod/src/format.h b/kmod/src/format.h index d94fbe82..3cc2bb4f 100644 --- a/kmod/src/format.h +++ b/kmod/src/format.h @@ -970,7 +970,6 @@ struct scoutfs_net_greeting { * response messages. */ struct scoutfs_net_header { - __le64 clock_sync_id; __le64 seq; __le64 recv_seq; __le64 id; diff --git a/kmod/src/net.c b/kmod/src/net.c index 49ea837e..45e907ac 100644 --- a/kmod/src/net.c +++ b/kmod/src/net.c @@ -629,8 +629,6 @@ static void scoutfs_net_recv_worker(struct work_struct *work) break; } - trace_scoutfs_recv_clock_sync(nh.clock_sync_id); - data_len = le16_to_cpu(nh.data_len); scoutfs_inc_counter(sb, net_recv_messages); @@ -785,9 +783,6 @@ static void scoutfs_net_send_worker(struct work_struct *work) trace_scoutfs_net_send_message(sb, &conn->sockname, &conn->peername, &msend->nh); - msend->nh.clock_sync_id = scoutfs_clock_sync_id(); - trace_scoutfs_send_clock_sync(msend->nh.clock_sync_id); - ret = sendmsg_full(conn->sock, &msend->nh, len); spin_lock(&conn->lock); diff --git a/kmod/src/scoutfs_trace.h b/kmod/src/scoutfs_trace.h index 13ba3ae6..80db3247 100644 --- a/kmod/src/scoutfs_trace.h +++ b/kmod/src/scoutfs_trace.h @@ -1954,32 +1954,6 @@ TRACE_EVENT(scoutfs_quorum_loop, __entry->timeout_sec, __entry->timeout_nsec) ); -/* - * We can emit trace events to make it easier to synchronize the - * monotonic clocks in trace logs between nodes. By looking at the send - * and recv times of many messages flowing between nodes we can get - * surprisingly good estimates of the clock offset between them. - */ -DECLARE_EVENT_CLASS(scoutfs_clock_sync_class, - TP_PROTO(__le64 clock_sync_id), - TP_ARGS(clock_sync_id), - TP_STRUCT__entry( - __field(__u64, clock_sync_id) - ), - TP_fast_assign( - __entry->clock_sync_id = le64_to_cpu(clock_sync_id); - ), - TP_printk("clock_sync_id %016llx", __entry->clock_sync_id) -); -DEFINE_EVENT(scoutfs_clock_sync_class, scoutfs_send_clock_sync, - TP_PROTO(__le64 clock_sync_id), - TP_ARGS(clock_sync_id) -); -DEFINE_EVENT(scoutfs_clock_sync_class, scoutfs_recv_clock_sync, - TP_PROTO(__le64 clock_sync_id), - TP_ARGS(clock_sync_id) -); - TRACE_EVENT(scoutfs_trans_seq_last, TP_PROTO(struct super_block *sb, u64 rid, u64 trans_seq), diff --git a/kmod/src/super.c b/kmod/src/super.c index b2e821af..6dcb244f 100644 --- a/kmod/src/super.c +++ b/kmod/src/super.c @@ -20,7 +20,6 @@ #include #include #include -#include #include "super.h" #include "block.h" @@ -52,37 +51,6 @@ static struct dentry *scoutfs_debugfs_root; -static DEFINE_PER_CPU(u64, clock_sync_ids) = 0; - -/* - * Give the caller a unique clock sync id for a message they're about to - * send. We make the ids reasonably globally unique by using randomly - * initialized per-cpu 64bit counters. - */ -__le64 scoutfs_clock_sync_id(void) -{ - u64 rnd = 0; - u64 ret; - u64 *id; - -retry: - preempt_disable(); - id = this_cpu_ptr(&clock_sync_ids); - if (*id == 0) { - if (rnd == 0) { - preempt_enable(); - get_random_bytes(&rnd, sizeof(rnd)); - goto retry; - } - *id = rnd; - } - - ret = ++(*id); - preempt_enable(); - - return cpu_to_le64(ret); -} - /* the statfs file fields can be small (and signed?) :/ */ static __statfs_word saturate_truncated_word(u64 files) { diff --git a/kmod/src/super.h b/kmod/src/super.h index 4ca4b88f..51c11722 100644 --- a/kmod/src/super.h +++ b/kmod/src/super.h @@ -160,6 +160,4 @@ int scoutfs_write_super(struct super_block *sb, /* to keep this out of the ioctl.h public interface definition */ long scoutfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); -__le64 scoutfs_clock_sync_id(void); - #endif