[Ocfs2-commits] zab commits r2322 - trunk/fs/ocfs2/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed May 25 17:05:45 CDT 2005


Author: zab
Signed-off-by: mfasheh
Date: 2005-05-25 17:05:44 -0500 (Wed, 25 May 2005)
New Revision: 2322

Added:
   trunk/fs/ocfs2/cluster/net_proc.c
   trunk/fs/ocfs2/cluster/tcp_internal.h
Modified:
   trunk/fs/ocfs2/cluster/Makefile
   trunk/fs/ocfs2/cluster/nodemanager.c
   trunk/fs/ocfs2/cluster/tcp.c
   trunk/fs/ocfs2/cluster/tcp.h
Log:
o add /proc files to track sockets and tasks waiting on send

Signed-off-by: mfasheh


Modified: trunk/fs/ocfs2/cluster/Makefile
===================================================================
--- trunk/fs/ocfs2/cluster/Makefile	2005-05-25 21:29:35 UTC (rev 2321)
+++ trunk/fs/ocfs2/cluster/Makefile	2005-05-25 22:05:44 UTC (rev 2322)
@@ -26,6 +26,7 @@
 SOURCES =			\
 	heartbeat.c		\
 	masklog.c		\
+	net_proc.c		\
 	nodemanager.c		\
 	tcp.c			\
 	ver.c
@@ -37,6 +38,7 @@
 	ocfs2_heartbeat.h	\
 	ocfs2_nodemanager.h	\
 	tcp.h			\
+	tcp_internal.h		\
 	ver.h
 
 OBJECTS = $(subst .c,.o,$(SOURCES))

Added: trunk/fs/ocfs2/cluster/net_proc.c
===================================================================
--- trunk/fs/ocfs2/cluster/net_proc.c	2005-05-25 21:29:35 UTC (rev 2321)
+++ trunk/fs/ocfs2/cluster/net_proc.c	2005-05-25 22:05:44 UTC (rev 2322)
@@ -0,0 +1,392 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * Copyright (C) 2005 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/types.h>
+#include <linux/slab.h>
+#include <linux/highmem.h>
+#include <linux/utsname.h>
+#include <linux/init.h>
+#include <linux/sysctl.h>
+#include <linux/random.h>
+#include <linux/version.h>
+#include <linux/statfs.h>
+#include <linux/moduleparam.h>
+#include <linux/blkdev.h>
+#include <linux/proc_fs.h>
+#include <linux/file.h>
+#include <linux/kthread.h>
+#include <linux/kref.h>
+
+#include <asm/uaccess.h>
+
+#include "tcp.h"
+#include "nodemanager.h"
+#define MLOG_MASK_PREFIX ML_TCP
+#include "masklog.h"
+
+#include "tcp_internal.h"
+
+static DEFINE_SPINLOCK(net_proc_lock);
+
+static LIST_HEAD(sock_containers);
+static LIST_HEAD(send_tracking);
+
+void net_proc_add_nst(struct net_send_tracking *nst)
+{
+	spin_lock(&net_proc_lock);
+	list_add(&nst->st_net_proc_item, &send_tracking);
+	spin_unlock(&net_proc_lock);
+}
+void net_proc_del_nst(struct net_send_tracking *nst)
+{
+	spin_lock(&net_proc_lock);
+	if (!list_empty(&nst->st_net_proc_item))
+		list_del_init(&nst->st_net_proc_item);
+	spin_unlock(&net_proc_lock);
+}
+
+struct net_send_tracking *next_nst(struct net_send_tracking *nst_start)
+{
+	struct net_send_tracking *nst, *ret = NULL;
+
+	assert_spin_locked(&net_proc_lock);
+
+	list_for_each_entry(nst, &nst_start->st_net_proc_item,
+			    st_net_proc_item) {
+		/* discover the head of the list */
+		if (&nst->st_net_proc_item == &send_tracking)
+			break;
+
+		/* use st_task to detect real nsts in the list */
+		if (nst->st_task != NULL) {
+			ret = nst;
+			break;
+		}
+	}
+
+	return ret;
+}
+
+static void *nst_seq_start(struct seq_file *seq, loff_t *pos)
+{
+	struct net_send_tracking *nst, *dummy_nst = seq->private;
+
+	spin_lock(&net_proc_lock);
+	nst = next_nst(dummy_nst);
+	spin_unlock(&net_proc_lock);
+
+	return nst;
+}
+
+static void *nst_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+	struct net_send_tracking *nst, *dummy_nst = seq->private;
+
+	spin_lock(&net_proc_lock);
+	nst = next_nst(dummy_nst);
+	list_del_init(&dummy_nst->st_net_proc_item);
+	if (nst) 
+		list_add(&dummy_nst->st_net_proc_item,
+			 &nst->st_net_proc_item);
+	spin_unlock(&net_proc_lock);
+
+	return nst; /* unused, just needs to be null when done */
+}
+
+static int nst_seq_show(struct seq_file *seq, void *v)
+{
+	struct net_send_tracking *nst, *dummy_nst = seq->private;
+
+	spin_lock(&net_proc_lock);
+	nst = next_nst(dummy_nst);
+
+	if (nst != NULL) { 
+		/* get_task_comm isn't exported.  oh well. */
+		seq_printf(seq, "%p:\n"
+			   "  pid:          %lu\n"
+			   "  tgid:         %lu\n"
+			   "  process name: %s\n"
+			   "  node:         %s\n"
+			   "  sc:           %p\n"
+			   "  message type: %u\n"
+			   "  message key:  0x%08x\n"
+			   "  sock acquiry: %lu.%lu\n"
+			   "  send start:   %lu.%lu\n"
+			   "  wait start:   %lu.%lu\n",
+			   nst, (unsigned long)nst->st_task->pid,
+			   (unsigned long)nst->st_task->tgid,
+			   nst->st_task->comm, nst->st_node->nd_name,
+			   nst->st_sc, nst->st_msg_type, nst->st_msg_key,
+			   nst->st_sock_time.tv_sec, nst->st_sock_time.tv_usec,
+			   nst->st_send_time.tv_sec, nst->st_send_time.tv_usec,
+			   nst->st_status_time.tv_sec,
+			   nst->st_status_time.tv_usec);
+	}
+
+	spin_unlock(&net_proc_lock);
+
+	return 0;
+}
+
+static void nst_seq_stop(struct seq_file *seq, void *v)
+{
+}
+
+static struct seq_operations nst_seq_ops = {
+	.start = nst_seq_start,
+	.next = nst_seq_next,
+	.stop = nst_seq_stop,
+	.show = nst_seq_show,
+};
+
+static int nst_fop_open(struct inode *inode, struct file *file)
+{
+	struct net_send_tracking *dummy_nst;
+	struct seq_file *seq;
+	int ret;
+
+	dummy_nst = kmalloc(sizeof(struct net_send_tracking), GFP_KERNEL);
+	if (dummy_nst == NULL) {
+		ret = -ENOMEM;
+		goto out;
+	}
+	dummy_nst->st_task = NULL;
+
+	ret = seq_open(file, &nst_seq_ops);
+	if (ret)
+		goto out;
+
+	seq = file->private_data;
+	seq->private = dummy_nst;
+	net_proc_add_nst(dummy_nst);
+
+	dummy_nst = NULL;
+
+out:
+	kfree(dummy_nst);
+	return ret;
+}
+
+static int nst_fop_release(struct inode *inode, struct file *file)
+{
+	struct seq_file *seq = file->private_data;
+	struct net_send_tracking *dummy_nst = seq->private;
+
+	net_proc_del_nst(dummy_nst);
+	return seq_release_private(inode, file);
+}
+
+static struct file_operations nst_seq_fops = {
+	.owner = THIS_MODULE,
+	.open = nst_fop_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = nst_fop_release,
+};
+
+void net_proc_add_sc(struct net_sock_container *sc)
+{
+	spin_lock(&net_proc_lock);
+	list_add(&sc->sc_net_proc_item, &sock_containers);
+	spin_unlock(&net_proc_lock);
+}
+void net_proc_del_sc(struct net_sock_container *sc)
+{
+	spin_lock(&net_proc_lock);
+	list_del_init(&sc->sc_net_proc_item);
+	spin_unlock(&net_proc_lock);
+}
+
+struct net_sock_container *next_sc(struct net_sock_container *sc_start)
+{
+	struct net_sock_container *sc, *ret = NULL;
+
+	assert_spin_locked(&net_proc_lock);
+
+	list_for_each_entry(sc, &sc_start->sc_net_proc_item, sc_net_proc_item) {
+		/* discover the head of the list miscast as a sc */
+		if (&sc->sc_net_proc_item == &sock_containers)
+			break;
+
+		/* use sc_page to detect real scs in the list */
+		if (sc->sc_page != NULL) {
+			ret = sc;
+			break;
+		}
+	}
+
+	return ret;
+}
+
+static void *sc_seq_start(struct seq_file *seq, loff_t *pos)
+{
+	struct net_sock_container *sc, *dummy_sc = seq->private;
+
+	spin_lock(&net_proc_lock);
+	sc = next_sc(dummy_sc);
+	spin_unlock(&net_proc_lock);
+
+	return sc;
+}
+
+static void *sc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+	struct net_sock_container *sc, *dummy_sc = seq->private;
+
+	spin_lock(&net_proc_lock);
+	sc = next_sc(dummy_sc);
+	list_del_init(&dummy_sc->sc_net_proc_item);
+	if (sc) 
+		list_add(&dummy_sc->sc_net_proc_item, &sc->sc_net_proc_item);
+	spin_unlock(&net_proc_lock);
+
+	return sc; /* unused, just needs to be null when done */
+}
+
+static int sc_seq_show(struct seq_file *seq, void *v)
+{
+	struct net_sock_container *sc, *dummy_sc = seq->private;
+
+	spin_lock(&net_proc_lock);
+	sc = next_sc(dummy_sc);
+
+	if (sc != NULL) {
+		struct inet_sock *inet = NULL;
+		u32 saddr = 0, daddr = 0;
+
+		if (sc->sc_sock)
+			inet = inet_sk(sc->sc_sock->sk);
+			saddr = inet->saddr;
+			daddr = inet->daddr;
+
+		seq_printf(seq, "%p:\n"
+			   "  krefs:           %d\n"
+			   "  sock:            %u.%u.%u.%u:%u -> %u.%u.%u.%u:%u\n"
+			   "  remote node:     %s\n"
+			   "  from connect:    %u\n"
+			   "  pending connect: %u\n"
+			   "  _item on list:   %u\n"
+			   "  page off:        %zu\n",
+			   sc, atomic_read(&sc->sc_kref.refcount),
+			   NIPQUAD(saddr), inet ? ntohs(inet->sport) : 0,
+			   NIPQUAD(daddr), inet ? ntohs(inet->dport) : 0,
+			   sc->sc_node ? sc->sc_node->nd_name : "[detached]",
+			   sc->sc_from_connect, sc->sc_pending_connect,
+			   !list_empty(&sc->sc_item), sc->sc_page_off);
+	}
+
+
+	spin_unlock(&net_proc_lock);
+
+	return 0;
+}
+
+static void sc_seq_stop(struct seq_file *seq, void *v)
+{
+}
+
+static struct seq_operations sc_seq_ops = {
+	.start = sc_seq_start,
+	.next = sc_seq_next,
+	.stop = sc_seq_stop,
+	.show = sc_seq_show,
+};
+
+static int sc_fop_open(struct inode *inode, struct file *file)
+{
+	struct net_sock_container *dummy_sc;
+	struct seq_file *seq;
+	int ret;
+
+	dummy_sc = kmalloc(sizeof(struct net_sock_container), GFP_KERNEL);
+	if (dummy_sc == NULL) {
+		ret = -ENOMEM;
+		goto out;
+	}
+	dummy_sc->sc_page = NULL;
+
+	ret = seq_open(file, &sc_seq_ops);
+	if (ret)
+		goto out;
+
+	seq = file->private_data;
+	seq->private = dummy_sc;
+	net_proc_add_sc(dummy_sc);
+
+	dummy_sc = NULL;
+
+out:
+	kfree(dummy_sc);
+	return ret;
+}
+
+static int sc_fop_release(struct inode *inode, struct file *file)
+{
+	struct seq_file *seq = file->private_data;
+	struct net_sock_container *dummy_sc = seq->private;
+
+	net_proc_del_sc(dummy_sc);
+	return seq_release_private(inode, file);
+}
+
+static struct file_operations sc_seq_fops = {
+	.owner = THIS_MODULE,
+	.open = sc_fop_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = sc_fop_release,
+};
+
+#define SC_PROC_NAME "sock_containers"
+#define NST_PROC_NAME "send_tracking"
+
+void net_proc_exit(struct proc_dir_entry *parent)
+{
+	remove_proc_entry(SC_PROC_NAME, parent);
+	remove_proc_entry(NST_PROC_NAME, parent);
+}
+EXPORT_SYMBOL(net_proc_exit);
+
+int net_proc_init(struct proc_dir_entry *parent)
+{
+	struct proc_dir_entry *proc_sc = NULL, *proc_nst = NULL;
+	int ret;
+
+	proc_sc = create_proc_entry(SC_PROC_NAME, S_IRUGO, parent);
+	proc_nst = create_proc_entry(NST_PROC_NAME, S_IRUGO, parent);
+
+	if (proc_sc && proc_nst) {
+		ret = 0;
+		proc_sc->proc_fops = &sc_seq_fops;
+		proc_nst->proc_fops = &nst_seq_fops;
+	} else {
+		ret = -ENOMEM;
+		if (proc_sc)
+			remove_proc_entry(SC_PROC_NAME, parent);
+		if (proc_nst)
+			remove_proc_entry(NST_PROC_NAME, parent);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(net_proc_init);

Modified: trunk/fs/ocfs2/cluster/nodemanager.c
===================================================================
--- trunk/fs/ocfs2/cluster/nodemanager.c	2005-05-25 21:29:35 UTC (rev 2321)
+++ trunk/fs/ocfs2/cluster/nodemanager.c	2005-05-25 22:05:44 UTC (rev 2322)
@@ -771,6 +771,7 @@
 	configfs_unregister_subsystem(&nm_cluster_group.cs_subsys);
 	nm_remove_proc(nm_proc);
 	mlog_remove_proc(nm_proc);
+	net_proc_exit(nm_proc);
 	remove_proc_entry(NM_PROC_PATH, NULL);
 }
 
@@ -848,12 +849,19 @@
 
 	ret = mlog_init_proc(nm_proc);
 	if (ret)
-		goto out_subsys;
+		goto out_remove;
 
+	ret = net_proc_init(nm_proc);
+	if (ret)
+		goto out_mlog;
+
 	ret = nm_init_proc(nm_proc);
 	if (ret == 0)
 		goto out;
 
+out_mlog:
+	mlog_remove_proc(nm_proc);
+out_remove:
 	remove_proc_entry(NM_PROC_PATH, NULL);
 out_subsys:
 	configfs_unregister_subsystem(&nm_cluster_group.cs_subsys);

Modified: trunk/fs/ocfs2/cluster/tcp.c
===================================================================
--- trunk/fs/ocfs2/cluster/tcp.c	2005-05-25 21:29:35 UTC (rev 2321)
+++ trunk/fs/ocfs2/cluster/tcp.c	2005-05-25 22:05:44 UTC (rev 2322)
@@ -98,20 +98,20 @@
 
 #include <asm/uaccess.h>
 
-
-
 #include "heartbeat.h"
 #include "tcp.h"
 #include "nodemanager.h"
 #define MLOG_MASK_PREFIX ML_TCP
 #include "masklog.h"
 
+#include "tcp_internal.h"
+
 /* In the following two log macros, the whitespace after the ',' just
  * before ##args is intentional. Otherwise, gcc 2.95 will eat the
  * previous token if args expands to nothing.
  */
 
-#define __msg_fmt "[mag %u len %u typ %u stat %d sys_stat %d key %u num %u] "
+#define __msg_fmt "[mag %u len %u typ %u stat %d sys_stat %d key %08x num %u] "
 #define __msg_args __hdr->magic, __hdr->data_len, __hdr->msg_type, 	\
  	__hdr->status,	__hdr->sys_status, __hdr->key, __hdr->msg_num
 #define msglog(hdr, fmt, args...) do {					\
@@ -130,49 +130,6 @@
 	mlog(ML_SOCKET, __sc_fmt fmt, __sc_args , ##args);		\
 } while (0)
 
-
-struct net_sock_container {
-	/* sockets themselves don't seem to have a nice way to refcount them
-	 * above sock_release.  one could use iget/iput, but that seems
-	 * to interact poorly with sock_release() itself calling iput. */
-
-	struct kref		sc_kref;
-	spinlock_t		sc_lock;
-	struct socket		*sc_sock;
-	struct nm_node		*sc_node;
-	unsigned		sc_from_connect:1,
-				sc_pending_connect:1;
-
-	struct list_head	sc_item;
-
-	struct list_head	sc_handlers;
-	struct page 		*sc_page;
-	size_t			sc_page_off;
-
-	/* original handlers for the sockets */
-	void			(*sc_state_change)(struct sock *sk);
-	void			(*sc_data_ready)(struct sock *sk, int bytes);
-};
-
-struct net_msg_handler {
-	struct rb_node		nh_node;
-	u32			nh_max_len;
-	u32			nh_msg_type;
-	u32			nh_key;
-	net_msg_handler_func	*nh_func;
-	net_msg_handler_func	*nh_func_data;
-	struct kref		nh_kref;
-	struct list_head	nh_unregister_item;
-};
-
-struct net_status_wait {
-	enum net_system_error	ns_sys_status;
-	s32			ns_status;
-	int			ns_id;
-	wait_queue_head_t	ns_wq;
-	struct list_head	ns_node_item;
-};
-
 static rwlock_t net_handler_lock = RW_LOCK_UNLOCKED;
 static struct rb_root net_handler_tree = RB_ROOT;
 
@@ -580,13 +537,13 @@
 		rb_insert_color(&nmh->nh_node, &net_handler_tree);
 		list_add_tail(&nmh->nh_unregister_item, unreg_list);
 
-		mlog(ML_TCP, "registered handler func %p type %u key %u\n",
+		mlog(ML_TCP, "registered handler func %p type %u key %08x\n",
 		     func, msg_type, key);
 		/* we've had some trouble with handlers seemingly vanishing. */
 		mlog_bug_on_msg(net_handler_tree_lookup(msg_type, key, &p,
 						         &parent) == NULL,
 			        "couldn't find handler we *just* registerd "
-				"for type %u key %u\n", msg_type, key);
+				"for type %u key %08x\n", msg_type, key);
 	}
 	write_unlock(&net_handler_lock);
 	if (ret)
@@ -609,7 +566,7 @@
 	list_for_each_safe(pos, n, list) {
 		nmh = list_entry(pos, struct net_msg_handler,
 				 nh_unregister_item);
-		mlog(ML_TCP, "unregistering handler func %p type %u key %u\n",
+		mlog(ML_TCP, "unregistering handler func %p type %u key %08x\n",
 		     nmh->nh_func, nmh->nh_msg_type, nmh->nh_key);
 		rb_erase(&nmh->nh_node, &net_handler_tree);
 		list_del_init(&nmh->nh_unregister_item);
@@ -806,6 +763,12 @@
 	struct net_status_wait nsw = {
 		.ns_node_item = LIST_HEAD_INIT(nsw.ns_node_item),
 	};
+	struct net_send_tracking nst = {
+		.st_net_proc_item = LIST_HEAD_INIT(nst.st_net_proc_item),
+		.st_task = current,
+		.st_msg_type = msg_type,
+		.st_msg_key = key,
+	};
 
 	BUG_ON(net_recv_task && (current == net_recv_task));
 
@@ -842,10 +805,16 @@
 		goto out;
 	}
 
+	nst.st_node = node;
+	net_proc_add_nst(&nst);
+
+	do_gettimeofday(&nst.st_sock_time);
 	ret = net_sc_from_node(node, &sc);
 	if (ret)
 		goto out;
 
+	nst.st_sc = sc;
+
 	/* build up our iovec */
 	iovlen = caller_iovlen + 1;
 	iov = kmalloc(sizeof(struct iovec) * iovlen, GFP_KERNEL);
@@ -879,6 +848,7 @@
 
 	msg->msg_num = nsw.ns_id;
 
+	do_gettimeofday(&nst.st_send_time);
 	/* finally, convert the message header to network byte-order
 	 * and send */
 	net_msg_to_net(msg);
@@ -892,6 +862,7 @@
 	}
 
 	/* wait on other node's handler */
+	do_gettimeofday(&nst.st_status_time);
 	wait_event(nsw.ns_wq, net_nsw_completed(node, &nsw));
 
 	/* Note that we avoid overwriting the callers status return
@@ -904,6 +875,7 @@
 	mlog(0, "woken, returning system status %d, user status %d\n",
 	     ret, nsw.ns_status);
 out:
+	net_proc_del_nst(&nst); /* must be before dropping sc and node */
 	if (sc)
 		sc_put(sc);
 	if (iov)
@@ -1220,7 +1192,7 @@
 	handler_status = 0;
 	nmh = net_handler_get(hdr->msg_type, hdr->key);
 	if (!nmh) {
-		mlog(ML_TCP, "couldn't find handler for type %u key %u\n",
+		mlog(ML_TCP, "couldn't find handler for type %u key %08x\n",
 		     hdr->msg_type, hdr->key);
 		syserr = NET_ERR_NO_HNDLR;
 		goto out_respond;
@@ -1398,6 +1370,7 @@
 
 	ret = sc;
 	sc->sc_page = page;
+	net_proc_add_sc(sc);
 	sc = NULL;
 	page = NULL;
 

Modified: trunk/fs/ocfs2/cluster/tcp.h
===================================================================
--- trunk/fs/ocfs2/cluster/tcp.h	2005-05-25 21:29:35 UTC (rev 2321)
+++ trunk/fs/ocfs2/cluster/tcp.h	2005-05-25 22:05:44 UTC (rev 2322)
@@ -164,4 +164,11 @@
 struct net_sock_container;
 void net_detach_sc(struct net_sock_container *sc, struct nm_node *node);
 
+int net_proc_init(struct proc_dir_entry *parent);
+void net_proc_exit(struct proc_dir_entry *parent);
+
+struct net_send_tracking;
+void net_proc_add_nst(struct net_send_tracking *nst);
+void net_proc_del_nst(struct net_send_tracking *nst);
+
 #endif /* CLUSTER_TCP_H */

Added: trunk/fs/ocfs2/cluster/tcp_internal.h
===================================================================
--- trunk/fs/ocfs2/cluster/tcp_internal.h	2005-05-25 21:29:35 UTC (rev 2321)
+++ trunk/fs/ocfs2/cluster/tcp_internal.h	2005-05-25 22:05:44 UTC (rev 2322)
@@ -0,0 +1,86 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * Copyright (C) 2005 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ */
+
+#ifndef CLUSTER_TCP_INTERNAL_H
+#define CLUSTER_TCP_INTERNAL_H
+
+struct net_sock_container {
+	/* sockets themselves don't seem to have a nice way to refcount them
+	 * above sock_release.  one could use iget/iput, but that seems
+	 * to interact poorly with sock_release() itself calling iput. */
+
+	struct kref		sc_kref;
+	spinlock_t		sc_lock;
+	struct socket		*sc_sock;
+	struct nm_node		*sc_node;
+	unsigned		sc_from_connect:1,
+				sc_pending_connect:1;
+
+	struct list_head	sc_item;
+
+	struct list_head	sc_handlers;
+	struct page 		*sc_page;
+	size_t			sc_page_off;
+
+	/* original handlers for the sockets */
+	void			(*sc_state_change)(struct sock *sk);
+	void			(*sc_data_ready)(struct sock *sk, int bytes);
+
+	struct list_head	sc_net_proc_item;
+};
+
+struct net_msg_handler {
+	struct rb_node		nh_node;
+	u32			nh_max_len;
+	u32			nh_msg_type;
+	u32			nh_key;
+	net_msg_handler_func	*nh_func;
+	net_msg_handler_func	*nh_func_data;
+	struct kref		nh_kref;
+	struct list_head	nh_unregister_item;
+};
+
+struct net_status_wait {
+	enum net_system_error	ns_sys_status;
+	s32			ns_status;
+	int			ns_id;
+	wait_queue_head_t	ns_wq;
+	struct list_head	ns_node_item;
+};
+
+/* just for state dumps */
+struct net_send_tracking {
+	struct list_head		st_net_proc_item;
+	struct task_struct		*st_task;
+	struct nm_node			*st_node;
+	struct net_sock_container	*st_sc;
+	u32				st_msg_type;
+	u32				st_msg_key;
+	struct timeval			st_sock_time;
+	struct timeval			st_send_time;
+	struct timeval			st_status_time;
+};
+
+void net_proc_add_sc(struct net_sock_container *sc);
+void net_proc_del_sc(struct net_sock_container *sc);
+
+#endif /* CLUSTER_TCP_INTERNAL_H */



More information about the Ocfs2-commits mailing list