From 373def02f080e9bd11f596fdd4cbec88a9ce948e Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 18 May 2017 10:51:09 -0700 Subject: [PATCH] scoutfs: remove trade_time message This was mostly just a demonstration for how to add messages. We're about to add a message that we always send on mount so this becomes completely redundant. Signed-off-by: Zach Brown --- kmod/src/format.h | 4 +-- kmod/src/net.c | 66 ----------------------------------------------- kmod/src/net.h | 1 - kmod/src/super.c | 2 -- 4 files changed, 1 insertion(+), 72 deletions(-) diff --git a/kmod/src/format.h b/kmod/src/format.h index 7e91afa1..4afd26f6 100644 --- a/kmod/src/format.h +++ b/kmod/src/format.h @@ -426,9 +426,7 @@ struct scoutfs_net_segnos { } __packed; enum { - /* sends and receives a struct scoutfs_timeval */ - SCOUTFS_NET_TRADE_TIME = 0, - SCOUTFS_NET_ALLOC_INODES, + SCOUTFS_NET_ALLOC_INODES = 0, SCOUTFS_NET_MANIFEST_RANGE_ENTRIES, SCOUTFS_NET_ALLOC_SEGNO, SCOUTFS_NET_RECORD_SEGMENT, diff --git a/kmod/src/net.c b/kmod/src/net.c index 14f1d4f3..eb34d12b 100644 --- a/kmod/src/net.c +++ b/kmod/src/net.c @@ -628,45 +628,12 @@ static struct send_buf *process_alloc_inodes(struct super_block *sb, return sbuf; } -/* - * Log the time in the request and reply with our current time. - */ -static struct send_buf *process_trade_time(struct super_block *sb, - void *r, int req_len) -{ - struct scoutfs_timespec *req = r; - struct scoutfs_timespec *reply; - struct send_buf *sbuf; - struct timespec64 ts; - - if (req_len != sizeof(*req)) - return ERR_PTR(-EINVAL); - - sbuf = alloc_sbuf(sizeof(struct scoutfs_timespec)); - if (!sbuf) - return ERR_PTR(-ENOMEM); - - getnstimeofday64(&ts); - trace_printk("req %llu.%u replying %llu.%lu\n", - le64_to_cpu(req->sec), le32_to_cpu(req->nsec), - (u64)ts.tv_sec, ts.tv_nsec); - - reply = (void *)sbuf->nh->data; - reply->sec = cpu_to_le64(ts.tv_sec); - reply->nsec = cpu_to_le32(ts.tv_nsec); - - sbuf->nh->status = SCOUTFS_NET_STATUS_SUCCESS; - - return sbuf; -} - typedef struct send_buf *(*proc_func_t)(struct super_block *sb, void *req, int req_len); static proc_func_t type_proc_func(u8 type) { static proc_func_t funcs[] = { - [SCOUTFS_NET_TRADE_TIME] = process_trade_time, [SCOUTFS_NET_ALLOC_INODES] = process_alloc_inodes, [SCOUTFS_NET_MANIFEST_RANGE_ENTRIES] = process_manifest_range_entries, @@ -1583,39 +1550,6 @@ int scoutfs_net_alloc_inodes(struct super_block *sb) alloc_inodes_reply, NULL); } -static int trade_time_reply(struct super_block *sb, void *reply, int ret, - void *arg) -{ - struct scoutfs_timespec *ts = reply; - - if (ret != sizeof(*ts)) - return -EINVAL; - - trace_printk("reply %llu.%u\n", - le64_to_cpu(ts->sec), le32_to_cpu(ts->nsec)); - - return 0; -} - -int scoutfs_net_trade_time(struct super_block *sb) -{ - struct scoutfs_timespec send; - struct timespec64 ts; - int ret; - - getnstimeofday64(&ts); - send.sec = cpu_to_le64(ts.tv_sec); - send.nsec = cpu_to_le32(ts.tv_nsec); - - ret = add_send_buf(sb, SCOUTFS_NET_TRADE_TIME, &send, - sizeof(send), trade_time_reply, NULL); - - trace_printk("sent %llu.%lu ret %d\n", - (u64)ts.tv_sec, ts.tv_nsec, ret); - - return ret; -} - static struct sock_info *alloc_sinf(struct super_block *sb) { struct sock_info *sinf; diff --git a/kmod/src/net.h b/kmod/src/net.h index 125bf327..e51d9266 100644 --- a/kmod/src/net.h +++ b/kmod/src/net.h @@ -4,7 +4,6 @@ struct scoutfs_key_buf; struct scoutfs_segment; -int scoutfs_net_trade_time(struct super_block *sb); int scoutfs_net_alloc_inodes(struct super_block *sb); int scoutfs_net_manifest_range_entries(struct super_block *sb, struct scoutfs_key_buf *start, diff --git a/kmod/src/super.c b/kmod/src/super.c index bcf831fc..847b79b8 100644 --- a/kmod/src/super.c +++ b/kmod/src/super.c @@ -234,8 +234,6 @@ static int scoutfs_fill_super(struct super_block *sb, void *data, int silent) if (ret) return ret; - scoutfs_net_trade_time(sb); - inode = scoutfs_iget(sb, SCOUTFS_ROOT_INO); if (IS_ERR(inode)) return PTR_ERR(inode);