[Pvfs2-cvs] commit by aching in pvfs2-1/test/client/sysint: getattr-test-threaded.c io-test-threaded.c client.c create-with-dist.c create.c create.set.get.eattr.c flush-1.c flush-2.c initialize-dyn.c io-bug.c io-hole.c io-stress.c io-test-offset.c io-test.c module.mk.in test-accesses.c test-create-scale.c test-hindexed-test.c test-pint-bucket.c acache-torture.c

CVS commit program cvs at parl.clemson.edu
Mon Jul 21 14:22:33 EDT 2008


Update of /projects/cvsroot/pvfs2-1/test/client/sysint
In directory parlweb1:/tmp/cvs-serv20547/test/client/sysint

Modified Files:
      Tag: locking-branch
	client.c create-with-dist.c create.c create.set.get.eattr.c 
	flush-1.c flush-2.c initialize-dyn.c io-bug.c io-hole.c 
	io-stress.c io-test-offset.c io-test.c module.mk.in 
	test-accesses.c test-create-scale.c test-hindexed-test.c 
	test-pint-bucket.c 
Added Files:
      Tag: locking-branch
	getattr-test-threaded.c io-test-threaded.c 
Removed Files:
      Tag: locking-branch
	acache-torture.c 
Log Message:

Reverse merged and ported to HEAD.


--- /dev/null	2004-06-24 14:04:38.000000000 -0400
+++ getattr-test-threaded.c	2008-07-21 14:22:32.000000000 -0400
@@ -0,0 +1,282 @@
+/*
+ * (C) 2001 Clemson University and The University of Chicago
+ *
+ * See COPYING in top-level directory.
+ */
+
+/* based off of io-test.c.  This is meant to exercise a bug found by Florin
+ * Isaila in which two concurrent threads running sys_io() will deadlock on a
+ * configuration struct lock ordering problem.
+ */
+
+#include <pthread.h>
+#include <time.h>
+#include "client.h"
+#include <sys/time.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include "pvfs2-util.h"
+#include "pvfs2-mgmt.h"
+#include "pvfs2-internal.h"
+
+struct thread_info
+{
+    PVFS_object_ref* pinode_refn;
+    PVFS_object_ref* pinode_refn2;
+    PVFS_credentials* credentials;
+};
+
+void* thread_fn(void* foo);
+pthread_mutex_t error_count_mutex = PTHREAD_MUTEX_INITIALIZER;
+int error_count = 0;
+
+int main(int argc, char **argv)
+{
+    PVFS_sysresp_lookup resp_lk;
+    PVFS_sysresp_create resp_cr;
+    int ret = -1;
+    int i;
+    PVFS_fs_id fs_id;
+    char name[512] = {0};
+    char *entry_name = NULL;
+    PVFS_credentials credentials;
+    PVFS_object_ref parent_refn;
+    PVFS_sys_attr attr;
+    PVFS_object_ref pinode_refn;
+    PVFS_object_ref pinode_refn2;
+    struct thread_info info;
+    pthread_t* thread_id_array;
+    int num_threads = 1;
+
+    if (argc != 4)
+    {
+	fprintf(stderr, "Usage: %s <num threads> <file name 1> <file name 2>\n", argv[0]);
+	return (-1);
+    }
+
+    if(sscanf(argv[1], "%d", &num_threads) != 1)
+    {
+	fprintf(stderr, "Usage: %s <num threads> <file name>\n", argv[0]);
+	return (-1);
+    }
+
+    thread_id_array = malloc(num_threads* sizeof(pthread_t));
+    if(!thread_id_array)
+    {
+        perror("malloc");
+        return(-1);
+    }
+
+    ret = PVFS_util_init_defaults();
+    if (ret < 0)
+    {
+	PVFS_perror("PVFS_util_init_defaults", ret);
+	return (-1);
+    }
+    ret = PVFS_util_get_default_fsid(&fs_id);
+    if (ret < 0)
+    {
+	PVFS_perror("PVFS_util_get_default_fsid", ret);
+	return (-1);
+    }
+
+    /* FIRST FILE */
+    if (argv[2][0] == '/')
+    {
+        snprintf(name, 512, "%s", argv[2]);
+    }
+    else
+    {
+        snprintf(name, 512, "/%s", argv[2]);
+    }
+
+    PVFS_util_gen_credentials(&credentials);
+    ret = PVFS_sys_lookup(fs_id, name, &credentials,
+			  &resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
+    if (ret == -PVFS_ENOENT)
+    {
+        PVFS_sysresp_getparent gp_resp;
+
+        memset(&gp_resp, 0, sizeof(PVFS_sysresp_getparent));
+	ret = PVFS_sys_getparent(fs_id, name, &credentials, &gp_resp);
+	if (ret < 0)
+	{
+            PVFS_perror("PVFS_sys_getparent failed", ret);
+	    return ret;
+	}
+
+	attr.owner = credentials.uid;
+	attr.group = credentials.gid;
+	attr.perms = PVFS_U_WRITE | PVFS_U_READ;
+	attr.atime = attr.ctime = attr.mtime = time(NULL);
+	attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
+	parent_refn = gp_resp.parent_ref;
+
+        entry_name = rindex(name, (int)'/');
+        assert(entry_name);
+        entry_name++;
+        assert(entry_name);
+
+	ret = PVFS_sys_create(entry_name, parent_refn, attr,
+			      &credentials, NULL, NULL, &resp_cr);
+	if (ret < 0)
+	{
+	    PVFS_perror("PVFS_sys_create() failure", ret);
+	    return (-1);
+	}
+
+	pinode_refn.fs_id = fs_id;
+	pinode_refn.handle = resp_cr.ref.handle;
+    }
+    else
+    {
+	pinode_refn.fs_id = fs_id;
+	pinode_refn.handle = resp_lk.ref.handle;
+    }
+
+    /* SECOND FILE */
+    if (argv[3][0] == '/')
+    {
+        snprintf(name, 512, "%s", argv[3]);
+    }
+    else
+    {
+        snprintf(name, 512, "/%s", argv[3]);
+    }
+
+    PVFS_util_gen_credentials(&credentials);
+    ret = PVFS_sys_lookup(fs_id, name, &credentials,
+			  &resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
+    if (ret == -PVFS_ENOENT)
+    {
+        PVFS_sysresp_getparent gp_resp;
+
+        memset(&gp_resp, 0, sizeof(PVFS_sysresp_getparent));
+	ret = PVFS_sys_getparent(fs_id, name, &credentials, &gp_resp);
+	if (ret < 0)
+	{
+            PVFS_perror("PVFS_sys_getparent failed", ret);
+	    return ret;
+	}
+
+	attr.owner = credentials.uid;
+	attr.group = credentials.gid;
+	attr.perms = PVFS_U_WRITE | PVFS_U_READ;
+	attr.atime = attr.ctime = attr.mtime = time(NULL);
+	attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
+	parent_refn = gp_resp.parent_ref;
+
+        entry_name = rindex(name, (int)'/');
+        assert(entry_name);
+        entry_name++;
+        assert(entry_name);
+
+	ret = PVFS_sys_create(entry_name, parent_refn, attr,
+			      &credentials, NULL, NULL, &resp_cr);
+	if (ret < 0)
+	{
+	    PVFS_perror("PVFS_sys_create() failure", ret);
+	    return (-1);
+	}
+
+	pinode_refn2.fs_id = fs_id;
+	pinode_refn2.handle = resp_cr.ref.handle;
+    }
+    else
+    {
+	pinode_refn2.fs_id = fs_id;
+	pinode_refn2.handle = resp_lk.ref.handle;
+    }
+
+
+    /* fill in information for threads */
+    info.pinode_refn = &pinode_refn;
+    info.pinode_refn2 = &pinode_refn2;
+    info.credentials = &credentials;
+
+    /* launch threads then wait for them to finish */
+    for(i=0; i<num_threads; i++)
+    {
+        ret = pthread_create(&thread_id_array[i], NULL, thread_fn, &info);
+        assert(ret == 0);
+    }
+
+    for(i=0; i<num_threads; i++)
+    {
+        pthread_join(thread_id_array[i], NULL);
+    }
+
+	/**************************************************************
+	 * shut down pending interfaces
+	 */
+
+    ret = PVFS_sys_finalize();
+    if (ret < 0)
+    {
+	fprintf(stderr, "Error: PVFS_sys_finalize() failed with errcode = %d\n",
+		ret);
+	return (-1);
+    }
+
+    pthread_mutex_lock(&error_count_mutex);
+    if(error_count != 0)
+    {
+        fprintf(stderr, "Error: %d threads had problems\n", error_count);
+        ret = -1;
+    }
+    else
+    {
+        ret = 0;
+    }
+    pthread_mutex_unlock(&error_count_mutex);
+
+    free(thread_id_array);
+
+    return (ret);
+}
+
+void* thread_fn(void* foo)
+{
+    PVFS_sysresp_getattr resp_getattr;
+    int ret = 0;
+    int i = 0;
+    struct thread_info* info = foo;
+
+    for(i=0; i<1000; i++)
+    {
+        ret = PVFS_sys_getattr(*info->pinode_refn, PVFS_ATTR_SYS_ALL,
+            info->credentials, &resp_getattr);
+        if (ret < 0)
+        {
+            PVFS_perror("PVFS_sys_getattr failure", ret);
+            pthread_mutex_lock(&error_count_mutex);
+            error_count++;
+            pthread_mutex_unlock(&error_count_mutex);
+            return (NULL);
+        }
+        ret = PVFS_sys_getattr(*info->pinode_refn2, PVFS_ATTR_SYS_ALL,
+            info->credentials, &resp_getattr);
+        if (ret < 0)
+        {
+            PVFS_perror("PVFS_sys_getattr failure", ret);
+            pthread_mutex_lock(&error_count_mutex);
+            error_count++;
+            pthread_mutex_unlock(&error_count_mutex);
+            return (NULL);
+        }
+    }
+
+    return(NULL);
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */

--- /dev/null	2004-06-24 14:04:38.000000000 -0400
+++ io-test-threaded.c	2008-07-21 14:22:33.000000000 -0400
@@ -0,0 +1,317 @@
+/*
+ * (C) 2001 Clemson University and The University of Chicago
+ *
+ * See COPYING in top-level directory.
+ */
+
+/* based off of io-test.c.  This is meant to exercise a bug found by Florin
+ * Isaila in which two concurrent threads running sys_io() will deadlock on a
+ * configuration struct lock ordering problem.
+ */
+
+#include <pthread.h>
+#include <time.h>
+#include "client.h"
+#include <sys/time.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include "pvfs2-util.h"
+#include "pvfs2-mgmt.h"
+#include "pvfs2-internal.h"
+
+/* NOTE: this is not in bytes, but rather a number of ints to read and write */
+#define DEFAULT_IO_SIZE 8*1024*1024
+
+struct thread_info
+{
+    PVFS_object_ref* pinode_refn;
+    PVFS_Request* file_req;
+    PVFS_Request* mem_req;
+    PVFS_credentials* credentials;
+};
+
+void* thread_fn(void* foo);
+pthread_mutex_t error_count_mutex = PTHREAD_MUTEX_INITIALIZER;
+int error_count = 0;
+
+int main(int argc, char **argv)
+{
+    PVFS_sysresp_lookup resp_lk;
+    PVFS_sysresp_create resp_cr;
+    PVFS_sysresp_io resp_io;
+    char *filename = NULL;
+    int ret = -1, io_size = DEFAULT_IO_SIZE;
+    int *io_buffer = NULL;
+    int i, buffer_size;
+    PVFS_fs_id fs_id;
+    char name[512] = {0};
+    char *entry_name = NULL;
+    PVFS_credentials credentials;
+    PVFS_object_ref parent_refn;
+    PVFS_sys_attr attr;
+    PVFS_object_ref pinode_refn;
+    PVFS_Request file_req;
+    PVFS_Request mem_req;
+    void *buffer = NULL;
+    struct thread_info info;
+    pthread_t* thread_id_array;
+    int num_threads = 1;
+
+    if (argc != 3)
+    {
+	fprintf(stderr, "Usage: %s <num threads> <file name>\n", argv[0]);
+	return (-1);
+    }
+
+    if(sscanf(argv[1], "%d", &num_threads) != 1)
+    {
+	fprintf(stderr, "Usage: %s <num threads> <file name>\n", argv[0]);
+	return (-1);
+    }
+
+    thread_id_array = malloc(num_threads* sizeof(pthread_t));
+    if(!thread_id_array)
+    {
+        perror("malloc");
+        return(-1);
+    }
+
+    /* create a buffer for running I/O on */
+    io_buffer = (int *) malloc(io_size * sizeof(int));
+    if (!io_buffer)
+    {
+	return (-1);
+    }
+
+    /* put some data in the buffer so we can verify */
+    for (i = 0; i < io_size; i++)
+    {
+	io_buffer[i] = i;
+    }
+
+    ret = PVFS_util_init_defaults();
+    if (ret < 0)
+    {
+	PVFS_perror("PVFS_util_init_defaults", ret);
+	return (-1);
+    }
+    ret = PVFS_util_get_default_fsid(&fs_id);
+    if (ret < 0)
+    {
+	PVFS_perror("PVFS_util_get_default_fsid", ret);
+	return (-1);
+    }
+
+    if (argv[2][0] == '/')
+    {
+        snprintf(name, 512, "%s", argv[2]);
+    }
+    else
+    {
+        snprintf(name, 512, "/%s", argv[2]);
+    }
+
+    PVFS_util_gen_credentials(&credentials);
+    ret = PVFS_sys_lookup(fs_id, name, &credentials,
+			  &resp_lk, PVFS2_LOOKUP_LINK_FOLLOW);
+    if (ret == -PVFS_ENOENT)
+    {
+        PVFS_sysresp_getparent gp_resp;
+
+        memset(&gp_resp, 0, sizeof(PVFS_sysresp_getparent));
+	ret = PVFS_sys_getparent(fs_id, name, &credentials, &gp_resp);
+	if (ret < 0)
+	{
+            PVFS_perror("PVFS_sys_getparent failed", ret);
+	    return ret;
+	}
+
+	attr.owner = credentials.uid;
+	attr.group = credentials.gid;
+	attr.perms = PVFS_U_WRITE | PVFS_U_READ;
+	attr.atime = attr.ctime = attr.mtime = time(NULL);
+	attr.mask = PVFS_ATTR_SYS_ALL_SETABLE;
+	parent_refn = gp_resp.parent_ref;
+
+        entry_name = rindex(name, (int)'/');
+        assert(entry_name);
+        entry_name++;
+        assert(entry_name);
+
+	ret = PVFS_sys_create(entry_name, parent_refn, attr,
+			      &credentials, NULL, NULL, &resp_cr);
+	if (ret < 0)
+	{
+	    PVFS_perror("PVFS_sys_create() failure", ret);
+	    return (-1);
+	}
+
+	pinode_refn.fs_id = fs_id;
+	pinode_refn.handle = resp_cr.ref.handle;
+    }
+    else
+    {
+	pinode_refn.fs_id = fs_id;
+	pinode_refn.handle = resp_lk.ref.handle;
+    }
+
+	/**************************************************************
+	 * carry out I/O operation
+	 */
+
+    buffer = io_buffer;
+    buffer_size = io_size * sizeof(int);
+
+    /*
+      file datatype is tiled, so we can get away with a trivial type
+      here
+    */
+    file_req = PVFS_BYTE;
+
+    ret = PVFS_Request_contiguous(io_size * sizeof(int),
+                                  PVFS_BYTE, &(mem_req));
+    if (ret < 0)
+    {
+        PVFS_perror("PVFS_request_contiguous failure", ret);
+	return (-1);
+    }
+
+    ret = PVFS_sys_write(pinode_refn, file_req, 0, buffer, mem_req,
+			 &credentials, &resp_io);
+    if (ret < 0)
+    {
+        PVFS_perror("PVFS_sys_write failure", ret);
+	return (-1);
+    }
+
+    /* fill in information for threads */
+    info.pinode_refn = &pinode_refn;
+    info.file_req = &file_req;
+    info.mem_req = &mem_req;
+    info.credentials = &credentials;
+
+    /* launch threads then wait for them to finish */
+    for(i=0; i<num_threads; i++)
+    {
+        ret = pthread_create(&thread_id_array[i], NULL, thread_fn, &info);
+        assert(ret == 0);
+    }
+
+    for(i=0; i<num_threads; i++)
+    {
+        pthread_join(thread_id_array[i], NULL);
+    }
+
+	/**************************************************************
+	 * shut down pending interfaces
+	 */
+
+    ret = PVFS_sys_finalize();
+    if (ret < 0)
+    {
+	fprintf(stderr, "Error: PVFS_sys_finalize() failed with errcode = %d\n",
+		ret);
+	return (-1);
+    }
+
+    free(filename);
+    free(io_buffer);
+
+    pthread_mutex_lock(&error_count_mutex);
+    if(error_count != 0)
+    {
+        fprintf(stderr, "Error: %d threads had problems\n", error_count);
+        ret = -1;
+    }
+    else
+    {
+        ret = 0;
+    }
+    pthread_mutex_unlock(&error_count_mutex);
+
+    free(thread_id_array);
+
+    return (ret);
+}
+
+void* thread_fn(void* foo)
+{
+    int io_size = DEFAULT_IO_SIZE;
+    int *io_buffer = NULL;
+    PVFS_sysresp_io resp_io;
+    int ret = 0;
+    int errors = 0;
+    int i = 0;
+    struct thread_info* info = foo;
+
+    /* create a buffer for running I/O on */
+    io_buffer = (int *) malloc(io_size * sizeof(int));
+    if (!io_buffer)
+    {
+        perror("malloc");
+        pthread_mutex_lock(&error_count_mutex);
+        error_count++;
+        pthread_mutex_unlock(&error_count_mutex);
+	return (NULL);
+    }
+
+    memset(io_buffer, 0, io_size * sizeof(int));
+
+    /* verify */
+    ret = PVFS_sys_read(*info->pinode_refn, *info->file_req, 0, io_buffer, *info->mem_req,
+			info->credentials, &resp_io);
+    if (ret < 0)
+    {
+        PVFS_perror("PVFS_sys_read failure", ret);
+        pthread_mutex_lock(&error_count_mutex);
+        error_count++;
+        pthread_mutex_unlock(&error_count_mutex);
+	return (NULL);
+    }
+    if ((io_size * sizeof(int)) != resp_io.total_completed)
+    {
+	fprintf(stderr, "Error: SHORT READ!\n");
+        pthread_mutex_lock(&error_count_mutex);
+        error_count++;
+        pthread_mutex_unlock(&error_count_mutex);
+        return(NULL);
+    }
+    else
+    {
+	errors = 0;
+	for (i = 0; i < io_size; i++)
+	{
+	    if (i != io_buffer[i])
+	    {
+		fprintf(stderr,
+			"error: element %d differs: should be %d, is %d\n", i,
+			i, io_buffer[i]);
+		errors++;
+	    }
+	}
+	if (errors != 0)
+	{
+	    fprintf(stderr, "ERROR: found %d errors\n", errors);
+            pthread_mutex_lock(&error_count_mutex);
+            error_count++;
+            pthread_mutex_unlock(&error_count_mutex);
+            return(NULL);
+	}
+    }
+
+    free(io_buffer);
+
+    return(NULL);
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */

Index: client.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/client.c,v
diff -p -u -r1.47 -r1.47.60.1
--- client.c	28 Jul 2004 14:32:58 -0000	1.47
+++ client.c	21 Jul 2008 18:22:32 -0000	1.47.60.1
@@ -122,7 +122,7 @@ int main(
 
     // call create 
     ret = PVFS_sys_create(entry_name, parent_refn, attr,
-			  &credentials, NULL, resp_create);
+			  &credentials, NULL, NULL, resp_create);
     if (ret < 0)
     {
 	printf("create failed with errcode = %d\n", ret);

Index: create-with-dist.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/create-with-dist.c,v
diff -p -u -r1.7 -r1.7.40.1
--- create-with-dist.c	11 Nov 2005 21:31:12 -0000	1.7
+++ create-with-dist.c	21 Jul 2008 18:22:32 -0000	1.7.40.1
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
     /*printf("strip size: %i\n",
       ((PVFS_simple_stripe_params*)dist->params)->strip_size);*/
     ret = PVFS_sys_create(entry_name, parent_refn, attr,
-                          &credentials, dist, &resp_create);
+                          &credentials, dist, NULL, &resp_create);
     if (ret < 0)
     {
         PVFS_perror("create failed with errcode", ret);

Index: create.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/create.c,v
diff -p -u -r1.42 -r1.42.40.1
--- create.c	11 Nov 2005 21:31:12 -0000	1.42
+++ create.c	21 Jul 2008 18:22:32 -0000	1.42.40.1
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
            str_buf, llu(parent_refn.handle));
 
     ret = PVFS_sys_create(entry_name, parent_refn, attr,
-                          &credentials, NULL, &resp_create);
+                          &credentials, NULL, NULL, &resp_create);
     if (ret < 0)
     {
         PVFS_perror("create failed with errcode", ret);

Index: create.set.get.eattr.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/create.set.get.eattr.c,v
diff -p -u -r1.5 -r1.5.42.1
--- create.set.get.eattr.c	11 Nov 2005 21:31:12 -0000	1.5
+++ create.set.get.eattr.c	21 Jul 2008 18:22:32 -0000	1.5.42.1
@@ -89,7 +89,7 @@ int main(int argc, char **argv)
            str_buf, llu(parent_refn.handle));
 
     ret = PVFS_sys_create(entry_name, parent_refn, attr,
-                          &credentials, NULL, &resp_create);
+                          &credentials, NULL, NULL, &resp_create);
     if (ret < 0)
     {
         PVFS_perror("create failed with errcode", ret);

Index: flush-1.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/flush-1.c,v
diff -p -u -r1.16 -r1.16.40.1
--- flush-1.c	11 Nov 2005 21:31:12 -0000	1.16
+++ flush-1.c	21 Jul 2008 18:22:32 -0000	1.16.40.1
@@ -80,7 +80,7 @@ int main(int argc, char **argv)
     parent_refn.fs_id = cur_fs;
 
     ret = PVFS_sys_create(entry_name, parent_refn, attr,
-                          &credentials, NULL, &resp_create);
+                          &credentials, NULL, NULL, &resp_create);
     if (ret < 0)
     {
         printf("create failed with errcode = %d\n", ret);

Index: flush-2.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/flush-2.c,v
diff -p -u -r1.20 -r1.20.60.1
--- flush-2.c	28 Jul 2004 14:32:58 -0000	1.20
+++ flush-2.c	21 Jul 2008 18:22:32 -0000	1.20.60.1
@@ -130,7 +130,7 @@ int main(
 	entry_name = &(filename[1]);	/* leave off slash */
 
 	ret = PVFS_sys_create(entry_name, parent_refn, attr,
-			      &credentials, NULL, &resp_cr);
+			      &credentials, NULL, NULL, &resp_cr);
 	if (ret < 0)
 	{
 	    fprintf(stderr, "Error: PVFS_sys_create() failure.\n");

Index: initialize-dyn.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/initialize-dyn.c,v
diff -p -u -r1.8 -r1.8.60.1
--- initialize-dyn.c	11 Oct 2004 16:37:01 -0000	1.8
+++ initialize-dyn.c	21 Jul 2008 18:22:32 -0000	1.8.60.1
@@ -11,8 +11,6 @@
 #include "client.h"
 #include "pvfs2-util.h"
 
-#define MAX_NUM_MNT  3
-
 int main(int argc, char **argv)
 {
     int ret = -1;
@@ -61,7 +59,7 @@ int main(int argc, char **argv)
     printf("*** All defaults initialized\n");
 
     /* make sure we can resolve all mnt points */
-    for(i = 0; i < MAX_NUM_MNT; i++)
+    for(i = 0; i < tab->mntent_count; i++)
     {
         ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id,
                                 buf, PVFS_NAME_MAX);
@@ -80,7 +78,7 @@ int main(int argc, char **argv)
     }
 
     /* remove the mount points */
-    for(i = 0; i < MAX_NUM_MNT; i++)
+    for(i = 0; i < tab->mntent_count; i++)
     {
         printf("Removing mount entry %d: %s\n",
                i, mntent[i].mnt_dir);
@@ -94,7 +92,7 @@ int main(int argc, char **argv)
     }
 
     /* make sure we *can't* resolve all mnt points */
-    for(i = 0; i < MAX_NUM_MNT; i++)
+    for(i = 0; i < tab->mntent_count; i++)
     {
         ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id,
                                 buf, PVFS_NAME_MAX);
@@ -112,7 +110,7 @@ int main(int argc, char **argv)
     }
 
     /* re-add the mount points */
-    for(i = 0; i < MAX_NUM_MNT; i++)
+    for(i = 0; i < tab->mntent_count; i++)
     {
         printf("Adding dynamic mount entry %d: %s\n",
                i, mntent[i].mnt_dir);
@@ -129,7 +127,7 @@ int main(int argc, char **argv)
       make sure we can re-resolve all mnt points now that they've been
       moved to the dynamic area of the book keeping
     */
-    for(i = 0; i < MAX_NUM_MNT; i++)
+    for(i = 0; i < tab->mntent_count; i++)
     {
         ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id,
                                 buf, PVFS_NAME_MAX);
@@ -148,7 +146,7 @@ int main(int argc, char **argv)
     }
 
     /* remove the dynamic mount points */
-    for(i = 0; i < MAX_NUM_MNT; i++)
+    for(i = 0; i < tab->mntent_count; i++)
     {
         printf("Removing dynamic mount entry %d: %s\n",
                i, mntent[i].mnt_dir);
@@ -162,7 +160,7 @@ int main(int argc, char **argv)
     }
 
     /* make sure we *can't* resolve all mnt points */
-    for(i = 0; i < MAX_NUM_MNT; i++)
+    for(i = 0; i < tab->mntent_count; i++)
     {
         ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id,
                                 buf, PVFS_NAME_MAX);
@@ -180,7 +178,7 @@ int main(int argc, char **argv)
     }
 
     /* re-add the mount points */
-    for(i = 0; i < MAX_NUM_MNT; i++)
+    for(i = 0; i < tab->mntent_count; i++)
     {
         printf("Adding dynamic mount entry %d: %s\n",
                i, mntent[i].mnt_dir);
@@ -194,7 +192,7 @@ int main(int argc, char **argv)
     }
 
     /* re-resolve one more time -- to be sure ;-) */
-    for(i = 0; i < MAX_NUM_MNT; i++)
+    for(i = 0; i < tab->mntent_count; i++)
     {
         ret = PVFS_util_resolve(mntent[i].mnt_dir, &fs_id,
                                 buf, PVFS_NAME_MAX);

Index: io-bug.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/io-bug.c,v
diff -p -u -r1.7 -r1.7.34.1
--- io-bug.c	6 Apr 2006 20:46:42 -0000	1.7
+++ io-bug.c	21 Jul 2008 18:22:32 -0000	1.7.34.1
@@ -136,7 +136,7 @@ int main(
 	entry_name = &(filename[1]);	/* leave off slash */
 
 	ret = PVFS_sys_create(entry_name, parent_refn, attr,
-			      &credentials, NULL, &resp_cr);
+			      &credentials, NULL, NULL, &resp_cr);
 	if (ret < 0)
 	{
 	    fprintf(stderr, "Error: PVFS_sys_create() failure.\n");

Index: io-hole.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/io-hole.c,v
diff -p -u -r1.3 -r1.3.40.1
--- io-hole.c	11 Nov 2005 21:31:12 -0000	1.3
+++ io-hole.c	21 Jul 2008 18:22:32 -0000	1.3.40.1
@@ -93,7 +93,7 @@ int main(int argc, char **argv)
         assert(entry_name);
 
 	ret = PVFS_sys_create(entry_name, parent_refn, attr,
-			      &credentials, NULL, &resp_cr);
+			      &credentials, NULL, NULL, &resp_cr);
 	if (ret < 0)
 	{
 	    PVFS_perror("PVFS_sys_create() failure", ret);

Index: io-stress.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/io-stress.c,v
diff -p -u -r1.2 -r1.2.22.1
--- io-stress.c	18 Aug 2006 15:19:36 -0000	1.2
+++ io-stress.c	21 Jul 2008 18:22:32 -0000	1.2.22.1
@@ -230,7 +230,7 @@ static void do_pvfs_io(int num_io)
         memset(error_code_array, 0, MAX_OPS * sizeof(int));
         memset(all_request, 0, MAX_OPS * sizeof(io_request *));
         ret = PVFS_sys_testsome(
-                op_id_array, &op_count, (void **) all_request,
+                op_id_array, &op_count, (void *) all_request,
                 error_code_array, 10);
         for (i = 0; i < op_count; i++)
         {

Index: io-test-offset.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/io-test-offset.c,v
diff -p -u -r1.25 -r1.25.60.1
--- io-test-offset.c	28 Jul 2004 14:32:58 -0000	1.25
+++ io-test-offset.c	21 Jul 2008 18:22:32 -0000	1.25.60.1
@@ -136,7 +136,7 @@ int main(
 	entry_name = &(filename[1]);	/* leave off slash */
 
 	ret = PVFS_sys_create(entry_name, parent_refn, attr,
-			      &credentials, NULL, &resp_cr);
+			      &credentials, NULL, NULL, &resp_cr);
 	if (ret < 0)
 	{
 	    fprintf(stderr, "Error: PVFS_sys_create() failure.\n");

Index: io-test.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/io-test.c,v
diff -p -u -r1.56 -r1.56.40.1
--- io-test.c	11 Nov 2005 21:31:12 -0000	1.56
+++ io-test.c	21 Jul 2008 18:22:32 -0000	1.56.40.1
@@ -111,7 +111,7 @@ int main(int argc, char **argv)
         assert(entry_name);
 
 	ret = PVFS_sys_create(entry_name, parent_refn, attr,
-			      &credentials, NULL, &resp_cr);
+			      &credentials, NULL, NULL, &resp_cr);
 	if (ret < 0)
 	{
 	    PVFS_perror("PVFS_sys_create() failure", ret);

Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/module.mk.in,v
diff -p -u -r1.51.12.1 -r1.51.12.1.2.1
--- module.mk.in	28 Sep 2006 19:03:51 -0000	1.51.12.1
+++ module.mk.in	21 Jul 2008 18:22:32 -0000	1.51.12.1.2.1
@@ -26,6 +26,8 @@ TESTSRC += \
 	$(DIR)/test-lock2.c \
 	$(DIR)/io-test.c \
 	$(DIR)/io-test-offset.c \
+	$(DIR)/io-test-threaded.c \
+	$(DIR)/getattr-test-threaded.c \
 	$(DIR)/initialize.c \
 	$(DIR)/initialize-dyn.c \
 	$(DIR)/getparent.c \
@@ -43,3 +45,10 @@ TESTSRC += \
 
 MODCFLAGS_$(DIR)/io-stress.c := -D_GNU_SOURCE
 MODLDFLAGS_$(DIR) := -lrt
+MODLDFLAGS_$(DIR)/io-test-threaded := -lpthread
+MODLDFLAGS_$(DIR)/getattr-test-threaded := -lpthread
+
+#$(DIR)/io-test-threaded: $(DIR)/io-test-threaded.o
+#	$(Q) "  LD              $@"
+#	$(E)$(LD) $< $(LDFLAGS) $(LIBS) -lpthread -o $@
+

Index: test-accesses.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/test-accesses.c,v
diff -p -u -r1.4 -r1.4.38.1
--- test-accesses.c	12 Apr 2006 15:26:47 -0000	1.4
+++ test-accesses.c	21 Jul 2008 18:22:32 -0000	1.4.38.1
@@ -84,7 +84,7 @@ int main(int argc, char * argv[])
 
     ret = PVFS_sys_create(
 	(char*)filename, 
-	lookup_resp.ref, attr, &creds, NULL, &create_resp);
+	lookup_resp.ref, attr, &creds, NULL, NULL, &create_resp);
     if(ret < 0) goto error;
 
     for(; i < count; ++i)

Index: test-create-scale.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/test-create-scale.c,v
diff -p -u -r1.5 -r1.5.60.1
--- test-create-scale.c	14 Jun 2004 21:48:44 -0000	1.5
+++ test-create-scale.c	21 Jul 2008 18:22:32 -0000	1.5.60.1
@@ -119,7 +119,7 @@ int main(int argc, char **argv)
     /* do one big one to prime connections if needed */
     sprintf(entry_name, "%s%d", str_buf, 0);
     ret = PVFS_sys_create(entry_name, parent_refn, attr,
-			  &credentials, NULL, &resp_create);
+			  &credentials, NULL, NULL, &resp_create);
     if (ret < 0)
     {
 	PVFS_perror("PVFS_sys_create", ret);
@@ -140,7 +140,7 @@ int main(int argc, char **argv)
 	    attr.dfile_count = i+1;
 	    start_time = Wtime();
 	    ret = PVFS_sys_create(entry_name, parent_refn, attr,
-				  &credentials, NULL, &resp_create);
+				  &credentials, NULL, NULL, &resp_create);
 	    end_time = Wtime();
 	    if (ret < 0)
 	    {

Index: test-hindexed-test.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/test-hindexed-test.c,v
diff -p -u -r1.3 -r1.3.22.1
--- test-hindexed-test.c	18 Aug 2006 15:08:19 -0000	1.3
+++ test-hindexed-test.c	21 Jul 2008 18:22:32 -0000	1.3.22.1
@@ -292,7 +292,7 @@ int main(int argc, char **argv)
 
     memset(&resp_create, 0, sizeof(PVFS_sysresp_create));
     ret = PVFS_sys_create(entry_name, parent_ref, attr,
-                          &credentials, NULL, &resp_create);
+                          &credentials, NULL, NULL, &resp_create);
     if (ret < 0)
     {
 			PVFS_perror("PVFS_sys_create", ret);

Index: test-pint-bucket.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/client/sysint/test-pint-bucket.c,v
diff -p -u -r1.37 -r1.37.30.1
--- test-pint-bucket.c	18 Aug 2006 14:55:57 -0000	1.37
+++ test-pint-bucket.c	21 Jul 2008 18:22:32 -0000	1.37.30.1
@@ -111,7 +111,7 @@ int main(int argc, char **argv)	
         }
         printf("Loading mappings of filesystem %s\n",
                cur_fs->file_system_name);
-        if (PINT_handle_load_mapping(&server_config,cur_fs))
+        if (PINT_cached_config_handle_load_mapping(cur_fs))
         {
             fprintf(stderr, "PINT_handle_load_mapping failure.\n");
             return(-1);
@@ -151,10 +151,8 @@ int main(int argc, char **argv)	
         printf("\n");
         for(j = 0; j < NUM_META_SERVERS_TO_QUERY; j++)
         {
-            if (PINT_cached_config_get_next_meta(&server_config,
-                                          fs_ids[i],
-                                          &m_addr,
-                                          &meta_handle_extent_array))
+            if (PINT_cached_config_get_next_meta(
+		    fs_ids[i], &m_addr, &meta_handle_extent_array))
             {
                 fprintf(stderr, "PINT_cached_config_get_next_meta failure.\n");
                 return(-1);
@@ -172,9 +170,9 @@ int main(int argc, char **argv)	
             }
         }
 
-        if (PINT_cached_config_get_next_io(&server_config, fs_ids[i],
-                                    NUM_DATA_SERVERS_TO_QUERY,
-                                    d_addr, data_handle_extent_array))
+        if (PINT_cached_config_get_next_io(
+		fs_ids[i], NUM_DATA_SERVERS_TO_QUERY,
+		d_addr, data_handle_extent_array))
         {
             fprintf(stderr, "PINT_cached_config_get_next_io failure.\n");
             return(-1);

--- acache-torture.c	2008-07-21 14:22:34.000000000 -0400
+++ /dev/null	2004-06-24 14:04:38.000000000 -0400
@@ -1,157 +0,0 @@
-/*
- * (C) 2001 Clemson University and The University of Chicago
- *
- * See COPYING in top-level directory.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <assert.h>
-
-#include "pvfs2-debug.h"
-#include "acache.h"
-#include "gossip.h"
-#include "pvfs2-internal.h"
-
-#define ENTRIES_TO_ADD           512
-#define DEFAULT_TIMEOUT_SECONDS    2
-
-int main(int argc, char **argv)	
-{
-    int timeout = DEFAULT_TIMEOUT_SECONDS;
-    int ret = -1, i = 0;
-    int entries_to_add = 0;
-    PINT_pinode *pinode1 = NULL, *pinode2 = NULL;
-    PVFS_object_ref tmp;
-
-    if (argc == 2)
-    {
-        sscanf(argv[1], "%d", &entries_to_add);
-    }
-    else
-    {
-        entries_to_add = ENTRIES_TO_ADD;
-    }
-
-    gossip_enable_stderr();
-    gossip_set_debug_mask(1, GOSSIP_ACACHE_DEBUG);
-
-    ret = PINT_cached_config_initialize();
-    if(ret < 0)
-    {
-	gossip_err("cached_config_initialize() failure.\n");
-	return -1;
-    }
-
-    /* initialize the cache */
-    ret = PINT_acache_initialize();
-    if(ret < 0)
-    {
-        gossip_err("acache_initialize() failure.\n");
-        return(-1);
-    }
-
-    PINT_acache_set_timeout(timeout * 1000);
-
-    for(i = 0; i < entries_to_add; i++)
-    {
-        tmp.handle = (PVFS_handle)i;
-        tmp.fs_id = (PVFS_fs_id)(i + 1000);
-
-        pinode1 = PINT_acache_lookup(tmp, NULL, NULL);
-        assert(pinode1 == NULL);
-
-        pinode1 = PINT_acache_pinode_alloc();
-        assert(pinode1);
-
-        pinode1->refn = tmp;
-
-        PINT_acache_set_valid(pinode1);
-    }
-
-    if (i == entries_to_add)
-    {
-        gossip_debug(GOSSIP_ACACHE_DEBUG, "Added %d entries to acache\n", i);
-    }
-
-    for(i = 0; i < entries_to_add; i++)
-    {
-        tmp.handle = (PVFS_handle)i;
-        tmp.fs_id = (PVFS_fs_id)(i + 1000);
-
-        pinode2 = PINT_acache_lookup(tmp, NULL, NULL);
-        assert(pinode2);
-
-        if (PINT_acache_pinode_status(pinode2, NULL) != PINODE_STATUS_VALID)
-        {
-            gossip_err("(1) Failure: lookup returned %llu when it "
-                       "should've returned %llu.\n",
-                       llu(pinode2->refn.handle), llu(tmp.handle));
-        }
-    }
-
-    /* sleep to make sure all entries expired */
-    gossip_debug(GOSSIP_ACACHE_DEBUG," Sleeping for %d seconds\n",timeout);
-    sleep(timeout);
-
-    for(i = 0; i < entries_to_add; i++)
-    {
-        tmp.handle = (PVFS_handle)i;
-        tmp.fs_id = (PVFS_fs_id)(i + 1000);
-
-        pinode2 = PINT_acache_lookup(tmp, NULL, NULL);
-        assert(pinode2);
-
-        if (PINT_acache_pinode_status(pinode2, NULL) == PINODE_STATUS_VALID)
-        {
-            gossip_err("(2) Failure: lookup returned %llu when it "
-                       "should've been expired.\n",
-                       llu(pinode2->refn.handle));
-        }
-
-        /* make them once again valid here before dropping the ref */
-        PINT_acache_set_valid(pinode2);
-        PINT_acache_release(pinode2);
-    }
-
-    /* again make sure entries are all valid */
-    for(i = 0; i < entries_to_add; i++)
-    {
-        tmp.handle = (PVFS_handle)i;
-        tmp.fs_id = (PVFS_fs_id)(i + 1000);
-
-        pinode2 = PINT_acache_lookup(tmp, NULL, NULL);
-        assert(pinode2);
-
-        if (PINT_acache_pinode_status(pinode2, NULL) != PINODE_STATUS_VALID)
-        {
-            gossip_err("(3) Failure: lookup returned %llu when it "
-                       "should've returned %llu.\n",
-                       llu(pinode2->refn.handle), llu(tmp.handle));
-        }
-
-        /*
-          explicitly make all pinode entries invalid
-          here (note, invalidate drops the ref)
-        */
-        PINT_acache_invalidate(tmp);
-    }
-
-    if (i == entries_to_add)
-    {
-        gossip_debug(GOSSIP_ACACHE_DEBUG, "All expected lookups were ok\n");
-    }
-
-    /* drop initial references */
-    for(i = 0; i < entries_to_add; i++)
-    {
-        tmp.handle = (PVFS_handle)i;
-        tmp.fs_id = (PVFS_fs_id)(i + 1000);
-
-        PINT_acache_invalidate(tmp);
-    }
-
-    PINT_acache_finalize();
-
-    return 0;
-}



More information about the Pvfs2-cvs mailing list