[Ocfs2-commits] jlbec commits r1804 - trunk/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Jan 20 13:12:45 CST 2005


Author: jlbec
Date: 2005-01-20 13:12:43 -0600 (Thu, 20 Jan 2005)
New Revision: 1804

Removed:
   trunk/cluster/test.c
Modified:
   trunk/cluster/Makefile
Log:

o Remove the old, hasn't-been-touched-in-ever test module.



Modified: trunk/cluster/Makefile
===================================================================
--- trunk/cluster/Makefile	2005-01-20 19:03:22 UTC (rev 1803)
+++ trunk/cluster/Makefile	2005-01-20 19:12:43 UTC (rev 1804)
@@ -40,16 +40,7 @@
 
 ocfs2_tcp-objs := tcp.o util.o $(COMPAT_LIBFS)
 
-#
-# Whack testing thingy.
-#
-ifndef CONFIG_OCFS2_CLUSTER_TEST
-CONFIG_OCFS2_CLUSTER_TEST := n
-endif
-obj-$(CONFIG_OCFS2_CLUSTER_TEST) += ocfs2_cluster_test.o
-ocfs2_cluster_test-objs := test.o util.o $(COMPAT_LIBFS)
 
-
 ifeq ($(KERNELRELEASE),)
 #
 # Called from a regular "make".
@@ -68,8 +59,7 @@
 	heartbeat.c	\
 	nodemanager.c	\
 	tcp.c		\
-	util.c		\
-	test.c
+	util.c
 
 HEADERS = 		\
 	compat_libfs.h	\

Deleted: trunk/cluster/test.c
===================================================================
--- trunk/cluster/test.c	2005-01-20 19:03:22 UTC (rev 1803)
+++ trunk/cluster/test.c	2005-01-20 19:12:43 UTC (rev 1804)
@@ -1,826 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * test.c
- *
- * test module
- *
- * Copyright (C) 2004 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.
- *
- * Authors: Kurt Hackel
- */
-
-#include "warning_hack.h"
-
-#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>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-#include <linux/statfs.h>
-#include <linux/moduleparam.h>
-#endif
-#include <linux/blkdev.h>
-#include <linux/socket.h>
-#include <net/sock.h>
-#include <linux/inet.h>
-#include <linux/in.h>
-#include <linux/proc_fs.h>
-
-#include <asm/uaccess.h>
-
-#include "dlm_compat.h"
-#include "util.h"
-#include "dlmcommon.h"
-
-#include "heartbeat.h"
-#include "tcp.h"
-#include "nodemanager.h"
-#include "dlmmod.h"
-
-#include "compat_libfs.h"
-
-#define testprintk(x, arg...)    printk("TEST: (%d) " x, current->pid, ##arg)
-#define testprintk0(x)           printk("TEST: (%d) " x, current->pid)
-
-
-static ssize_t write_net_register(struct file *file, char *buf, size_t size);
-static ssize_t write_net_send(struct file *file, char *buf, size_t size);
-static ssize_t write_net_get_num(struct file *file, char *buf, size_t size);
-static ssize_t write_dlm_poop(struct file *file, char *buf, size_t size);
-static ssize_t write_dlm_poop2(struct file *file, char *buf, size_t size);
-static ssize_t write_dlm_poop3(struct file *file, char *buf, size_t size);
-static ssize_t write_dlm_register(struct file *file, char *buf, size_t size);
-
-enum {
-	TEST_Root = 1,
-	TEST_NetRegister,
-	TEST_NetSend,
-	TEST_NetGetNum,
-	TEST_DLMPoop,
-	TEST_DLMPoop2,
-	TEST_DLMPoop3,
-	TEST_DLMRegister
-};
-
-extern spinlock_t net_state_lock;
-extern u32 net_driver_state;
-extern struct file_operations transaction_ops;
-extern u32 net_num_dispatched;
-
-
-static void test_teardown(void);
-
-int test_small_msg_func(net_msg *msg, u32 len, void *data);
-
-static int test_net_send(int arg);
-static int test_net_register(int arg);
-static int test_net_get_num(int arg);
-static int test_dlm_poop(int arg);
-static int test_dlm_poop2(int arg);
-static int test_dlm_poop3(int arg);
-static int test_dlm_register(int arg);
-
-
-
-int test_small_msg_func(net_msg *msg, u32 len, void *data)
-{
-	testprintk("got a message!  type=%u, len=%u, data=%d\n", msg->msg_type, len, *(int *)data);
-	return 0;
-}
-
-#define TEST_MSG_TYPE1    87654321
-#define TEST_KEY1         12378534
-	
-int test_data1 = 723123123;
-
-static int test_net_register(int arg)
-{
-	int ret;
-	struct inode *dest_inode;
-	u16 dest_node_num = (u16)arg;
-
-	testprintk("running test_net_register: will contact node %u\n", dest_node_num);
-
-	dest_inode = nm_get_node_by_num(dest_node_num);
-	if (!dest_inode) {
-		testprintk("eeek! failed to find node %u\n", dest_node_num);
-		return 0;
-	}
-	{       
-		struct dentry *dentry = list_entry(dest_inode->i_dentry.next, struct dentry, d_alias);
-		testprintk("found node %u, name %*s\n", dest_node_num, dentry->d_name.len, dentry->d_name.name);
-	}
-
-	ret = net_register_handler(TEST_MSG_TYPE1, TEST_KEY1, 0, 0,
-				   test_small_msg_func, &test_data1, NULL);
-	if (ret < 0) {
-		testprintk0("eek!  register failed!\n");
-		return -1;
-	}
-	ret = net_register_handler(TEST_MSG_TYPE1, TEST_KEY1, 0, 0,
-				   test_small_msg_func, &test_data1, NULL);
-	if (ret >= 0) {
-		testprintk0("eek!  re-register was supposed to fail but didnt!!!\n");
-		return -1;
-	}
-	testprintk0("sweet.  re-register failed like it should have.\n");
-
-	testprintk0("creating socket now...\n");
-	ret = net_init_tcp_sock(dest_inode);
-	if (ret < 0) {
-		testprintk0("failed to make socket\n");
-		return -1;
-	}
-	testprintk("net_init_tcp_sock returned %d\n", ret);
-
-	testprintk0("leaving test_net_register!\n");
-	return 0;
-}
-
-
-static int test_net_send(int arg)
-{
-	int ret;
-	struct inode *dest_inode;
-	u16 dest_node_num = (u16)arg;
-
-	testprintk("running test_net_send: will contact node %u\n", dest_node_num);
-
-	dest_inode = nm_get_node_by_num(dest_node_num);
-	if (!dest_inode) {
-		testprintk("eeek! failed to find node %u\n", dest_node_num);
-		return 0;
-	}
-	{
-		struct dentry *dentry = list_entry(dest_inode->i_dentry.next, struct dentry, d_alias);
-		testprintk("found node %u, name %*s\n", dest_node_num, dentry->d_name.len, dentry->d_name.name);
-	}
-
-	testprintk0("packaging message now\n");
-
-	{
-		testprintk0("woo!  made a message packet... lets try sending it to ourself...\n");
-		testprintk0("waiting for socket to be created\n");
-		while (1) {
-			printk(".");
-			spin_lock(&net_state_lock);
-			if (net_driver_state == NET_DRIVER_READY) {
-				spin_unlock(&net_state_lock);
-				break;
-			}
-			spin_unlock(&net_state_lock);
-			util_sleep (100);
-		}
-		printk(".  done... let's go!\n");
-		ret = net_send_message(TEST_MSG_TYPE1, TEST_KEY1, NULL, 0, dest_inode, NULL);
-		testprintk("sent!!!! ret=%d\n", ret);
-	}
-	testprintk0("leaving test_net_send!\n");
-	return 0;
-	
-}
-
-static int test_net_get_num(int arg)
-{
-	testprintk("number of messages dispatched: %u\n", net_num_dispatched);
-	return 0;
-}
-
-void my_ast(void *data);
-void my_bast(void *data, int blocked_type);
-	
-dlm_lockstatus lksb1, lksb2;
-wait_queue_head_t convert_wq;
-atomic_t convert_flag;
-
-dlm_ctxt *the_dlm = NULL;
-
-static int test_dlm_poop(int arg)
-{
-	testprintk("calling dlm_dump_dlm(%p)\n", the_dlm);
-	if (the_dlm)
-		dlm_dump_dlm(the_dlm);
-
-#if 0
-	dlm_ctxt *dlm;
-	dlm_status status;
-	void *data1 = &lksb1;
-	void *data2 = &lksb2;
-	int ret;
-
-	memset(&lksb1, 0, sizeof(dlm_lockstatus));
-	memset(&lksb1, 0, sizeof(dlm_lockstatus));
-
-	testprintk0("calling dlm_register_domain...\n");
-	dlm = dlm_register_domain("mylittledomain", "grupo2", 0x6543abcd);
-	testprintk("dlm_register_domain returned %p\n", dlm);
-
-	testprintk0("calling dlmlock...\n");
-	status = dlmlock(dlm, LKM_EXMODE, &lksb1, 0, "lock1", my_ast, data1, my_bast);
-	testprintk("dlmlock returned %d.  lksb.status=%d, lock=%p\n", status, lksb1.status, lksb1.lockid);
-
-	testprintk0("calling dlmlock to do a convert...\n");
-	status = dlmlock(dlm, LKM_PRMODE, &lksb1, LKM_CONVERT, "lock1", my_ast, data1, my_bast);
-	testprintk("dlmlock returned %d\n", status);
-
-	init_waitqueue_head (&convert_wq);
-	atomic_set(&convert_flag, 0);
-
-	testprintk0("calling second dlmlock...\n");
-	status = dlmlock(dlm, LKM_EXMODE, &lksb2, 0, "lock1", my_ast, data2, my_bast);
-	testprintk("dlmlock returned %d.  lksb.status=%d, lock=%p\n", status, lksb2.status, lksb2.lockid);
-
-	testprintk0("sleeping now!\n");
-	ret = util_wait_atomic_eq(&convert_wq, &convert_flag, 1, 20000);
-	testprintk("wait returned %d\n", ret);
-
-	testprintk0("calling dlmlock to do a convert the blocking lock to NL...\n");
-	status = dlmlock(dlm, LKM_NLMODE, &lksb1, LKM_CONVERT, "lock1", my_ast, data2, my_bast);
-	testprintk("dlmlock returned %d\n", status);
-
-	testprintk0("sleeping\n");
-	util_sleep(10000);
-	testprintk0("DONE!\n");
-#endif
-	return 0;
-}
-
-
-void my_ast(void *data)
-{
-	dlm_lockstatus *l = data;
-	dlm_lock *lock = l->lockid;
-	dlm_lock_resource *res = lock->lockres;
-
-	testprintk("AST!!!:   lockstatus=%p, lock=%p, lockres=%p, lockname=%*s, type=%d\n", 
-	       l, lock, res, res->lockname.len, res->lockname.name, lock->type);
-}
-
-void my_bast(void *data, int blocked_type)
-{
-	dlm_lockstatus *l = data;
-	dlm_lock *lock = l->lockid;
-	dlm_lock_resource *res = lock->lockres;
-
-	testprintk("BAST!!!:   blocked=%d, lockstatus=%p, lock=%p, lockres=%p, lockname=%*s, type=%d\n", 
-	       blocked_type, l, lock, res, res->lockname.len, res->lockname.name, lock->type);
-	atomic_set(&convert_flag, 1);
-	wake_up(&convert_wq);
-}
-
-atomic_t finish;
-
-typedef struct _poo
-{
-	struct task_struct *task;
-	dlm_ctxt *dlm;
-	dlm_lockstatus *lksb;
-	wait_queue_head_t wq;
-	atomic_t ast_flag;
-	atomic_t bast_flag;
-	struct completion complete;
-} poo;
-void my_ast2(void *data);
-void my_bast2(void *data, int blocked_type);
-int test_dlm_thread(void *data);
-atomic_t asts_fired, basts_fired;
-
-typedef union _my_timing_t
-{
-	__u64 q;
-	__u32 lohi[2];
-} my_timing_t;
-
-
-static int test_dlm_poop2(int arg)
-{
-	dlm_ctxt *dlm;
-	int pid1, pid2;
-	poo *poo1, *poo2;
-	my_timing_t t1, t2, t3;
-
-	poo1 = kmalloc(sizeof(poo), GFP_KERNEL);
-testprintk("poo1=%p\n", poo1);	
-	poo2 = kmalloc(sizeof(poo), GFP_KERNEL);
-testprintk("poo2=%p\n", poo2);	
-
-	atomic_set(&finish, 0);
-	atomic_set(&asts_fired, 0);
-	atomic_set(&basts_fired, 0);
-
-	testprintk0("calling dlm_register_domain...\n");
-	dlm = dlm_register_domain("mylittledomain", "grupo2", 0x6543abcd);
-	testprintk("dlm_register_domain returned %p\n", dlm);
-	
-	poo1->dlm = dlm;
-	poo2->dlm = dlm;
-	init_completion(&poo1->complete);
-	init_completion(&poo2->complete);
-
-	rdtsc(t1.lohi[0], t1.lohi[1]);
-	pid1 = kernel_thread (test_dlm_thread, poo1, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
-	if (pid1 < 0) {
-		printk("unable to launch thread, error=%d", pid1);
-		return -EINVAL;
-	}
-	pid2 = kernel_thread (test_dlm_thread, poo2, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
-	if (pid2 < 0) {
-		printk("unable to launch thread, error=%d", pid2);
-		return -EINVAL;
-	}
-	testprintk("dlm threads running for %s...\n", dlm->name);
-	testprintk("poo1->dlm=%p, ->task=%p\n", poo1->dlm, poo1->task);
-	testprintk("poo2->dlm=%p, ->task=%p\n", poo2->dlm, poo2->task);
-	//testprintk("poo1->dlm=%p, ->task=%p\n", poo1->dlm, poo1->task);
-	//testprintk("poo2->dlm=%p, ->task=%p\n", poo2->dlm, poo2->task);
-	//testprintk("sending sigint now...\n");
-	//send_sig (SIGINT, poo1->task, 0);
-	//send_sig (SIGINT, poo2->task, 0);
-	//atomic_set(&finish, 1);
-	while (1) {
-		util_sleep(30000);
-		rdtsc(t3.lohi[0], t3.lohi[1]);
-		testprintk("another 30 sec: asts=%d, basts=%d, diff=%llu\n", 
-			   atomic_read(&asts_fired), atomic_read(&basts_fired), 
-			    t3.q - t1.q);
-		if (atomic_read(&finish)==1) {
-			printk("finish set!\n");
-			break;
-		}
-	}
-	wait_for_completion (&poo1->complete);
-	wait_for_completion (&poo2->complete);
-	rdtsc(t2.lohi[0], t2.lohi[1]);
-	kfree(poo1);
-	kfree(poo2);
-	testprintk("leaving!   asts=%d, basts=%d, diff=%llu\n", atomic_read(&asts_fired), atomic_read(&basts_fired), 
-		    t2.q - t1.q);
-	return 0;
-}
-
-
-int test_dlm_thread(void *data)
-{
-	dlm_status status;
-	int ret;
-	dlm_lockstatus *lksb;
-	poo *mypoo = data;
-	dlm_ctxt *dlm = mypoo->dlm;
-
-	testprintk("mypoo=%p, dlm=%p\n", mypoo, dlm);
-	mypoo->task = current;
-	lksb = kmalloc(sizeof(dlm_lockstatus), GFP_KERNEL);
-	memset(lksb, 0, sizeof(dlm_lockstatus));
-
-	mypoo->lksb = lksb;
-	init_waitqueue_head(&mypoo->wq);
-
-	atomic_set(&mypoo->ast_flag, 0);
-	atomic_set(&mypoo->bast_flag, 0);
-	
-	testprintk("mypoo=%p, dlm=%p, task=%p\n", mypoo, dlm, mypoo->task);
-
-	testprintk("calling dlmlock(%p, %d, %p, 0, \"lock1\", %p, %p, %p) to create the lock...\n",
-		    dlm, LKM_EXMODE, lksb, my_ast2, data, my_bast2);
-	status = dlmlock(dlm, LKM_EXMODE, lksb, 0, "lock1", my_ast2, data, my_bast2);
-	testprintk("dlmlock returned %d.  lksb.status=%d, lock=%p\n", status, lksb->status, lksb->lockid);
-
-again:
-	ret = util_wait_atomic_eq(&mypoo->wq, &mypoo->ast_flag, 1, 0);
-	if (ret < 0) {
-		testprintk("1: waiting on ast converting to EX, ret=%d, type=%d, convtype=%d\n", 
-		       ret, lksb->lockid->type, lksb->lockid->convert_type);
-		if (ret == -EINTR)
-			goto leave;
-		goto again;
-	}
-	atomic_set(&mypoo->ast_flag, 0);
-
-
-
-wait_bast:	
-	ret = util_wait_atomic_eq(&mypoo->wq, &mypoo->bast_flag, 1, 0);
-	if (ret < 0) {
-		testprintk("2: waiting on bast after converting to EX, ret=%d, type=%d, convtype=%d\n", 
-		       ret, lksb->lockid->type, lksb->lockid->convert_type);
-		if (ret == -EINTR)
-			goto leave;
-		goto wait_bast;
-	}
-	atomic_set(&mypoo->bast_flag, 0);
-
-
-
-
-	atomic_set(&mypoo->ast_flag, 0);
-
-	status = dlmlock(dlm, LKM_NLMODE, lksb, LKM_CONVERT, "lock1", my_ast2, data, my_bast2);
-
-wait_ast:
-	ret = util_wait_atomic_eq(&mypoo->wq, &mypoo->ast_flag, 1, 0);
-	if (ret < 0) {
-		testprintk("3: waiting on ast converting to NL, ret=%d, type=%d, convtype=%d\n", 
-		       ret, lksb->lockid->type, lksb->lockid->convert_type);
-		if (ret == -EINTR)
-			goto leave;
-		goto wait_ast;
-	}
-
-	atomic_set(&mypoo->ast_flag, 0);
-	atomic_set(&mypoo->bast_flag, 0);
-
-	status = dlmlock(dlm, LKM_EXMODE, lksb, LKM_CONVERT, "lock1", my_ast2, data, my_bast2);
-
-
-	if (atomic_read(&finish) == 0)
-		goto again;
-leave:
-
-	atomic_set(&finish, 1);
-	kfree(mypoo->lksb);
-	complete (&mypoo->complete);
-	testprintk0("exiting thread\n");
-	return 0;
-}
-
-
-void my_ast2(void *data)
-{
-	poo *mypoo = data;
-//	dlm_lockstatus *l = mypoo->lksb;
-//	dlm_lock *lock = l->lockid;
-//	dlm_lock_resource *res = lock->lockres;
-
-	atomic_inc(&asts_fired);
-	//testprintk("AST!!!:   lockstatus=%p, lock=%p, lockres=%p, lockname=%*s, type=%d\n", 
-	//       l, lock, res, res->lockname.len, res->lockname.name, lock->type);
-	atomic_set(&mypoo->ast_flag, 1);
-	wake_up(&mypoo->wq);
-}
-
-void my_bast2(void *data, int blocked_type)
-{
-	poo *mypoo = data;
-//	dlm_lockstatus *l = mypoo->lksb;
-//	dlm_lock *lock = l->lockid;
-//	dlm_lock_resource *res = lock->lockres;
-
-	atomic_inc(&basts_fired);
-	//testprintk("BAST!!!:   blocked=%d, lockstatus=%p, lock=%p, lockres=%p, lockname=%*s, type=%d\n", 
-	//       blocked_type, l, lock, res, res->lockname.len, res->lockname.name, lock->type);
-	atomic_set(&mypoo->bast_flag, 1);
-	wake_up(&mypoo->wq);
-}
-
-wait_queue_head_t wq3;
-atomic_t ast_flag3, bast_flag3;
-dlm_lockstatus *lksb3;
-
-void my_bast3(void *data, int blocked_type);
-void my_ast3(void *data);
-
-void my_ast3(void *data)
-{
-	dlm_lock *lock = lksb3->lockid;
-	dlm_lock_resource *res = lock->lockres;
-
-	atomic_inc(&asts_fired);
-	testprintk("AST!!!:   lockstatus=%p, lock=%p, lockres=%p, lockname=%*s, type=%d\n", 
-	       lksb3, lock, res, res->lockname.len, res->lockname.name, lock->type);
-	atomic_set(&ast_flag3, 1);
-	wake_up(&wq3);
-}
-
-void my_bast3(void *data, int blocked_type)
-{
-	dlm_lock *lock = lksb3->lockid;
-	dlm_lock_resource *res = lock->lockres;
-
-	atomic_inc(&basts_fired);
-	testprintk("BAST!!!:   blocked=%d, lockstatus=%p, lock=%p, lockres=%p, lockname=%*s, type=%d\n", 
-	       blocked_type, lksb3, lock, res, res->lockname.len, res->lockname.name, lock->type);
-	atomic_set(&bast_flag3, 1);
-	wake_up(&wq3);
-}
-
-static int test_dlm_poop3(int arg)
-{
-	dlm_ctxt *dlm;
-	dlm_status status;
-	int ret, i;
-	my_timing_t t1, t2, t3, t4;
-
-	atomic_set(&finish, 0);
-	atomic_set(&asts_fired, 0);
-	atomic_set(&basts_fired, 0);
-
-	dlm = dlm_register_domain("mylittledomain", "grupo2", 0x6543abcd);
-
-	lksb3 = kmalloc(sizeof(dlm_lockstatus), GFP_KERNEL);
-	memset(lksb3, 0, sizeof(dlm_lockstatus));
-
-	init_waitqueue_head(&wq3);
-
-	atomic_set(&ast_flag3, 0);
-	atomic_set(&bast_flag3, 0);
-
-	i = 0;
-	rdtsc(t1.lohi[0], t1.lohi[1]);
-
-	/* CREATE -> NL */	
-	testprintk0("creating lock\n");
-rdtsc(t3.lohi[0], t3.lohi[1]);
-	status = dlmlock(dlm, LKM_NLMODE, lksb3, 0, "lock1", my_ast3, NULL, my_bast3);
-
-	while (1) {
-		testprintk("%d: waiting on ast\n", i);
-		ret = util_wait_atomic_eq(&wq3, &ast_flag3, 1, 0);
-		if (ret == -EINTR)
-			break;
-rdtsc(t4.lohi[0], t4.lohi[1]);
-testprintk("%d: ->NL took: %llu\n", i, t4.q - t3.q);
-		testprintk("%d: no bast for NL\n", i);
-	
-		atomic_set(&ast_flag3, 0);
-		atomic_set(&bast_flag3, 0);
-
-		if (i == 10) {
-			testprintk("%d: reached 10, goodbye\n", i);
-			break;
-		}
-		dlm_dump_dlm(dlm);
-	
-		/* CONVERT -> EX */	
-		testprintk("%d: converting dlmlock->EX\n", i);
-rdtsc(t3.lohi[0], t3.lohi[1]);
-		status = dlmlock(dlm, LKM_EXMODE, lksb3, LKM_CONVERT, "lock1", my_ast3, NULL, my_bast3);
-
-		testprintk("%d: waiting on ast\n", i);
-		ret = util_wait_atomic_eq(&wq3, &ast_flag3, 1, 0);
-		if (ret == -EINTR)
-			break;
-rdtsc(t4.lohi[0], t4.lohi[1]);
-testprintk("%d: ->EX took: %llu\n", i, t4.q - t3.q);
-		atomic_set(&ast_flag3, 0);	
-	
-		testprintk("%d: waiting on bast\n", i);
-		ret = util_wait_atomic_eq(&wq3, &bast_flag3, 1, 0);
-		if (ret == -EINTR)
-			break;
-		atomic_set(&ast_flag3, 0);
-		atomic_set(&bast_flag3, 0);
-	
-		/* CONVERT -> NL */	
-		testprintk("%d: converting dlmlock->NL\n", i);
-rdtsc(t3.lohi[0], t3.lohi[1]);
-		status = dlmlock(dlm, LKM_NLMODE, lksb3, LKM_CONVERT, "lock1", my_ast3, NULL, my_bast3);
-	
-		/* WAIT ON AST AGAIN */
-		i++;
-	}
-	
-	/* DOWNCONVERT LAST TIME */
-	/* TODO: replace with dlmunlock once implemented */
-	status = dlmlock(dlm, LKM_NLMODE, lksb3, LKM_CONVERT, "lock1", my_ast3, NULL, my_bast3);
-
-	kfree(lksb3);
-
-	rdtsc(t2.lohi[0], t2.lohi[1]);
-	testprintk("leaving!   asts=%d, basts=%d, diff=%llu\n", atomic_read(&asts_fired), atomic_read(&basts_fired), 
-		    t2.q - t1.q);
-	return 0;
-}
-
-
-static int test_dlm_register(int arg)
-{
-	dlm_ctxt *dlm;
-
-	testprintk0("calling dlm_register_domain...\n");
-	dlm = dlm_register_domain("mylittledomain", "grupo2", 0x6543abcd);
-	testprintk("dlm_register_domain returned %p\n", dlm);
-
-	the_dlm = dlm;	
-	testprintk0("leaving!\n");
-	return 0;
-}
-
-
-
-
-/*
- * module stuff
- */
-
-
-static ssize_t write_net_register(struct file *file, char *buf, size_t size)
-{
-	int arg = 0, tmpret, ret;
-       	if (size > 0)
-		arg = simple_strtoul(buf, NULL, 0);
-	printk("calling test_net_register(%d)\n", arg);
-	tmpret = test_net_register(arg);
-	ret = sprintf(buf, "test_net_register(%d) returned: %d\n", arg, tmpret);
-	return ret;
-}
-static ssize_t write_net_send(struct file *file, char *buf, size_t size)
-{
-	int arg = 0, tmpret, ret;
-       	if (size > 0)
-		arg = simple_strtoul(buf, NULL, 0);
-	printk("calling test_net_send(%d)\n", arg);
-	tmpret = test_net_send(arg);
-	ret = sprintf(buf, "test_net_send(%d) returned: %d\n", arg, tmpret);
-	return ret;
-}
-static ssize_t write_net_get_num(struct file *file, char *buf, size_t size)
-{
-	int arg = 0, tmpret, ret;
-       	if (size > 0)
-		arg = simple_strtoul(buf, NULL, 0);
-	printk("calling test_net_get_num(%d)\n", arg);
-	tmpret = test_net_get_num(arg);
-	ret = sprintf(buf, "test_net_get_num(%d) returned: %d\n", arg, tmpret);
-	return ret;
-}
-static ssize_t write_dlm_poop(struct file *file, char *buf, size_t size)
-{
-	int arg = 0, tmpret, ret;
-       	if (size > 0)
-		arg = simple_strtoul(buf, NULL, 0);
-	printk("calling test_dlm_poop(%d)\n", arg);
-	tmpret = test_dlm_poop(arg);
-	ret = sprintf(buf, "test_dlm_poop(%d) returned: %d\n", arg, tmpret);
-	return ret;
-}
-static ssize_t write_dlm_poop2(struct file *file, char *buf, size_t size)
-{
-	int arg = 0, tmpret, ret;
-       	if (size > 0)
-		arg = simple_strtoul(buf, NULL, 0);
-	printk("calling test_dlm_poop2(%d)\n", arg);
-	tmpret = test_dlm_poop2(arg);
-	ret = sprintf(buf, "test_dlm_poop2(%d) returned: %d\n", arg, tmpret);
-	return ret;
-}
-static ssize_t write_dlm_poop3(struct file *file, char *buf, size_t size)
-{
-	int arg = 0, tmpret, ret;
-       	if (size > 0)
-		arg = simple_strtoul(buf, NULL, 0);
-	printk("calling test_dlm_poop3(%d)\n", arg);
-	tmpret = test_dlm_poop3(arg);
-	ret = sprintf(buf, "test_dlm_poop3(%d) returned: %d\n", arg, tmpret);
-	return ret;
-}
-
-static ssize_t write_dlm_register(struct file *file, char *buf, size_t size)
-{
-	int arg = 0, tmpret, ret;
-       	if (size > 0)
-		arg = simple_strtoul(buf, NULL, 0);
-	printk("calling test_dlm_register(%d)\n", arg);
-	tmpret = test_dlm_register(arg);
-	ret = sprintf(buf, "test_dlm_register(%d) returned: %d\n", arg, tmpret);
-	return ret;
-}
-
-
-
-
-
-/*----------------------------------------------------------------------------*/
-/*
- *	populating the filesystem.
- */
-static int test_fill_super(struct super_block * sb, void * data, int silent)
-{	
-	int ret, sz;
-	TA_write_ops *ops;
-	static struct tree_descr test_files[] = {
-		[TEST_NetRegister] = {"net-register", &transaction_ops, S_IWUSR},
-		[TEST_NetSend] = {"net-send", &transaction_ops, S_IWUSR},
-		[TEST_NetGetNum] = {"net-get-num", &transaction_ops, S_IWUSR},
-		[TEST_DLMPoop] = {"dlm-poop", &transaction_ops, S_IWUSR},
-		[TEST_DLMPoop2] = {"dlm-poop2", &transaction_ops, S_IWUSR},
-		[TEST_DLMPoop3] = {"dlm-poop3", &transaction_ops, S_IWUSR},
-		[TEST_DLMRegister] = {"dlm-register", &transaction_ops, S_IWUSR},
-		/* last one */ {""}
-	};
-	
-	sz = sizeof(test_files) / sizeof(struct tree_descr);
-	ops = kmalloc(sizeof(TA_write_ops) + (sz * sizeof(TA_write_op *)), GFP_KERNEL);
-	if (!ops)
-		return -ENOMEM;
-
-	memset(ops, 0, sizeof(TA_write_ops) + (sz * sizeof(TA_write_op *)));
-	ops->num_ops = sz;
-	ops->write_op[TEST_NetRegister] = write_net_register;
-	ops->write_op[TEST_NetSend] = write_net_send;
-	ops->write_op[TEST_NetGetNum] = write_net_get_num;
-	ops->write_op[TEST_DLMPoop] = write_dlm_poop;
-	ops->write_op[TEST_DLMPoop2] = write_dlm_poop2;
-	ops->write_op[TEST_DLMPoop3] = write_dlm_poop3;
-	ops->write_op[TEST_DLMRegister] = write_dlm_register;
-
-	printk("calling simple_fill_super...\n");
-	ret = simple_fill_super(sb, 0x12beAf00L, test_files);
-	if (ret >= 0) {
-		TA_GENERIC_SB_MEMBER(sb) = ops;
-	} else {
-		kfree(ops);
-	}
-	return ret;
-}
-
-/* blindly copied from ocfs2 */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-static struct super_block *test_get_sb(struct file_system_type *fs_type,
-				     int flags,
-				     const char *dev_name,
-				     void *data)
-{
-	return get_sb_bdev(fs_type, flags, data, test_fill_super);
-}
-
-static struct file_system_type test_fs_type = {
-	.owner          = THIS_MODULE,
-	.name           = "test",
-	.get_sb         = test_get_sb,
-	.kill_sb        = kill_anon_super,
-};
-#else
-static struct super_block *test_read_super(struct super_block *sb,
-					   void *data,
-					   int silent)
-{
-	printk("welcome to test_read_super!!!\n");
-	return (test_fill_super(sb, data, silent) < 0) ? NULL : sb;
-}
-
-static DECLARE_FSTYPE (test_fs_type, "test", test_read_super, FS_SINGLE|FS_LITTER);
-#endif
-
-static int __init init_test(void)
-{
-	int retval;
-	void *ret;
-
-	printk("loading test module: nodename is %s\n", nm_nodename);
-
-	ret = proc_mkdir("cluster/test", 0);
-	printk("proc_mkdir of cluster/test returned %p\n", ret);
-
-	printk("calling register_filesystem\n");
-	retval = register_filesystem(&test_fs_type);
-	printk("done calling register_filesystem: ret=%d\n", retval);
-	if (retval) {
-		printk("oopsy that did not work\n");
-		test_teardown();
-	} else
-		printk("woot.  good to go.\n");
-	return retval;
-}
-
-static void __exit exit_test(void)
-{
-	test_teardown();
-	unregister_filesystem(&test_fs_type);
-	printk("unloading test module\n");
-}
-
-static void test_teardown(void)
-{
-	printk("removing cluster/test\n");
-	remove_proc_entry("cluster/test", NULL);
-}
-
-
-
-
-
-MODULE_LICENSE("GPL");
-module_init(init_test)
-module_exit(exit_test)



More information about the Ocfs2-commits mailing list