[Pvfs2-cvs] commit by vilayann in pvfs2-1/src/common/misc: mkspace.c pint-cached-config.c pint-perf-counter.h pint-util.c pint-util.h pvfs2-debug.c pvfs2-internal.h pvfs2-util.c server-config.c server-config.h str-utils.c str-utils.h tcache.c tcache.h

CVS commit program cvs at parl.clemson.edu
Wed Aug 9 16:17:37 EDT 2006


Update of /projects/cvsroot/pvfs2-1/src/common/misc
In directory parlweb1:/tmp/cvs-serv7687/src/common/misc

Modified Files:
      Tag: posix-extensions-branch
	mkspace.c pint-cached-config.c pint-perf-counter.h pint-util.c 
	pint-util.h pvfs2-debug.c pvfs2-internal.h pvfs2-util.c 
	server-config.c server-config.h str-utils.c str-utils.h 
	tcache.c tcache.h 
Log Message:
Reverse merge changes from HEAD to posix-extensions-branch.



Index: mkspace.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/mkspace.c,v
diff -p -u -r1.35.2.1 -r1.35.2.2
--- mkspace.c	28 Apr 2006 01:07:11 -0000	1.35.2.1
+++ mkspace.c	9 Aug 2006 20:17:35 -0000	1.35.2.2
@@ -24,9 +24,8 @@
 #include "pvfs2-util.h"
 #include "pvfs2-internal.h"
 
-static char *dir_ent_string = "dir_ent";
-static char *dirdata_size_string = "dirdata_size";
-static char *root_handle_string = "root_handle";
+static char *dir_ent_string = DIRECTORY_ENTRY_KEYSTR;
+static char *root_handle_string = ROOT_HANDLE_KEYSTR;
 static char *lost_and_found_string = "lost+found";
 
 static TROVE_handle s_used_handles[4] =
@@ -135,7 +134,6 @@ int pvfs2_mkspace(
     TROVE_handle root_dirdata_handle = TROVE_HANDLE_NULL;
     TROVE_handle lost_and_found_handle = TROVE_HANDLE_NULL;
     TROVE_handle lost_and_found_dirdata_handle = TROVE_HANDLE_NULL;
-    PVFS_size init_size = 0;
 
     mkspace_print(verbose,"Storage space: %s\n",storage_space);
     mkspace_print(verbose,"Collection   : %s\n",collection);
@@ -430,33 +428,6 @@ int pvfs2_mkspace(
             return -1;
         }
 
-
-	key.buffer = dirdata_size_string;
-	key.buffer_sz = strlen(dirdata_size_string) + 1;
-
-	init_size = 1; /* initialize the size to 1 because of lost+found */
-	val.buffer = &init_size;
-	val.buffer_sz = sizeof(PVFS_size);
-
-	ret = trove_keyval_write(
-	    coll_id, new_root_handle, &key, &val,
-	    TROVE_SYNC, 0, NULL,
-	    trove_context, &op_id);
-	
-	while(ret == 0)
-	{
-	    ret = trove_dspace_test(
-		coll_id, op_id, trove_context, &count, NULL, NULL,
-		&state, TROVE_DEFAULT_TEST_TIMEOUT);
-	}
-
-	if(ret < 0)
-	{
-	    gossip_err("error: keyval write for handle used to store "
-		       "dirents failed: aborting!\n");
-	    return -1;
-	}
-
         mkspace_print(
             verbose, "info: wrote attributes for root directory.\n");
 
@@ -608,32 +579,6 @@ int pvfs2_mkspace(
             return -1;
         }
 
-        key.buffer = dirdata_size_string;
-        key.buffer_sz = strlen(dirdata_size_string) + 1;
-
-	init_size = 0;
-        val.buffer = &init_size;
-        val.buffer_sz = sizeof(PVFS_size);
-
-        ret = trove_keyval_write(
-            coll_id, lost_and_found_handle, &key, &val, 
-            TROVE_SYNC,
-            0, NULL, trove_context, &op_id);
-
-        while (ret == 0)
-        {
-            ret = trove_dspace_test(
-                coll_id, op_id, trove_context, &count, NULL, NULL,
-                &state, TROVE_DEFAULT_TEST_TIMEOUT);
-        }
-
-        if (ret < 0)
-        {
-            gossip_err("error: keyval write for handle used to store "
-                       "dirents failed; aborting!\n");
-            return -1;
-        }
-
         mkspace_print(verbose, "info: wrote attributes for "
                       "lost+found directory.\n");
 
@@ -649,7 +594,8 @@ int pvfs2_mkspace(
 
         ret = trove_keyval_write(
             coll_id, root_dirdata_handle, &key, &val, 
-            TROVE_SYNC, 0,
+            TROVE_SYNC | TROVE_NOOVERWRITE | TROVE_KEYVAL_HANDLE_COUNT, 
+	    0,
             NULL, trove_context, &op_id);
 
         while (ret == 0)
@@ -669,7 +615,7 @@ int pvfs2_mkspace(
         mkspace_print(verbose, "info: adding lost+found directory to "
                       "the root directory.\n");
     }
-
+    	
     if (trove_context != -1)
     {
         trove_close_context(coll_id, trove_context);

Index: pint-cached-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/pint-cached-config.c,v
diff -p -u -r1.16 -r1.16.2.1
--- pint-cached-config.c	9 Mar 2006 21:11:03 -0000	1.16
+++ pint-cached-config.c	9 Aug 2006 20:17:35 -0000	1.16.2.1
@@ -277,6 +277,7 @@ int PINT_cached_config_get_next_meta(
             }
             else
             {
+                /* we let the jitter loop below increment the cursor by one */ 
                 jitter = 0;
             }
             while(jitter-- > -1)
@@ -338,6 +339,7 @@ int PINT_cached_config_get_next_io(
     struct qlist_head *hash_link = NULL;
     struct config_fs_cache_s *cur_config_cache = NULL;
     int jitter = 0, num_io_servers = 0;
+    PINT_llist* old_data_server_cursor = NULL;
 
     if (config && num_servers && io_handle_extent_array)
     {
@@ -353,6 +355,7 @@ int PINT_cached_config_get_next_io(
             num_io_servers = PINT_llist_count(
                 cur_config_cache->fs->data_handle_ranges);
 
+
             /* pick random starting point, then round robin */
             if(!io_randomized)
             {
@@ -378,6 +381,7 @@ int PINT_cached_config_get_next_io(
                 cur_config_cache->data_server_cursor = PINT_llist_next(
                     cur_config_cache->data_server_cursor);
             }
+            old_data_server_cursor = cur_config_cache->data_server_cursor;
 
             while(num_servers)
             {
@@ -418,6 +422,10 @@ int PINT_cached_config_get_next_io(
 		    io_addr_array++;
             }
             ret = ((num_servers == 0) ? 0 : ret);
+            /* reset data server cursor to point to the old cursor; the
+             * jitter on the next iteration will increment it by one
+             */
+            cur_config_cache->data_server_cursor = old_data_server_cursor;
         }
     }
     return ret;

Index: pint-perf-counter.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/pint-perf-counter.h,v
diff -p -u -r1.7.2.2 -r1.7.2.3
--- pint-perf-counter.h	7 Jun 2006 03:20:43 -0000	1.7.2.2
+++ pint-perf-counter.h	9 Aug 2006 20:17:35 -0000	1.7.2.3
@@ -11,8 +11,10 @@
 #include "pvfs2-mgmt.h"
 #include "gen-locks.h"
 
-#define PERF_DEFAULT_TIME_INTERVAL_SECS (60*5)
-#define PERF_DEFAULT_HISTORY_SIZE       6
+enum {
+PERF_DEFAULT_TIME_INTERVAL_SECS = 300,
+PERF_DEFAULT_HISTORY_SIZE       = 6,
+};
 
 /** flag that indicates that values for a particular key should be preserved
  * across rollover rather than reset to 0

Index: pint-util.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/pint-util.c,v
diff -p -u -r1.9.12.1 -r1.9.12.2
--- pint-util.c	9 May 2006 23:12:12 -0000	1.9.12.1
+++ pint-util.c	9 Aug 2006 20:17:35 -0000	1.9.12.2
@@ -132,6 +132,33 @@ int PINT_copy_object_attr(PVFS_object_at
                 src->u.dir.dirent_count;
         }
 
+        if (src->mask & PVFS_ATTR_DIR_HINT)
+        {
+            dest->u.dir.hint.dfile_count = 
+                src->u.dir.hint.dfile_count;
+            dest->u.dir.hint.dist_name_len =
+                src->u.dir.hint.dist_name_len;
+            if (dest->u.dir.hint.dist_name_len > 0)
+            {
+                dest->u.dir.hint.dist_name = strdup(src->u.dir.hint.dist_name);
+                if (dest->u.dir.hint.dist_name == NULL)
+                {
+                    return ret;
+                }
+            }
+            dest->u.dir.hint.dist_params_len =
+                src->u.dir.hint.dist_params_len;
+            if (dest->u.dir.hint.dist_params_len > 0)
+            {
+                dest->u.dir.hint.dist_params = strdup(src->u.dir.hint.dist_params);
+                if (dest->u.dir.hint.dist_params == NULL)
+                {
+                    free(dest->u.dir.hint.dist_name);
+                    return ret;
+                }
+            }
+        }
+
         /*
           NOTE:
           we only copy the size out if we're actually a
@@ -249,6 +276,20 @@ void PINT_free_object_attr(PVFS_object_a
                     attr->u.sym.target_path)
                 {
                     free(attr->u.sym.target_path);
+                }
+            }
+        }
+        else if (attr->objtype == PVFS_TYPE_DIRECTORY)
+        {
+            if ((attr->mask & PVFS_ATTR_DIR_HINT) || (attr->mask & PVFS_ATTR_DIR_DIRENT_COUNT))
+            {
+                if (attr->u.dir.hint.dist_name)
+                {
+                    free(attr->u.dir.hint.dist_name);
+                }
+                if (attr->u.dir.hint.dist_params)
+                {
+                    free(attr->u.dir.hint.dist_params);
                 }
             }
         }

Index: pint-util.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/pint-util.h,v
diff -p -u -r1.9 -r1.9.6.1
--- pint-util.h	16 Dec 2005 17:10:35 -0000	1.9
+++ pint-util.h	9 Aug 2006 20:17:36 -0000	1.9.6.1
@@ -14,16 +14,52 @@
 #include "pvfs2-attr.h"
 
 /* converts common fields between sys attr and obj attr structures */
-#define PINT_CONVERT_ATTR(dest, src, attrmask)  \
-do{                                             \
-    (dest)->owner = (src)->owner;               \
-    (dest)->group = (src)->group;               \
-    (dest)->perms = (src)->perms;               \
-    (dest)->atime = (src)->atime;               \
-    (dest)->mtime = (src)->mtime;               \
-    (dest)->ctime = (src)->ctime;               \
-    (dest)->objtype = (src)->objtype;           \
-    (dest)->mask = ((src)->mask & attrmask);    \
+#define PINT_CONVERT_ATTR(dest, src, extra_amask)       \
+do{                                                     \
+    (dest)->mask = 0;                                   \
+    if ((src)->mask & PVFS_ATTR_SYS_UID)                \
+    {                                                   \
+        (dest)->owner = (src)->owner;                   \
+        (dest)->mask  |= PVFS_ATTR_COMMON_UID;          \
+    }                                                   \
+    if ((src)->mask & PVFS_ATTR_SYS_GID)                \
+    {                                                   \
+        (dest)->group = (src)->group;                   \
+        (dest)->mask |= PVFS_ATTR_COMMON_GID;           \
+    }                                                   \
+    if ((src)->mask & PVFS_ATTR_SYS_PERM)               \
+    {                                                   \
+        (dest)->perms = (src)->perms;                   \
+        (dest)->mask |= PVFS_ATTR_COMMON_PERM;          \
+    }                                                   \
+    if ((src)->mask & PVFS_ATTR_SYS_ATIME)              \
+    {                                                   \
+        (dest)->mask |= PVFS_ATTR_COMMON_ATIME;         \
+        if ((src)->mask & PVFS_ATTR_SYS_ATIME_SET)      \
+        {                                               \
+            (dest)->atime = (src)->atime;               \
+            (dest)->mask |= PVFS_ATTR_COMMON_ATIME_SET; \
+        }                                               \
+    }                                                   \
+    if ((src)->mask & PVFS_ATTR_SYS_MTIME)              \
+    {                                                   \
+        (dest)->mask |= PVFS_ATTR_COMMON_MTIME;         \
+        if ((src)->mask & PVFS_ATTR_SYS_MTIME_SET)      \
+        {                                               \
+            (dest)->mtime = (src)->mtime;               \
+            (dest)->mask |= PVFS_ATTR_COMMON_MTIME_SET; \
+        }                                               \
+    }                                                   \
+    if ((src)->mask & PVFS_ATTR_SYS_CTIME)              \
+    {                                                   \
+        (dest)->mask |= PVFS_ATTR_COMMON_CTIME;         \
+    }                                                   \
+    if ((src)->mask & PVFS_ATTR_SYS_TYPE)               \
+    {                                                   \
+        (dest)->objtype = (src)->objtype;               \
+        (dest)->mask |= PVFS_ATTR_COMMON_TYPE;          \
+    }                                                   \
+    (dest)->mask |= (extra_amask);                      \
 }while(0)
 
 struct PINT_time_marker_s

Index: pvfs2-debug.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/pvfs2-debug.c,v
diff -p -u -r1.38.2.2 -r1.38.2.3
--- pvfs2-debug.c	7 Jun 2006 03:20:43 -0000	1.38.2.2
+++ pvfs2-debug.c	9 Aug 2006 20:17:36 -0000	1.38.2.3
@@ -32,53 +32,97 @@ GOSSIP_MSGPAIR_DEBUG | GOSSIP_CLIENTCORE
 GOSSIP_SETATTR_DEBUG | GOSSIP_MKDIR_DEBUG |                       \
 GOSSIP_SETEATTR_DEBUG | GOSSIP_GETEATTR_DEBUG |                   \
 GOSSIP_LISTEATTR_DEBUG | GOSSIP_LISTATTR_DEBUG |                  \
+GOSSIP_DBPF_KEYVAL_DEBUG |                                        \
 GOSSIP_ACCESS_DEBUG | GOSSIP_ACCESS_DETAIL_DEBUG |                \
 GOSSIP_PERFCOUNTER_DEBUG)
 
 /* map all config keywords to pvfs2 debug masks here */
 static __keyword_mask_t s_keyword_mask_map[] =
 {
+    /* Log trove debugging info.  Same as 'trove'.*/
     { "storage", GOSSIP_TROVE_DEBUG },
+    /* Log trove debugging info.  Same as 'storage'. */
     { "trove", GOSSIP_TROVE_DEBUG },
+    /* Log trove operations. */
     { "trove_op", GOSSIP_TROVE_OP_DEBUG },
+    /* Log network debug info. */
     { "network", GOSSIP_BMI_DEBUG_ALL },
+    /* Log server info, including new operations. */
     { "server", GOSSIP_SERVER_DEBUG },
+    /* Log client sysint info.  This is only useful for the client. */
     { "client", GOSSIP_CLIENT_DEBUG },
+    /* Debug the varstrip distribution */
     { "varstrip", GOSSIP_VARSTRIP_DEBUG },
+    /* Log job info */
     { "job", GOSSIP_JOB_DEBUG },
+    /* Debug PINT_process_request calls.  EXTREMELY verbose! */
     { "request", GOSSIP_REQUEST_DEBUG },
+    /* Log request scheduler events */
     { "reqsched", GOSSIP_REQ_SCHED_DEBUG },
+    /* Log the flow protocol events, including flowproto_multiqueue */
     { "flowproto", GOSSIP_FLOW_PROTO_DEBUG },
+    /* Log flow calls */
     { "flow", GOSSIP_FLOW_DEBUG },
+    /* Debug the client name cache.  Only useful on the client. */
     { "ncache", GOSSIP_NCACHE_DEBUG },
+    /* Debug read-ahead cache events.  Only useful on the client. */
     { "mmaprcache", GOSSIP_MMAP_RCACHE_DEBUG },
+    /* Debug the attribute cache.  Only useful on the client. */
     { "acache", GOSSIP_ACACHE_DEBUG },
+    /* Log/Debug distribution calls */
     { "distribution", GOSSIP_DIST_DEBUG },
+    /* Debug the server-side dbpf attribute cache */
     { "dbpfattrcache", GOSSIP_DBPF_ATTRCACHE_DEBUG },
+    /* Debug the client lookup state machine. */
     { "lookup", GOSSIP_LOOKUP_DEBUG },
+    /* Debug the client remove state macine. */
     { "remove", GOSSIP_REMOVE_DEBUG },
+    /* Debug the server getattr state machine. */
     { "getattr", GOSSIP_GETATTR_DEBUG },
-    { "listattr", GOSSIP_LISTATTR_DEBUG },
+    /* Debug the server setattr state machine. */
     { "setattr", GOSSIP_SETATTR_DEBUG },
+    /* vectored getattr server state machine */
+    { "listattr", GOSSIP_LISTATTR_DEBUG },
+    /* Debug the client and server get ext attributes SM. */
     { "geteattr", GOSSIP_GETEATTR_DEBUG },
+    /* Debug the client and server set ext attributes SM. */
     { "seteattr", GOSSIP_SETEATTR_DEBUG },
+    /* Debug the readdir operation (client and server) */
     { "readdir", GOSSIP_READDIR_DEBUG },
+    /* Debug the mkdir operation (server only) */
     { "mkdir", GOSSIP_MKDIR_DEBUG },
+    /* Debug the io operation (reads and writes) 
+     * for both the client and server */
     { "io", GOSSIP_IO_DEBUG },
+    /* Debug the server's open file descriptor cache */
     { "open_cache", GOSSIP_DBPF_OPEN_CACHE_DEBUG }, 
+    /* Debug permissions checking on the server */
     { "permissions", GOSSIP_PERMISSIONS_DEBUG }, 
+    /* Debug the cancel operation */
     { "cancel", GOSSIP_CANCEL_DEBUG },
+    /* Debug the msgpair state machine */
     { "msgpair", GOSSIP_MSGPAIR_DEBUG },
+    /* Debug the client core app */
     { "clientcore", GOSSIP_CLIENTCORE_DEBUG },
+    /* Debug the client timing state machines (job timeout, etc.) */
     { "clientcore_timing", GOSSIP_CLIENTCORE_TIMING_DEBUG },
+    /* Show server file (metadata) accesses (both modify and read-only). */ 
     { "access", GOSSIP_ACCESS_DEBUG },
+    /* Show more detailed server file accesses */
     { "access_detail", GOSSIP_ACCESS_DETAIL_DEBUG },
+    /* Debug the listeattr operation */
     { "listeattr", GOSSIP_LISTEATTR_DEBUG },
+    /* Debug the state machine management code */
     { "sm", GOSSIP_STATE_MACHINE_DEBUG },
+    /* Debug the metadata dbpf keyval functions */
     { "keyval", GOSSIP_DBPF_KEYVAL_DEBUG },
+    /* Debug the metadata sync coalescing code */
     { "coalesce", GOSSIP_DBPF_COALESCE_DEBUG },
+    /* Everything except the perf counter.  Useful for debugging */
     { "verbose",  (__DEBUG_ALL & ~GOSSIP_PERFCOUNTER_DEBUG)},
+    /* No debug output */
     { "none", GOSSIP_NO_DEBUG },
+    /* Everything */
     { "all",  __DEBUG_ALL }
 };
 #undef __DEBUG_ALL

Index: pvfs2-internal.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/pvfs2-internal.h,v
diff -p -u -r1.1 -r1.1.12.1
--- pvfs2-internal.h	11 Nov 2005 21:31:02 -0000	1.1
+++ pvfs2-internal.h	9 Aug 2006 20:17:36 -0000	1.1.12.1
@@ -37,4 +37,16 @@
 #  error Unexpected sizeof(long int)
 #endif
 
+/* key string definition macros.  These are used by the server and
+ * by the client (in the case of xattrs with viewdist, etc).
+ */
+#define ROOT_HANDLE_KEYSTR      "rh"
+#define DIRECTORY_ENTRY_KEYSTR  "de"
+#define DATAFILE_HANDLES_KEYSTR "dh"
+#define METAFILE_DIST_KEYSTR    "md"
+#define SYMLINK_TARGET_KEYSTR   "st"
+
+
+#define IO_MAX_REGIONS 64
+
 #endif /* PVFS2_INTERNAL_H */

Index: pvfs2-util.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/pvfs2-util.c,v
diff -p -u -r1.86.2.2 -r1.86.2.3
--- pvfs2-util.c	7 Jun 2006 03:20:43 -0000	1.86.2.2
+++ pvfs2-util.c	9 Aug 2006 20:17:36 -0000	1.86.2.3
@@ -180,6 +180,28 @@ int PVFS_util_copy_sys_attr(
                 return ret;
             }
         }
+        else if ((src_attr->mask & PVFS_ATTR_SYS_DIR_HINT))
+        {
+            if (src_attr->dist_name)
+            {
+                dest_attr->dist_name = strdup(src_attr->dist_name);
+                if (dest_attr->dist_name == NULL)
+                {
+                    ret = -PVFS_ENOMEM;
+                    return ret;
+                }
+            }
+            if (src_attr->dist_params)
+            {
+                dest_attr->dist_params = strdup(src_attr->dist_params);
+                if (dest_attr->dist_params == NULL)
+                {
+                    free(dest_attr->dist_name);
+                    ret = -PVFS_ENOMEM;
+                    return ret;
+                }
+            }
+        }
         ret = 0;
     }
     return ret;
@@ -195,6 +217,16 @@ void PVFS_util_release_sys_attr(PVFS_sys
             free(attr->link_target);
             attr->link_target = NULL;
         }
+        else if ((attr->mask & PVFS_ATTR_SYS_DIR_HINT) &&
+            (attr->objtype == PVFS_TYPE_DIRECTORY))
+        {
+            if (attr->dist_name)
+                free(attr->dist_name);
+            if (attr->dist_params)
+                free(attr->dist_params);
+            attr->dist_name = NULL;
+            attr->dist_params = NULL;
+        }
     }
 }
 
@@ -1476,6 +1508,11 @@ uint32_t PVFS_util_sys_to_object_attr_ma
         attrmask |= PVFS_ATTR_DIR_DIRENT_COUNT;
     }
 
+    if (sys_attrmask & PVFS_ATTR_SYS_DIR_HINT)
+    {
+        attrmask |= PVFS_ATTR_DIR_HINT;
+    }
+
     if (sys_attrmask & PVFS_ATTR_SYS_LNK_TARGET)
     {
         attrmask |= PVFS_ATTR_SYMLNK_TARGET;
@@ -1536,6 +1573,10 @@ uint32_t PVFS_util_object_to_sys_attr_ma
     if (obj_mask & PVFS_ATTR_META_DFILES)
     {
         sys_mask |= PVFS_ATTR_SYS_DFILE_COUNT;
+    }
+    if (obj_mask & PVFS_ATTR_DIR_HINT)
+    {
+        sys_mask |= PVFS_ATTR_SYS_DIR_HINT;
     }
     return sys_mask;
 }

Index: server-config.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/server-config.c,v
diff -p -u -r1.76.8.3 -r1.76.8.4
--- server-config.c	7 Jun 2006 03:20:43 -0000	1.76.8.3
+++ server-config.c	9 Aug 2006 20:17:36 -0000	1.76.8.4
@@ -30,6 +30,8 @@
 #include "openssl/evp.h"
 #endif
 
+static const char * replace_old_keystring(const char * oldkey);
+
 static DOTCONF_CB(get_pvfs_server_id);
 static DOTCONF_CB(get_logstamp);
 static DOTCONF_CB(get_storage_space);
@@ -79,7 +81,6 @@ static DOTCONF_CB(get_db_cache_type);
 static DOTCONF_CB(get_param);
 static DOTCONF_CB(get_value);
 static DOTCONF_CB(get_default_num_dfiles);
-static DOTCONF_CB(get_metadata_sync_coalesce);
 static DOTCONF_CB(get_immediate_completion);
 static DOTCONF_CB(get_server_job_bmi_timeout);
 static DOTCONF_CB(get_server_job_flow_timeout);
@@ -135,17 +136,68 @@ static int is_root_handle_in_my_range(
     struct filesystem_configuration_s *fs);
 #endif
 
-/* 
- * NOTE: The documentation for the server config format is generated
- * from the following static array.  The documentation for an option
- * is taken from the comments found before the beginning of each sub-structure
- * as shown.
+/* PVFS2 servers are deployed using configuration files that provide information
+ * about the file systems, storage locations and endpoints that each server
+ * manages.  For every pvfs2 deployment, there is a global config file
+ * (<i>fs.conf</i>) shared between all of the pvfs2 servers, as well as
+ * per-server config files (<i>server.conf</i>) that contain config options 
+ * unique to that server (such as host/port endpoint).  Configuration options 
+ * in both the global and server specific config files have the following format:
+ * 
+ * <pre>
+ * OptionName OptionValue
+ * </pre>
+ *
+ * An option cannot span more than one line, and only one option can
+ * be specified on each line.  The <i>OptionValue</i> should 
+ * be formatted based on the option's type:
+ *
+ * <ul>
+ * <li>Integer - must be an integer value
+ * <li>String - must be a string without breaks (newlines)
+ * <li>List - a set of strings separated by commas
+ * </ul>
+ *
+ * Options are grouped together using contexts, and usually
+ * indented within a context for clarity.  A context is started
+ * with a context start tag, and ended with a context end tag:
+ * 
+ * <pre>
+ * &lt;ContextName&gt;
+ *     Option1Name Option1Value
+ *     Option2Name Option2Value
+ * &lt;/ContextName&gt;
+ * </pre>
+ *
+ * Options are required to be defined within a specified context 
+ * or set of contexts. 
+ * Sub-contexts can also be specified, and must be defined within
+ * their specified parent context.  For example, the <i>Range</i> option is
+ * specified in either the <i>DataHandleRanges</i> or <i>MetaHandleRanges</i> 
+ * contexts.  Both of
+ * those contexts are specified to be defined in the <i>FileSystem</i> context.
+ * Details of the required context an option or sub-context must be defined in
+ * are given in the <a href="#OptionDetails">Option Details</a> section. 
+ *
+ * Options and contexts that appear in the top-level (not defined within
+ * another context) are considered to be defined in a special <i>Global</i>
+ * context.  Many options are only specified to appear within either the
+ * <i>Global</i> context or the <a name="Default">Default</a> context, 
+ * which is a context that allows a default value to be specified for certain
+ * options.
+ *
+ * The options detailed below each specify their type, the context
+ * where they appear, a default value, and description.  The default
+ * value is used if the option is not specified in any of the config files.
+ * Options without default values are required to be defined in the
+ * config file.
  */
 static const configoption_t options[] =
 {
     /* 
      * Specifies a string identifier for the pvfs2 server that is to be
-     * run on this host.  The format of this string is:
+     * run on this host.  This option is required for each per-server config
+     * file.  The format of this string is:
      *
      * {transport}://{hostname}:{port}
      *
@@ -158,15 +210,15 @@ static const configoption_t options[] =
     {"HostID",ARG_STR, get_pvfs_server_id,NULL,CTX_GLOBAL,NULL},
     
     /* Specifies the local path for the pvfs2 server to use as storage space.
+     * This option is required for each per-server config file.
      * Example:
      *
      * /tmp/pvfs.storage
      */
     {"StorageSpace",ARG_STR, get_storage_space,NULL,CTX_GLOBAL,NULL},
 
-    /* Specifies the beginning of the Defaults context.  Options specified
-     * within the Defaults context are used as default values over all the
-     * pvfs2 server specific config files.
+    /* Options specified within the Defaults context are used as 
+     * default values over all the pvfs2 server specific config files.
      */
     {"<Defaults>",ARG_NONE, enter_defaults_context,NULL,CTX_GLOBAL,NULL},
 
@@ -175,8 +227,8 @@ static const configoption_t options[] =
     {"</Defaults>",ARG_NONE, exit_defaults_context,NULL,CTX_DEFAULTS,NULL},
 
 #ifdef USE_TRUSTED
-    /* Specifies the beginning of the Security context. Options specified 
-     * within the Security context are used to dictate whether the pvfs2
+    /* Options specified within the Security context are used to dictate 
+     * whether the pvfs2
      * servers will accept or handle file-system requests.
      * This section is optional and does not need to be specified.
      */
@@ -213,8 +265,7 @@ static const configoption_t options[] =
         CTX_SECURITY,NULL},
 #endif
 
-    /* Specifies the beginning of the Aliases context.  This groups 
-     * the Alias mapping options.
+    /* This groups the Alias mapping options.
      *
      * The Aliases context should be defined before any FileSystem contexts
      * are defined, as options in the FileSystem context usually need to
@@ -239,8 +290,7 @@ static const configoption_t options[] =
      */
     {"Alias",ARG_LIST, get_alias_list,NULL,CTX_ALIASES,NULL},
 
-    /* Specifies the beginning of a Filesystem context.  This groups
-     * options specific to a filesystem.  A pvfs2 server may manage
+    /* This groups options specific to a filesystem.  A pvfs2 server may manage
      * more than one filesystem, so a config file may have more than
      * one Filesystem context, each defining the parameters of a different
      * Filesystem.
@@ -252,11 +302,11 @@ static const configoption_t options[] =
     {"</FileSystem>",ARG_NONE, exit_filesystem_context,NULL,CTX_FILESYSTEM,
         NULL},
 
-    /* Specifies the beginning of a StorageHints context.  This groups
+    /* This groups
      * options specific to a filesystem and related to the behavior of the
      * storage system.  Mostly these options are passed directly to the
      * TROVE storage module which may or may not support them.  The
-     * DBPF module (the only TROVE module implemented at present) supports
+     * DBPF module (currently the only TROVE module available) supports
      * all of them.
      */
     {"<StorageHints>",ARG_NONE, enter_storage_hints_context,NULL,
@@ -311,7 +361,7 @@ static const configoption_t options[] =
     {"</Distribution>",ARG_NONE, exit_distribution_context,NULL,
         CTX_DISTRIBUTION,NULL},
 
-    /* As logical files are created in pvfs2, the data files and meta files
+    /* As logical files are created in pvfs, the data files and meta files
      * that represent them are given filesystem unique handle values.  The
      * user can specify a range of values (or set of ranges) 
      * to be allocated to data files and meta files for a particular server,
@@ -320,7 +370,7 @@ static const configoption_t options[] =
      * pvfs2-genconfig script determine the best ranges to specify.
      *
      * This option specifies a range of handle values that can be used for 
-     * a particular pvfs2 server in a particular context (meta handles
+     * a particular pvfs server in a particular context (meta handles
      * or data handles).  The DataHandleRanges and MetaHandleRanges contexts
      * should contain one or more Range options.  The format is:
      *
@@ -353,7 +403,7 @@ static const configoption_t options[] =
      * Where {handle value} is a positive integer no greater than 
      * 18446744073709551615 (UIN64_MAX).
      *
-     * In general its best to let the pvfs2-genconfig script specify a
+     * In general its best to let the pvfs-genconfig script specify a
      * RootHandle value for the filesystem.
      */
     {"RootHandle",ARG_STR, get_root_handle,NULL,
@@ -366,7 +416,7 @@ static const configoption_t options[] =
     {"Name",ARG_STR, get_name,NULL,
         CTX_FILESYSTEM|CTX_DISTRIBUTION,NULL},
 
-    /* A pvfs2 server may manage more than one filesystem, and so a
+    /* A pvfs server may manage more than one filesystem, and so a
      * unique identifier is used to represent each one.  
      * This option specifies such an ID (sometimes called a 'collection
      * id') for the filesystem it is defined in.  
@@ -378,19 +428,19 @@ static const configoption_t options[] =
     {"ID",ARG_INT, get_filesystem_collid,NULL,
         CTX_FILESYSTEM,NULL},
 
-    /* The gossip interface in pvfs2 allows users to specify different
-     * levels of logging for the pvfs2 server.  The output of these
+    /* The gossip interface in pvfs allows users to specify different
+     * levels of logging for the pvfs server.  The output of these
      * different log levels is written to a file, which is specified in
      * this option.  The value of the option must be the path pointing to a 
      * file with valid write permissions.  The Logfile option can be
-     * specified for all the pvfs2 servers in the Defaults context or for
+     * specified for all the pvfs servers in the Defaults context or for
      * a particular server in the Global context.
      */
     {"LogFile",ARG_STR, get_logfile,NULL,
         CTX_DEFAULTS|CTX_GLOBAL,"/tmp/pvfs2-server.log"},
 
-    /* The gossip interface in pvfs2 allows users to specify different
-     * levels of logging for the pvfs2 server.  This option sets that level for
+    /* The gossip interface in pvfs allows users to specify different
+     * levels of logging for the pvfs server.  This option sets that level for
      * either all servers (by being defined in the Defaults context) or for
      * a particular server by defining it in the Global context.  Possible
      * values for event logging are:
@@ -402,13 +452,15 @@ static const configoption_t options[] =
      * a '-'.  Examples of possible values are:
      *
      * EventLogging flow,msgpair,io
+     * 
      * EventLogging -storage
+     * 
      * EventLogging -flow,-flowproto
      */
     {"EventLogging",ARG_LIST, get_event_logging_list,NULL,
         CTX_DEFAULTS|CTX_GLOBAL,"none,"},
 
-    /* At startup each pvfs2 server allocates space for a set number
+    /* At startup each pvfs server allocates space for a set number
      * of incoming requests to prevent the allocation delay at the beginning
      * of each unexpected request.  This parameter specifies the number
      * of requests for which to allocate space.
@@ -420,14 +472,32 @@ static const configoption_t options[] =
      {"UnexpectedRequests",ARG_INT, get_unexp_req,NULL,
          CTX_DEFAULTS|CTX_GLOBAL,"50"},
 
-	/*
-	 * TCP socket buffer size.
-	 */
+     /* Current implementations of TCP on most systems use a window
+      * size that is too small for almost all uses of pvfs.  
+      * We recommend administators
+      * should consider tuning the linux kernel maximum send and
+      * receive buffer sizes via the /proc settings.  The
+      * <a href="http://www.psc.edu/networking/projects/tcptune/#Linux">
+      * PSC tcp tuning section for linux</a> has good information
+      * on how to do this.  
+      *
+      * The <i>TCPBufferSend</i> and
+      * <i>TCPBufferReceive</i> options allows setting the tcp window
+      * sizes for the pvfs clients and servers, if using the
+      * system wide settings is unacceptable.  The values should be
+      * large enough to hold the full bandwidth delay product (BDP)
+      * of the network.  Note that setting these values disables
+      * tcp autotuning.  See the
+      * <a href="http://www.psc.edu/networking/projects/tcptune/#options">
+      * PSC networking options</a> for details.
+      */
      {"TCPBufferSend",ARG_INT, get_tcp_buffer_send,NULL,
-         CTX_DEFAULTS|CTX_GLOBAL,"65535"},
-     {"TCPBufferReceive",ARG_INT, get_tcp_buffer_receive,NULL,
-         CTX_DEFAULTS|CTX_GLOBAL,"131071"},
+         CTX_DEFAULTS|CTX_GLOBAL,"0"},
 
+     /* See the <a href="#TCPBufferSend">TCPBufferSend</a> option.
+      */
+      {"TCPBufferReceive",ARG_INT, get_tcp_buffer_receive,NULL,
+         CTX_DEFAULTS|CTX_GLOBAL,"0"},
 
      /* Specifies the timeout value in seconds for BMI jobs on the server.
       */
@@ -461,7 +531,7 @@ static const configoption_t options[] =
 
      /* This specifies the frequency (in milliseconds) 
       * that performance monitor should be updated
-      * when the pvfs2 server is running in admin mode.
+      * when the pvfs server is running in admin mode.
       *
       * Can be set in either Default or Global contexts.
       */
@@ -480,7 +550,7 @@ static const configoption_t options[] =
      *
      * BMIModules bmi_tcp,bmi_ib
      *
-     * Note that only the bmi modules compiled into pvfs2 should be
+     * Note that only the bmi modules compiled into pvfs should be
      * specified in this list.  The BMIModules option can be specified
      * in either the Defaults or Global contexts.
      */
@@ -495,7 +565,7 @@ static const configoption_t options[] =
      * default and only available flow for production use.
      *
      * flowproto_bmi_cache - A flow module that enables the use of the NCAC
-     * (network-centric adaptive cache) in the pvfs2 server.  Since the NCAC
+     * (network-centric adaptive cache) in the pvfs server.  Since the NCAC
      * is currently disable and unsupported, this module exists as a proof
      * of concept only.
      *
@@ -526,27 +596,28 @@ static const configoption_t options[] =
      * object types that should get cached in the attribute cache.  
      * The possible values for this option are:
      *
-     * datafile_handles - This will cache the array of datafile handles for
-     *                    each logical file in this filesystem
+     * dh - (datafile handles) This will cache the array of datafile handles for
+     *      each logical file in this filesystem
      * 
-     * metafile_dist - This will cache (for each logical file)
-     *                 the file distribution information used to create/manage
-     *                 the datafiles.  
+     * md - (metafile distribution) This will cache (for each logical file)
+     *      the file distribution information used to create/manage
+     *      the datafiles.  
      *
-     * dir_ent - This will cache the handles of the directory entries in this
-     *           filesystem
+     * de - (directory entries) This will cache the handles of 
+     *      the directory entries in this filesystem
      *
-     * symlink_target - This will cache the target path for the symbolic links
-     *                  in this filesystem
+     * st - (symlink target) This will cache the target path 
+     *      for the symbolic links in this filesystem
      *
      * The format of this option is a comma-separated list of one or more
      * of the above values.  For example:
      *
-     * AttrCacheKeywords datafile_handles,metafile_dist,dir_ent
+     * AttrCacheKeywords dh,md,de,st
      */
     {"AttrCacheKeywords",ARG_LIST, get_attr_cache_keywords_list,NULL,
-        CTX_STORAGEHINTS,
-        "datafile_handles,metafile_dist,dir_ent,symlink_target,"},
+        CTX_STORAGEHINTS, 
+        DATAFILE_HANDLES_KEYSTR","METAFILE_DIST_KEYSTR","
+        DIRECTORY_ENTRY_KEYSTR","SYMLINK_TARGET_KEYSTR},
     
     /* The attribute cache in the TROVE layer mentioned in the documentation
      * for the AttrCacheKeywords option is managed as a hashtable.  The
@@ -626,19 +697,6 @@ static const configoption_t options[] =
     {"DefaultNumDFiles", ARG_INT, get_default_num_dfiles, NULL,
         CTX_FILESYSTEM,"0"},
 
-    /* Specifies the file system's key for use in HMAC-based digests of
-     * client operations.
-     */
-    {"SecretKey",ARG_STR, get_secret_key,NULL,CTX_FILESYSTEM,NULL},
-
-
-    /* This option specified that MetaData operations that have to sync
-     * (setattr, etc.) should try to coallesce the sync under larger
-     * workloads.
-     */
-    {"MetaDataSyncCoalesce", ARG_STR, get_metadata_sync_coalesce, NULL,
-        CTX_STORAGEHINTS, "yes"},
-
     {"ImmediateCompletion", ARG_STR, get_immediate_completion, NULL,
         CTX_STORAGEHINTS, "no"},
 
@@ -646,7 +704,12 @@ static const configoption_t options[] =
         CTX_STORAGEHINTS, "8"},
 
     {"CoalescingLowWatermark", ARG_INT, get_coalescing_low_watermark, NULL,
-        CTX_STORAGEHINTS, "2"},
+        CTX_STORAGEHINTS, "1"},
+
+    /* Specifies the file system's key for use in HMAC-based digests of
+     * client operations.
+     */
+    {"SecretKey",ARG_STR, get_secret_key,NULL,CTX_FILESYSTEM,NULL},
 
     LAST_OPTION
 };
@@ -1305,11 +1368,36 @@ DOTCONF_CB(get_handle_recycle_timeout_se
     return NULL;
 }
 
+static const char * replace_old_keystring(const char * oldkey)
+{
+    /* check for old keyval strings */
+    if(!strcmp(oldkey, "dir_ent"))
+    {
+        return "de";
+    }
+    else if(!strcmp(oldkey, "datafile_handles"))
+    {
+        return "dh";
+    }
+    else if(!strcmp(oldkey, "metafile_dist"))
+    {
+        return "md";
+    }
+    else if(!strcmp(oldkey, "symlink_target"))
+    {
+        return "st";
+    }
+
+    return oldkey;
+}
+
+
 DOTCONF_CB(get_attr_cache_keywords_list)
 {
     int i = 0, len = 0;
     char buf[512] = {0};
     char *ptr = buf;
+    const char * rtok;
     struct filesystem_configuration_s *fs_conf = NULL;
 
     struct server_configuration_s *config_s = 
@@ -1321,21 +1409,52 @@ DOTCONF_CB(get_attr_cache_keywords_list)
 
     if (fs_conf->attr_cache_keywords != NULL)
     {
-        len = strlen(fs_conf->attr_cache_keywords);
-        strncpy(ptr,fs_conf->attr_cache_keywords,len);
-        ptr += (len * sizeof(char));
-        if (*(ptr-1) != ',')
+        char ** tokens;
+        int token_count, j;
+        
+        token_count = PINT_split_string_list(
+            &tokens, fs_conf->attr_cache_keywords);
+
+        for(j = 0; j < token_count; ++j)
         {
-            *ptr = ',';
-            ptr++;
+            rtok = replace_old_keystring(tokens[j]);
+            if(!strstr(buf, rtok))
+            {
+                len = strlen(rtok);
+                strncat(ptr, rtok, len);
+                strncat(ptr, ",", 1);
+                ptr += len + 1;
+            }
         }
+                       
+        PINT_free_string_list(tokens, token_count);
         free(fs_conf->attr_cache_keywords);
     }
+
     for(i = 0; i < cmd->arg_count; i++)
     {
-        strncat(ptr, cmd->data.list[i], 512 - len);
-        len += strlen(cmd->data.list[i]);
+        char ** tokens;
+        int token_count, j;
+        
+        token_count = PINT_split_string_list(
+            &tokens, cmd->data.list[i]);
+
+        for(j = 0; j < token_count; ++j)
+        {
+            rtok = replace_old_keystring(tokens[j]);
+            if(!strstr(buf, rtok))
+            {
+                len = strlen(rtok);
+                strncat(ptr, rtok, len);
+                strncat(ptr, ",", 1);
+                ptr += len + 1;
+            }
+        }
+
+        PINT_free_string_list(tokens, token_count);
     }
+
+    *ptr = '\0';
     fs_conf->attr_cache_keywords = strdup(buf);
     return NULL;
 }
@@ -1722,28 +1841,6 @@ DOTCONF_CB(get_secret_key)
     return NULL;
 }
 
-DOTCONF_CB(get_metadata_sync_coalesce)
-{
-    struct server_configuration_s *config_s =
-        (struct server_configuration_s *)cmd->context;
-    struct filesystem_configuration_s *fs_conf = NULL;
-
-    fs_conf = (struct filesystem_configuration_s *)
-        PINT_llist_head(config_s->file_systems);
-
-    if(!strcmp((char *)cmd->data.str, "yes"))
-    {
-        fs_conf->metadata_sync_coalesce = 
-            (TROVE_DSPACE_SYNC_COALESCE | TROVE_KEYVAL_SYNC_COALESCE);
-    }
-    else
-    {
-        fs_conf->metadata_sync_coalesce = 0;
-    }
-
-    return NULL;
-}
-
 DOTCONF_CB(get_immediate_completion)
 {
     struct server_configuration_s *config_s =
@@ -3342,28 +3439,6 @@ int PINT_config_pvfs2_rmspace(
         }
     }
     return ret;
-}
-
-int PINT_config_get_trove_meta_flags(
-    struct server_configuration_s *config,
-    PVFS_fs_id fs_id)
-{
-    int flags = 0;
-    struct filesystem_configuration_s *fs_conf = NULL;
-
-    if(config)
-    {
-        fs_conf = PINT_config_find_fs_id(config, fs_id);
-    }
-    
-    if(fs_conf)
-    {
-        flags |= (fs_conf->immediate_completion ? 
-                  TROVE_IMMEDIATE_COMPLETION : 0);
-        flags |= fs_conf->metadata_sync_coalesce;
-    }
-
-    return flags;
 }
 
 /*

Index: server-config.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/server-config.h,v
diff -p -u -r1.48.10.2 -r1.48.10.3
--- server-config.h	7 Jun 2006 03:20:44 -0000	1.48.10.2
+++ server-config.h	9 Aug 2006 20:17:36 -0000	1.48.10.3
@@ -81,7 +81,6 @@ typedef struct filesystem_configuration_
     int attr_cache_max_num_elems;
     int trove_sync_meta;
     int trove_sync_data;
-    int metadata_sync_coalesce;
     int immediate_completion;
     int coalescing_high_watermark;
     int coalescing_low_watermark;
@@ -241,9 +240,6 @@ int PINT_config_get_trove_sync_meta(
     struct server_configuration_s *config,
     PVFS_fs_id fs_id);
 int PINT_config_get_trove_sync_data(
-    struct server_configuration_s *config,
-    PVFS_fs_id fs_id);
-int PINT_config_get_trove_meta_flags(
     struct server_configuration_s *config,
     PVFS_fs_id fs_id);
 #endif

Index: str-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/str-utils.c,v
diff -p -u -r1.17 -r1.17.12.1
--- str-utils.c	23 Aug 2005 18:44:17 -0000	1.17
+++ str-utils.c	9 Aug 2006 20:17:36 -0000	1.17.12.1
@@ -680,6 +680,134 @@ char *strstr(const char *haystack, const
 #endif
 
 /*
+ * PINT_split_keyvals()
+ *
+ * Splits a given string into a number of key:val strings.
+ *
+ * Parameters:
+ * The given string must be comma separated, and each
+ * segment within the comma regions must be of of
+ * the form key:val.
+ * Return the number of such keyval pairs and a 
+ * pointer to a double dimensional array of keys and values.
+ * In case of errors, a -ve PVFS error is returned.
+ *
+ * Example inputs and return values:
+ *
+ * NULL - return -PVFS_EINVAL
+ * ab:23 - return nkey as 1, pkey <"ab">, pval <"23">
+ * ab:23,bc:34 - returns nkey as 2, pkey <"ab", "bc">, pval<"23", "34">
+ *
+ */
+int PINT_split_keyvals(char *string, int *nkey, 
+        char ***pkey, char ***pval)
+{
+    char **key, **val, *ptr, *params;
+    int nparams = 0, i;
+
+    if (string == NULL || nkey == NULL 
+            || pkey == NULL || pval == NULL)
+    {
+      return -PVFS_EINVAL;
+    }
+    params = strdup(string);
+    if (params == NULL)
+    {
+      return -PVFS_ENOMEM;
+    }
+    ptr = params;
+    while (ptr)
+    {
+        if (*ptr != ',' || *ptr != '\0')
+                 nparams++;
+        ptr++;
+        ptr = strchr(ptr, ',');
+    }
+    if (nparams == 0)
+    {
+      free(params);
+      return -PVFS_EINVAL;
+    }
+    ptr = params;
+    key = (char **) calloc(nparams, sizeof(char *));
+    val = (char **) calloc(nparams, sizeof(char *));
+    if (key == NULL || val ==  NULL)
+    {
+      free(key);
+      free(val);
+      free(params);
+      return -PVFS_ENOMEM;
+    }
+    for (i = 0; i < nparams; i++)
+    {
+        char *ptr2;
+        if (i > 0 && ptr)
+        {
+            *ptr = '\0';
+            ptr++;
+        }
+        else if (ptr == NULL)
+        {
+            break;
+        }
+        ptr2 = strchr(ptr, ':');
+        if (ptr2 == NULL)
+        {
+            break;
+        }
+        key[i] = ptr;
+        ptr = strchr(ptr, ',');
+        if (ptr != NULL && ptr < ptr2)
+        {
+            break;
+        }
+        *ptr2 = '\0';
+        val[i] = ptr2 + 1;
+    }
+    if (i != nparams)
+    {
+      free(key);
+      free(val);
+      free(params);
+      return -PVFS_EINVAL;
+    }
+    else
+    {
+      for (i = 0; i < nparams; i++)
+      {
+          char *ptr1, *ptr2;
+          ptr1 = strdup(key[i]);
+          ptr2 = strdup(val[i]);
+          if (ptr1 == NULL || ptr2 == NULL)
+              break;
+          if (strchr(ptr1, ':') || strchr(ptr2, ':'))
+              break;
+          key[i] = ptr1;
+          val[i] = ptr2;
+      }
+      if (i != nparams)
+      {
+          int j;
+          for (j = 0; j < i; j++)
+          {
+              if (key[j]) free(key[j]);
+              if (val[j]) free(val[j]);
+          }
+          free(key);
+          free(val);
+          free(params);
+          return -PVFS_EINVAL;
+      }
+      free(params);
+      *nkey = nparams;
+      *pkey = key;
+      *pval = val;
+      return 0;
+    }
+}
+
+
+/*
  * Local variables:
  *  c-indent-level: 4
  *  c-basic-offset: 4

Index: str-utils.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/str-utils.h,v
diff -p -u -r1.15 -r1.15.12.1
--- str-utils.h	23 Aug 2005 18:44:17 -0000	1.15
+++ str-utils.h	9 Aug 2006 20:17:37 -0000	1.15.12.1
@@ -60,6 +60,8 @@ size_t strnlen(const char *s, size_t lim
 char *strstr(const char *haystack, const char *needle);
 #endif
 
+int PINT_split_keyvals(char *string, int *nkey, 
+        char ***pkey, char ***pval);
 #endif
 /*
  * Local variables:

Index: tcache.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/tcache.c,v
diff -p -u -r1.5.2.1 -r1.5.2.2
--- tcache.c	7 Jun 2006 03:20:44 -0000	1.5.2.1
+++ tcache.c	9 Aug 2006 20:17:37 -0000	1.5.2.2
@@ -13,14 +13,15 @@
  *  \ingroup tcache
  * Implementation of the Timeout Cache (tcache) component.
  */
-
-#define TCACHE_DEFAULT_TIMEOUT_MSECS    4000
-#define TCACHE_DEFAULT_EXPIRATION_ENABLED  1
-#define TCACHE_DEFAULT_SOFT_LIMIT       5120
-#define TCACHE_DEFAULT_HARD_LIMIT      10240
-#define TCACHE_DEFAULT_RECLAIM_PERCENTAGE 25
-#define TCACHE_DEFAULT_TABLE_SIZE       1019 
-#define TCACHE_DEFAULT_REPLACE_ALGORITHM   LEAST_RECENTLY_USED
+enum {
+TCACHE_DEFAULT_TIMEOUT_MSECS   = 4000,
+TCACHE_DEFAULT_EXPIRATION_ENABLED = 1,
+TCACHE_DEFAULT_SOFT_LIMIT     =  5120,
+TCACHE_DEFAULT_HARD_LIMIT     = 10240,
+TCACHE_DEFAULT_RECLAIM_PERCENTAGE = 25,
+TCACHE_DEFAULT_TABLE_SIZE     =  1019,
+TCACHE_DEFAULT_REPLACE_ALGORITHM  = LEAST_RECENTLY_USED,
+};
 
 static int check_expiration(
     struct PINT_tcache* tcache,
@@ -100,7 +101,7 @@ void PINT_tcache_finalize(
                 hash_link);
             assert(tmp_entry);
 
-            PINT_tcache_purge(tcache, tmp_entry);
+            PINT_tcache_delete(tcache, tmp_entry);
         }
     }
 
@@ -267,14 +268,14 @@ int PINT_tcache_insert_entry(
     struct PINT_tcache* tcache, /**< pointer to tcache instance */
     void* key,                  /**< that uniquely identifies the payload */
     void* payload,              /**< data to store in the cache */
-    int* removed)               /**< number of entries removed to make room */
+    int* purged)                /**< number of entries purged to make room */
 {
     struct PINT_tcache_entry* tmp_entry = NULL;
     int tmp_status = 0;
     int ret = -1;
 
-    *removed = 0;
-
+    *purged = 0;
+  
     if(tcache->enable == 0)
     {
         /* cache has been disabled, do nothing except discard payload*/
@@ -286,7 +287,7 @@ int PINT_tcache_insert_entry(
     if(tcache->num_entries >= tcache->soft_limit)
     {
         /* try to reclaim some entries */
-        ret = PINT_tcache_reclaim(tcache, removed);
+        ret = PINT_tcache_reclaim(tcache, purged);
         if(ret < 0)
         {
             return(ret);
@@ -313,12 +314,12 @@ int PINT_tcache_insert_entry(
         /* we don't care about the status- we need to remove an entry
          * regardless
          */
-        ret = PINT_tcache_purge(tcache, tmp_entry);
+        ret = PINT_tcache_delete(tcache, tmp_entry);
         if(ret < 0)
         {
             return(ret);
         }
-        *removed = 1;
+        *purged = 1;
     }
 
     /* create new entry */
@@ -419,7 +420,7 @@ int tcache_lookup_oldest(
 }
 
 /**
- * Tries to remove and destroy expired entries, up to
+ * Tries to purge and destroy expired entries, up to
  * TCACHE_RECLAIM_PERCENTAGE of the current soft limit value.  The
  * payload_free() function is used to destroy the payload associated with
  * reclaimed entries. 
@@ -431,7 +432,7 @@ int PINT_tcache_reclaim(
 {
     struct qlist_head *iterator = NULL, *scratch = NULL;
     struct PINT_tcache_entry* tmp_entry;
-    int entries_to_remove = (tcache->reclaim_percentage *
+    int entries_to_purge = (tcache->reclaim_percentage *
         tcache->soft_limit)/100; 
     int status = 0;
     int ret;
@@ -460,17 +461,17 @@ int PINT_tcache_reclaim(
             break;
         }
 
-        /* remove entry otherwise */
-        ret = PINT_tcache_purge(tcache, tmp_entry);
+        /* delete entry otherwise */
+        ret = PINT_tcache_delete(tcache, tmp_entry);
         if(ret < 0)
         {
             return(ret);
         }
-        entries_to_remove--;
+        entries_to_purge--;
         (*reclaimed)++;
         
         /* break if we hit percentage cap */
-        if(entries_to_remove <= 0)
+        if(entries_to_purge <= 0)
         {
             break;
         }
@@ -484,7 +485,7 @@ int PINT_tcache_reclaim(
  * will be used to destroy payload data.
  * \return 0 on success, -PVFS_error on failure
  */
-int PINT_tcache_purge(
+int PINT_tcache_delete(
     struct PINT_tcache* tcache,      /**< pointer to tcache instance */
     struct PINT_tcache_entry* entry) /**< entry to remove and destroy */
 {

Index: tcache.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/common/misc/tcache.h,v
diff -p -u -r1.2 -r1.2.2.1
--- tcache.h	4 Apr 2006 04:47:11 -0000	1.2
+++ tcache.h	9 Aug 2006 20:17:37 -0000	1.2.2.1
@@ -31,10 +31,12 @@
  * payload.
  * .
  * Terminology:
- * - PURGE: Process of removing and delete a single entry from the CACHE
+ * - DELETE: Process of removing a specific entry at the request of the caller
+ * - PURGE: Process of removing an entry because there is not enough room in
+ *   the cache (see RECLAIM)
  * - EXPIRED: CACHE entry that is older than CACHE_TIMEOUT_MSECS and is
  *   still in the CACHE
- * - RECLAIM: Process of removing up to CACHE_RECLAIM_PERCENTAGE
+ * - RECLAIM: Process of purging up to CACHE_RECLAIM_PERCENTAGE
  *   entries from the CACHE that are EXPIRED
  * - REFRESH: Process of updating an existing entry in cache with a
  *   new CACHE_TIMEOUT_MSECS
@@ -150,7 +152,7 @@ int PINT_tcache_insert_entry(
     struct PINT_tcache* tcache,
     void* key,
     void* payload,
-    int* removed);
+    int* purged);
 
 int PINT_tcache_lookup(
     struct PINT_tcache* tcache,
@@ -162,7 +164,7 @@ int PINT_tcache_reclaim(
     struct PINT_tcache* tcache,
     int* reclaimed);
 
-int PINT_tcache_purge(
+int PINT_tcache_delete(
     struct PINT_tcache* tcache,
     struct PINT_tcache_entry* entry);
 



More information about the Pvfs2-cvs mailing list