? mult.diff
? mult.patch
? mult2.patch
? mult3.patch
? src/proto/.endecode-funcs.h.swp
? src/proto/.pvfs2-req-proto.h.swp
Index: include/pvfs2-types.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/include/pvfs2-types.h,v
retrieving revision 1.139
diff -u -a -p -r1.139 pvfs2-types.h
--- include/pvfs2-types.h	9 Dec 2006 16:23:32 -0000	1.139
+++ include/pvfs2-types.h	14 Mar 2007 22:21:19 -0000
@@ -122,14 +122,14 @@ typedef uint64_t PVFS_handle;
  *  PVFS2 file systems reachable by a given client.
  */
 typedef int32_t PVFS_fs_id;
-typedef int32_t PVFS_ds_position;
+typedef uint64_t PVFS_ds_position;
 typedef int32_t PVFS_ds_flags;
 #define encode_PVFS_handle encode_uint64_t
 #define decode_PVFS_handle decode_uint64_t
 #define encode_PVFS_fs_id encode_int32_t
 #define decode_PVFS_fs_id decode_int32_t
-#define decode_PVFS_ds_position decode_int32_t
-#define encode_PVFS_ds_position encode_int32_t
+#define decode_PVFS_ds_position decode_uint64_t
+#define encode_PVFS_ds_position encode_uint64_t
 
 /* Basic types used within metadata. */
 typedef uint32_t PVFS_uid;
Index: src/client/sysint/sys-list-eattr.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-list-eattr.sm,v
retrieving revision 1.6
diff -u -a -p -r1.6 sys-list-eattr.sm
--- src/client/sysint/sys-list-eattr.sm	17 Feb 2007 21:16:45 -0000	1.6
+++ src/client/sysint/sys-list-eattr.sm	14 Mar 2007 22:21:19 -0000
@@ -224,7 +224,7 @@ static int list_eattr_comp_fn(
     else
     {
         gossip_debug(GOSSIP_LISTEATTR_DEBUG,"listeattr returned %d keys\n",
-                sm_p->u.listeattr.resp_p->token);
+                sm_p->u.listeattr.resp_p->nkey);
         /* Copy the token and reset it */
         sm_p->u.listeattr.resp_p->nkey = sm_p->u.listeattr.resp_p->token;
         sm_p->u.listeattr.resp_p->token = PVFS_ITERATE_START;
Index: src/client/sysint/sys-readdir.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-readdir.sm,v
retrieving revision 1.49
diff -u -a -p -r1.49 sys-readdir.sm
--- src/client/sysint/sys-readdir.sm	17 Feb 2007 21:16:45 -0000	1.49
+++ src/client/sysint/sys-readdir.sm	14 Mar 2007 22:21:20 -0000
@@ -239,10 +239,10 @@ static int readdir_msg_setup_msgpair(PIN
     gossip_debug(GOSSIP_READDIR_DEBUG," readdir: posting readdir req\n");
 
     gossip_debug(
-        GOSSIP_READDIR_DEBUG, "%llu|%d | token is %d | limit is %d\n",
+        GOSSIP_READDIR_DEBUG, "%llu|%d | token is %llu | limit is %d\n",
         llu(sm_p->object_ref.handle),
         sm_p->object_ref.fs_id,
-        sm_p->readdir.pos_token,
+        llu(sm_p->readdir.pos_token),
         sm_p->readdir.dirent_limit);
 
     PINT_init_msgpair(sm_p, msg_p);
Index: src/common/misc/fsck-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/fsck-utils.c,v
retrieving revision 1.2
diff -u -a -p -r1.2 fsck-utils.c
--- src/common/misc/fsck-utils.c	9 Dec 2006 16:23:52 -0000	1.2
+++ src/common/misc/fsck-utils.c	14 Mar 2007 22:21:20 -0000
@@ -1080,7 +1080,7 @@ static int PINT_handle_wrangler_load_han
     PVFS_handle **handle_matrix = NULL;
     int i = 0;
     int *handle_count_array = NULL;
-    int *position_array = NULL;
+    PVFS_ds_position *position_array = NULL;
     int more_handles = 0;
     int err = 0;
 
@@ -1152,7 +1152,8 @@ static int PINT_handle_wrangler_load_han
         goto load_handles_error;
     }
 
-    position_array = (int *) calloc(server_count, sizeof(int));
+    position_array = (PVFS_ds_position *) calloc(server_count, 
+                                                 sizeof(PVFS_ds_position));
     if (position_array == NULL)
     {        
         ret = -PVFS_ENOMEM;
Index: src/io/trove/trove-dbpf/dbpf-dspace.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-dspace.c,v
retrieving revision 1.145
diff -u -a -p -r1.145 dbpf-dspace.c
--- src/io/trove/trove-dbpf/dbpf-dspace.c	9 Mar 2007 21:13:23 -0000	1.145
+++ src/io/trove/trove-dbpf/dbpf-dspace.c	14 Mar 2007 22:21:20 -0000
@@ -19,6 +19,7 @@
 #include "gossip.h"
 #include "pint-perf-counter.h"
 #include "pint-event.h"
+#include "pint-mem.h"
 #include "trove-internal.h"
 #include "trove-ledger.h"
 #include "trove-handle-mgmt.h"
@@ -30,6 +31,7 @@
 #include "dbpf-attr-cache.h"
 #include "dbpf-open-cache.h"
 
+
 #ifdef __PVFS2_TROVE_THREADED__
 #include <pthread.h>
 #include "dbpf-thread.h"
@@ -47,18 +49,6 @@ extern struct qlist_head dbpf_op_queue;
 extern gen_mutex_t dbpf_op_queue_mutex;
 #endif
 extern gen_mutex_t dbpf_attr_cache_mutex;
-/* Union used by the dspace_iterate_handles call.  The berkeley db
- * cursor->get(SET_RECNO) call, which sets the position of the cursor
- * based on record number, expects the key.data to be a db_recno_t
- * going in, but fills in the actual key value (in this case a TROVE_handle)
- * on the way out.
- */
-union dbpf_dspace_recno_handle_key
-{
-    db_recno_t recno;
-    TROVE_handle handle;
-};
-
 
 int64_t s_dbpf_metadata_writes = 0, s_dbpf_metadata_reads = 0;
 
@@ -534,9 +524,13 @@ static int dbpf_dspace_iterate_handles_o
     int ret = -TROVE_EINVAL, i = 0;
     DBC *dbc_p = NULL;
     DBT key, data;
-    union dbpf_dspace_recno_handle_key recno_key;
+    void * multiples_buffer = NULL;
     TROVE_ds_storedattr_s s_attr;
-    TROVE_handle dummy_handle = TROVE_HANDLE_NULL;
+    TROVE_handle dummy_handle;
+    size_t sizeof_handle = 0, sizeof_attr = 0;
+    int start_size;
+    void *tmp_ptr;
+    uint32_t dbpagesize;
 
     if (*op_p->u.d_iterate_handles.position_p == TROVE_ITERATE_END)
     {
@@ -571,10 +565,9 @@ static int dbpf_dspace_iterate_handles_o
          * well, so that we can use the same loop below to read the
          * remainder in this or the above case.
          */
-        recno_key.recno = (*op_p->u.d_iterate_handles.position_p);
         memset(&key, 0, sizeof(key));
-        key.data  = &recno_key;
-        key.size  = key.ulen = sizeof(recno_key);
+        key.data  = op_p->u.d_iterate_handles.position_p;
+        key.size  = key.ulen = sizeof(TROVE_handle);
         key.flags |= DB_DBT_USERMEM;
 
         memset(&data, 0, sizeof(data));
@@ -582,7 +575,7 @@ static int dbpf_dspace_iterate_handles_o
         data.size = data.ulen = sizeof(s_attr);
         data.flags |= DB_DBT_USERMEM;
 
-        ret = dbc_p->c_get(dbc_p, &key, &data, DB_SET_RECNO);
+        ret = dbc_p->c_get(dbc_p, &key, &data, DB_SET_RANGE);
         if (ret == DB_NOTFOUND)
         {
             goto return_ok;
@@ -590,36 +583,100 @@ static int dbpf_dspace_iterate_handles_o
         else if (ret != 0)
         {
             ret = -dbpf_db_error_to_trove_error(ret);
-            gossip_err("failed to set cursor position at recno: %u\n",
-                       recno_key.recno);
+            gossip_err("failed to set cursor position at handle: %llu\n",
+                       llu(*(TROVE_handle *)op_p->u.d_iterate_handles.position_p));
             goto return_error;
         }
     }
 
-    /* read handles until we run out of handles or space in buffer */
-    for (i = 0; i < *op_p->u.d_iterate_handles.count_p; i++)
+    start_size = ((sizeof(TROVE_handle) + sizeof(s_attr)) *
+                  *op_p->u.d_iterate_handles.count_p);
+    /* round up to the nearest 1024 */
+    start_size = (start_size + 1023) & (~(unsigned long)1023);
+
+    ret = op_p->coll_p->ds_db->get_pagesize(op_p->coll_p->ds_db, &dbpagesize);
+
+    multiples_buffer = PINT_mem_aligned_alloc(start_size, dbpagesize);
+    if(!multiples_buffer)
     {
-        memset(&key, 0, sizeof(key));
-        key.data = &op_p->u.d_iterate_handles.handle_array[i];
-        key.size = key.ulen = sizeof(TROVE_handle);
-        key.flags |= DB_DBT_USERMEM;
+        ret = -TROVE_ENOMEM;
+        goto return_error;
+    }
 
-        memset(&data, 0, sizeof(data));
-        data.data = &s_attr;
-        data.size = data.ulen = sizeof(s_attr);
-        data.flags |= DB_DBT_USERMEM;
+    key.data = &dummy_handle;
+    key.size = key.ulen = sizeof(TROVE_handle);
+    key.flags = DB_DBT_USERMEM;
 
-        ret = dbc_p->c_get(dbc_p, &key, &data, DB_NEXT);
-        if (ret == DB_NOTFOUND)
+    data.data = multiples_buffer;
+    data.size = data.ulen = start_size;
+    data.flags = DB_DBT_USERMEM;
+
+    i = 0;
+    while(i < *op_p->u.d_iterate_handles.count_p)
+    {
+        ret = dbc_p->c_get(dbc_p, &key, &data, DB_MULTIPLE_KEY|DB_NEXT);
+        if(ret == DB_BUFFER_SMALL)
+        {
+            /* need to allocate more and try again */
+            free(multiples_buffer);
+            multiples_buffer = PINT_mem_aligned_alloc(data.size, dbpagesize);
+            if(!multiples_buffer)
+            {
+                ret = -TROVE_ENOMEM;
+                goto return_error;
+            }
+            data.data = multiples_buffer;
+            data.ulen = data.size;
+
+            ret = dbc_p->c_get(dbc_p, &key, &data, DB_MULTIPLE_KEY|DB_NEXT);
+        }
+
+        if(ret == DB_NOTFOUND)
         {
             goto return_ok;
         }
-        else if (ret != 0)
+
+        if(ret < 0)
         {
             ret = -dbpf_db_error_to_trove_error(ret);
             gossip_err("c_get failed on iteration %d\n", i);
             goto return_error;
         }
+
+        DB_MULTIPLE_INIT(tmp_ptr, &data);
+
+        /* read handles until we run out of handles or space in buffer */
+        for (; i < *op_p->u.d_iterate_handles.count_p; i++)
+        {
+            void *tmp_handle;
+            void *tmp_attr;
+
+            /* the semantics of this macro are a little odd.  after
+             * it returns, tmp_handle points into the data buffer
+             * (multiples_buffer) at the location of the key, so the
+             * pointer value of tmp_buffer actually changes, and it
+             * must be derefenced to get the handle value.
+             */
+            DB_MULTIPLE_KEY_NEXT(tmp_ptr, &data,
+                                 tmp_handle, sizeof_handle,
+                                 tmp_attr, sizeof_attr);
+            if(!tmp_ptr)
+            {
+                break;
+            }
+
+            /* verify sizes are correct */
+            if(sizeof_handle != sizeof(TROVE_handle) ||
+               sizeof_attr != sizeof(s_attr))
+            {
+                /* something is wrong with the result */
+                ret = -TROVE_EINVAL;
+                goto return_error;
+            }
+
+            op_p->u.d_iterate_handles.handle_array[i] =
+                *(TROVE_handle *)tmp_handle;
+        }
     }
 
   return_ok:
@@ -630,7 +687,6 @@ static int dbpf_dspace_iterate_handles_o
     }
     else
     {
-        db_recno_t recno;
         /* get the record number to return.
          *
          * note: key field is ignored by c_get in this case
@@ -641,11 +697,11 @@ static int dbpf_dspace_iterate_handles_o
         key.flags |= DB_DBT_USERMEM;
 
         memset(&data, 0, sizeof(data));
-        data.data = &recno;
-        data.size = data.ulen = sizeof(recno);
+        data.data = &s_attr;
+        data.size = data.ulen = sizeof(s_attr);
         data.flags |= DB_DBT_USERMEM;
 
-        ret = dbc_p->c_get(dbc_p, &key, &data, DB_GET_RECNO);
+        ret = dbc_p->c_get(dbc_p, &key, &data, DB_CURRENT);
         if (ret == DB_NOTFOUND)
         {
             gossip_debug(GOSSIP_TROVE_DEBUG, "iterate -- notfound\n");
@@ -656,7 +712,7 @@ static int dbpf_dspace_iterate_handles_o
                          "failure @ recno\n");
             ret = -dbpf_db_error_to_trove_error(ret);
         }
-        *op_p->u.d_iterate_handles.position_p = recno;
+        *op_p->u.d_iterate_handles.position_p = dummy_handle;
     }
     /* 'position' points to record we just read, or is set to END */
 
@@ -667,6 +723,11 @@ static int dbpf_dspace_iterate_handles_o
         dbc_p->c_close(dbc_p);
     }
 
+    if(multiples_buffer)
+    {
+        PINT_mem_aligned_free(multiples_buffer);
+    }
+
     return 1;
 
 return_error:
@@ -678,6 +739,11 @@ return_error:
         dbc_p->c_close(dbc_p);
     }
 
+    if(multiples_buffer)
+    {
+        PINT_mem_aligned_free(multiples_buffer);
+    }
+
     return ret;
 }
 
@@ -1727,7 +1793,7 @@ static int dbpf_dspace_testsome(
     return ((out_count > 0) ? 1 : 0);
 }
 
-int PINT_trove_dbpf_ds_attr_compare(
+int PINT_trove_dbpf_ds_attr_compare_reversed(
     DB * dbp, const DBT * a, const DBT * b)
 {
     const TROVE_handle * handle_a;
@@ -1742,6 +1808,23 @@ int PINT_trove_dbpf_ds_attr_compare(
     }
 
     return (*handle_a < *handle_b) ? -1 : 1;
+}
+
+int PINT_trove_dbpf_ds_attr_compare(
+    DB * dbp, const DBT * a, const DBT * b)
+{
+    const TROVE_handle * handle_a;
+    const TROVE_handle * handle_b;
+
+    handle_a = (const TROVE_handle *) a->data;
+    handle_b = (const TROVE_handle *) b->data;
+
+    if(*handle_a == *handle_b)
+    {
+        return 0;
+    }
+
+    return (*handle_a > *handle_b) ? -1 : 1;
 }
 
 struct TROVE_dspace_ops dbpf_dspace_ops =
Index: src/io/trove/trove-dbpf/dbpf-keyval-pcache.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-keyval-pcache.c,v
retrieving revision 1.5
diff -u -a -p -r1.5 dbpf-keyval-pcache.c
--- src/io/trove/trove-dbpf/dbpf-keyval-pcache.c	16 Aug 2006 01:23:19 -0000	1.5
+++ src/io/trove/trove-dbpf/dbpf-keyval-pcache.c	14 Mar 2007 22:21:20 -0000
@@ -154,15 +154,15 @@ int PINT_dbpf_keyval_pcache_lookup(
         {
             gossip_debug(GOSSIP_DBPF_KEYVAL_DEBUG,
                          "Trove KeyVal pcache NOTFOUND: "
-                         "handle: %llu, pos: %d\n",
-                         llu(handle), pos);
+                         "handle: %llu, pos: %llu\n",
+                         llu(handle), llu(pos));
         }
         else
         {
             gossip_debug(GOSSIP_DBPF_KEYVAL_DEBUG,
                          "Trove KeyVal pcache failed: (error %d): "
-                         "handle: %llu, pos: %d\n",
-                         ret, llu(handle), pos);
+                         "handle: %llu, pos: %llu\n",
+                         ret, llu(handle), llu(pos));
         }
 
         gen_mutex_unlock(pcache->mutex);
@@ -175,8 +175,8 @@ int PINT_dbpf_keyval_pcache_lookup(
 
     gossip_debug(GOSSIP_DBPF_KEYVAL_DEBUG,
                  "Trove KeyVal pcache lookup succeeded: "
-                 "handle: %llu, pos: %d, key: %*s\n",
-                 llu(handle), pos, *length, (char *) *keyname);
+                 "handle: %llu, pos: %llu, key: %*s\n",
+                 llu(handle), llu(pos), *length, (char *) *keyname);
 
     return 0;
 }
@@ -225,8 +225,8 @@ int PINT_dbpf_keyval_pcache_insert( 
     {
         gossip_debug(GOSSIP_DBPF_KEYVAL_DEBUG,
                      "Trove KeyVal pcache insert failed: (error: %d) "
-                     "handle: %llu, pos: %d: key: %*s\n",
-                     ret, llu(handle), pos, length, keyname);
+                     "handle: %llu, pos: %llu: key: %*s\n",
+                     ret, llu(handle), llu(pos), length, keyname);
 
         gen_mutex_unlock(pcache->mutex);
         free(entry);
@@ -236,8 +236,8 @@ int PINT_dbpf_keyval_pcache_insert( 
 
     gossip_debug(GOSSIP_DBPF_KEYVAL_DEBUG,
                  "Trove KeyVal pcache insert succeeded: "
-                 "handle: %llu, pos: %d: key: %*s\n",
-                 llu(handle), pos, length, keyname);
+                 "handle: %llu, pos: %llu: key: %*s\n",
+                 llu(handle), llu(pos), length, keyname);
 
     return 0;
 }
Index: src/io/trove/trove-dbpf/dbpf-keyval.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-keyval.c,v
retrieving revision 1.82
diff -u -a -p -r1.82 dbpf-keyval.c
--- src/io/trove/trove-dbpf/dbpf-keyval.c	9 Mar 2007 21:13:23 -0000	1.82
+++ src/io/trove/trove-dbpf/dbpf-keyval.c	14 Mar 2007 22:21:20 -0000
@@ -677,10 +677,10 @@ static int dbpf_keyval_iterate_op_svc(st
 
     gossip_debug(GOSSIP_DBPF_KEYVAL_DEBUG,
                   "dbpf_keyval_iterate_op_svc: starting: fsid: %u, "
-                  "handle: %llu, pos: %u\n", 
+                  "handle: %llu, pos: %llu\n", 
                  op_p->coll_p->coll_id, 
                  llu(op_p->handle),
-                 *op_p->u.k_iterate.position_p);
+                 llu(*op_p->u.k_iterate.position_p));
     
     /* if they passed in that they are at the end, return 0.
      * this seems silly maybe, but it makes while (count) loops
@@ -737,8 +737,8 @@ static int dbpf_keyval_iterate_op_svc(st
 
     gossip_debug(GOSSIP_DBPF_KEYVAL_DEBUG, 
                  "dbpf_keyval_iterate_op_svc: finished: "
-                 "position: %d, count: %d\n", 
-                 *op_p->u.k_iterate.position_p, *op_p->u.k_iterate.count_p);
+                 "position: %llu, count: %d\n", 
+                 llu(*op_p->u.k_iterate.position_p), *op_p->u.k_iterate.count_p);
 
     return 1;
 }
Index: src/io/trove/trove-dbpf/dbpf-mgmt.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-mgmt.c,v
retrieving revision 1.97
diff -u -a -p -r1.97 dbpf-mgmt.c
--- src/io/trove/trove-dbpf/dbpf-mgmt.c	28 Nov 2006 20:09:18 -0000	1.97
+++ src/io/trove/trove-dbpf/dbpf-mgmt.c	14 Mar 2007 22:21:20 -0000
@@ -72,7 +72,7 @@ DB_ENV *dbpf_getdb_env(const char *path,
         *error = -EINVAL;
         return NULL;
     }
-  
+
     /* we start by making sure any old environment remnants are cleaned up */
     ret = db_env_create(&dbenv, 0);
     if (ret != 0) 
@@ -135,12 +135,12 @@ retry:
     {
         /* default to using shm style cache */
         gossip_debug(GOSSIP_TROVE_DEBUG, "dbpf using shm key: %d\n",
-            (646567223+TROVE_shm_key_hint));
+                     (646567223+TROVE_shm_key_hint));
         ret = dbenv->set_shm_key(dbenv, (646567223+TROVE_shm_key_hint));
         if(ret != 0)
         {
             gossip_err("dbenv->set_shm_key(%s): %s\n",
-                        path, db_strerror(ret));
+                       path, db_strerror(ret));
             *error = ret;
             return NULL;
         }
@@ -200,9 +200,9 @@ retry:
         {
             gossip_err("dbpf_getdb_env(): DB_RUNRECOVERY on environment open.\n");
             gossip_err(
-            "\n\n"
-            "    Please make sure that you have not chosen a DBCacheSizeBytes\n"
-            "    configuration file value that is too large for your machine.\n\n"); 
+                "\n\n"
+                "    Please make sure that you have not chosen a DBCacheSizeBytes\n"
+                "    configuration file value that is too large for your machine.\n\n"); 
         }
 
         if(ret != 0)
@@ -250,10 +250,13 @@ int dbpf_putdb_env(DB_ENV *dbenv, const 
     return 0;
 }
 
-static int dbpf_db_create(const char *sto_path, char *dbname, DB_ENV *envp);
+static int dbpf_db_create(const char *sto_path, 
+                          char *dbname, 
+                          DB_ENV *envp, 
+                          uint32_t flags);
 static DB *dbpf_db_open(
     const char *sto_path, char *dbname, DB_ENV *envp, int *err_p,
-    int (*compare_fn) (DB *db, const DBT *dbt1, const DBT *dbt2));
+    int (*compare_fn) (DB *db, const DBT *dbt1, const DBT *dbt2), uint32_t flags);
 static int dbpf_mkpath(char *pathname, mode_t mode);
 
 
@@ -280,36 +283,36 @@ int dbpf_collection_getinfo(TROVE_coll_i
     switch(opt)
     {
         case PVFS_COLLECTION_STATFS:
-        {
-            char path_name[PATH_MAX] = {0};
-            PINT_statfs_t tmp_statfs;
-            TROVE_statfs *tmp_trove_statfs = (TROVE_statfs *)parameter;
-
-            DBPF_GET_STORAGE_DIRNAME(path_name, PATH_MAX, sto_p->name);
-            ret = PINT_statfs_lookup(path_name, &tmp_statfs);
-            if (ret < 0)
             {
-                ret = -trove_errno_to_trove_error(errno);
-                return ret;
-            }
-            tmp_trove_statfs->fs_id = coll_id;
+                char path_name[PATH_MAX] = {0};
+                PINT_statfs_t tmp_statfs;
+                TROVE_statfs *tmp_trove_statfs = (TROVE_statfs *)parameter;
+
+                DBPF_GET_STORAGE_DIRNAME(path_name, PATH_MAX, sto_p->name);
+                ret = PINT_statfs_lookup(path_name, &tmp_statfs);
+                if (ret < 0)
+                {
+                    ret = -trove_errno_to_trove_error(errno);
+                    return ret;
+                }
+                tmp_trove_statfs->fs_id = coll_id;
 
-            /*
-              NOTE: use f_bavail instead of f_bfree here.  see 'man
-              statfs' for more information.  it would be ideal to pass
-              both so that the client can properly compute all values.
-            */
-            tmp_trove_statfs->bytes_available = 
-                (PINT_statfs_bsize(&tmp_statfs) * 
-                 PINT_statfs_bavail(&tmp_statfs));
-            tmp_trove_statfs->bytes_total =
-                (PINT_statfs_bsize(&tmp_statfs) *
-                 (PINT_statfs_blocks(&tmp_statfs) -
-                  (PINT_statfs_bfree(&tmp_statfs) -
-                  PINT_statfs_bavail(&tmp_statfs))));
+                /*
+NOTE: use f_bavail instead of f_bfree here.  see 'man
+statfs' for more information.  it would be ideal to pass
+both so that the client can properly compute all values.
+*/
+                tmp_trove_statfs->bytes_available = 
+                    (PINT_statfs_bsize(&tmp_statfs) * 
+                     PINT_statfs_bavail(&tmp_statfs));
+                tmp_trove_statfs->bytes_total =
+                    (PINT_statfs_bsize(&tmp_statfs) *
+                     (PINT_statfs_blocks(&tmp_statfs) -
+                      (PINT_statfs_bfree(&tmp_statfs) -
+                       PINT_statfs_bavail(&tmp_statfs))));
 
-            return 1;
-        }
+                return 1;
+            }
     }
     return ret;
 }
@@ -321,11 +324,11 @@ int dbpf_collection_setinfo(TROVE_method
                             void *parameter)
 {
     int ret = -TROVE_EINVAL;
-	struct dbpf_collection* coll;
-	coll = dbpf_collection_find_registered(coll_id);
-	
-	assert(coll);
-	
+    struct dbpf_collection* coll;
+    coll = dbpf_collection_find_registered(coll_id);
+
+    assert(coll);
+
     switch(option)
     {
         case TROVE_COLLECTION_HANDLE_RANGES:
@@ -531,7 +534,7 @@ static int dbpf_initialize(char *stoname
     }
 
     my_storage_p = sto_p;
-    
+
     dbpf_open_cache_initialize();
 
     return dbpf_thread_initialize();
@@ -610,18 +613,18 @@ int dbpf_storage_create(char *stoname,
     }
 
     DBPF_GET_STO_ATTRIB_DBNAME(sto_attrib_dbname, PATH_MAX, stoname);
-    ret = dbpf_db_create(storage_dirname, sto_attrib_dbname, NULL);
+    ret = dbpf_db_create(storage_dirname, sto_attrib_dbname, NULL, 0);
     if (ret != 0)
     {
         return ret;
     }
-    
+
     DBPF_GET_COLLECTIONS_DBNAME(collections_dbname, PATH_MAX, stoname);
-    ret = dbpf_db_create(storage_dirname, collections_dbname, NULL);
+    ret = dbpf_db_create(storage_dirname, collections_dbname, NULL, DB_RECNUM);
     if (ret != 0)
     {
-	gossip_lerr("dbpf_storage_create: removing storage attribute database after failed create attempt");
-	unlink(sto_attrib_dbname);
+        gossip_lerr("dbpf_storage_create: removing storage attribute database after failed create attempt");
+        unlink(sto_attrib_dbname);
         return ret;
     }
 
@@ -659,7 +662,7 @@ int dbpf_storage_remove(char *stoname,
         ret = -trove_errno_to_trove_error(errno);
         goto storage_remove_failure;
     }
-    
+
     DBPF_GET_STORAGE_DIRNAME(path_name, PATH_MAX, stoname);
     if (rmdir(path_name) != 0)
     {
@@ -673,19 +676,19 @@ int dbpf_storage_remove(char *stoname,
 
     return 1;
 
-  storage_remove_failure:
+storage_remove_failure:
     return ret;
 }
 
 /*
-  1) check collections database to see if coll_id is already used
-     (error out if so)
-  2) create collection attribute database
-  3) store trove-dbpf version in collection attribute database
-  4) store last handle value in collection attribute database
-  5) create dataspace attributes database
-  6) create keyval and bstream directories
-*/
+   1) check collections database to see if coll_id is already used
+   (error out if so)
+   2) create collection attribute database
+   3) store trove-dbpf version in collection attribute database
+   4) store last handle value in collection attribute database
+   5) create dataspace attributes database
+   6) create keyval and bstream directories
+   */
 int dbpf_collection_create(char *collname,
                            TROVE_coll_id new_coll_id,
                            void *user_ptr,
@@ -707,16 +710,16 @@ int dbpf_collection_create(char *collnam
         return ret;
     }
     sto_p = my_storage_p;
-    
+
     memset(&key, 0, sizeof(key));
     memset(&data, 0, sizeof(data));
-    
+
     key.data = collname;
     key.size = strlen(collname)+1;
     data.data = &db_data;
     data.ulen = sizeof(db_data);
     data.flags = DB_DBT_USERMEM;
-    
+
     /* ensure that the collection record isn't already there */
     ret = sto_p->coll_db->get(sto_p->coll_db, NULL, &key, &data, 0);
     if (ret != DB_NOTFOUND)
@@ -729,19 +732,19 @@ int dbpf_collection_create(char *collnam
 
     memset(&db_data, 0, sizeof(db_data));
     db_data.coll_id = new_coll_id;
-    
+
     key.data = collname;
     key.size = strlen(collname)+1;
     data.data = &db_data;
     data.size = sizeof(db_data);
-    
+
     ret = sto_p->coll_db->put(sto_p->coll_db, NULL, &key, &data, 0);
     if (ret)
     {
         gossip_err("dbpf_collection_create: %s\n", db_strerror(ret));
         return -dbpf_db_error_to_trove_error(ret);
     }
-    
+
     ret = sto_p->coll_db->sync(sto_p->coll_db, 0);
     if (ret)
     {
@@ -765,7 +768,7 @@ int dbpf_collection_create(char *collnam
             return -trove_errno_to_trove_error(errno);
         }
     }
-    
+
     DBPF_GET_COLL_DIRNAME(path_name, PATH_MAX, sto_p->name, new_coll_id);
     ret = mkdir(path_name, 0755);
     if (ret != 0)
@@ -785,7 +788,7 @@ int dbpf_collection_create(char *collnam
     }
     else if(ret < 0)
     {
-        ret = dbpf_db_create(sto_p->name, path_name, NULL);
+        ret = dbpf_db_create(sto_p->name, path_name, NULL, 0);
         if (ret != 0)
         {
             gossip_err("dbpf_db_create failed on attrib db %s\n", path_name);
@@ -793,7 +796,7 @@ int dbpf_collection_create(char *collnam
         }
     }
 
-    db_p = dbpf_db_open(sto_p->name, path_name, NULL, &error, NULL);
+    db_p = dbpf_db_open(sto_p->name, path_name, NULL, &error, NULL, 0);
     if (db_p == NULL)
     {
         gossip_err("dbpf_db_open failed on attrib db %s\n", path_name);
@@ -801,9 +804,9 @@ int dbpf_collection_create(char *collnam
     }
 
     /*
-      store trove-dbpf version string in the collection.  this is used
-      to know what format the metadata is stored in on disk.
-    */
+       store trove-dbpf version string in the collection.  this is used
+       to know what format the metadata is stored in on disk.
+       */
     memset(&key, 0, sizeof(key));
     memset(&data, 0, sizeof(data));
     key.data = TROVE_DBPF_VERSION_KEY;
@@ -850,7 +853,7 @@ int dbpf_collection_create(char *collnam
     }
     if(ret < 0)
     {
-        ret = dbpf_db_create(sto_p->name, path_name, NULL);
+        ret = dbpf_db_create(sto_p->name, path_name, NULL, 0);
         if (ret != 0)
         {
             gossip_err("dbpf_db_create failed on %s\n", path_name);
@@ -867,7 +870,7 @@ int dbpf_collection_create(char *collnam
     }
     if(ret < 0)
     {
-        ret = dbpf_db_create(sto_p->name, path_name, NULL);
+        ret = dbpf_db_create(sto_p->name, path_name, NULL, 0);
         if (ret != 0)
         {
             gossip_err("dbpf_db_create failed on %s\n", path_name);
@@ -1189,7 +1192,7 @@ int dbpf_collection_iterate(TROVE_ds_pos
         data.data = &db_entry;
         data.size = data.ulen = sizeof(db_entry);
         data.flags |= DB_DBT_USERMEM;
-        
+
         ret = dbc_p->c_get(dbc_p, &key, &data, DB_NEXT);
         if (ret == DB_NOTFOUND)
         {
@@ -1203,7 +1206,7 @@ int dbpf_collection_iterate(TROVE_ds_pos
         coll_id_array[i] = db_entry.coll_id;
     }
 
-  return_ok:
+return_ok:
     if (ret == DB_NOTFOUND)
     {
         *inout_position_p = TROVE_ITERATE_END;
@@ -1247,9 +1250,9 @@ int dbpf_collection_iterate(TROVE_ds_pos
         *inout_position_p = recno;
     }
     /*
-      'position' points us to the record we just read, or is set to
-      END
-    */
+       'position' points us to the record we just read, or is set to
+       END
+       */
 
     *inout_count_p = i;
 
@@ -1260,8 +1263,8 @@ int dbpf_collection_iterate(TROVE_ds_pos
         goto return_error;
     }
     return 1;
-    
-  return_error:
+
+return_error:
 
     if (dbc_p)
     {
@@ -1287,9 +1290,10 @@ int dbpf_collection_lookup(char *collnam
     DBT key, data;
     char path_name[PATH_MAX];
     char trove_dbpf_version[32] = {0};
-    
+    int sto_major, sto_minor, sto_inc, major, minor, inc;
+
     gossip_debug(GOSSIP_TROVE_DEBUG, "dbpf_collection_lookup of coll: %s\n", 
-            collname);
+                 collname);
     sto_p = my_storage_p;
     if (!sto_p)
     {
@@ -1317,9 +1321,9 @@ int dbpf_collection_lookup(char *collnam
     }
 
     /*
-      look to see if we have already registered this collection; if
-      so, return
-    */
+       look to see if we have already registered this collection; if
+       so, return
+       */
     coll_p = dbpf_collection_find_registered(db_data.coll_id);
     if (coll_p != NULL)
     {
@@ -1328,9 +1332,9 @@ int dbpf_collection_lookup(char *collnam
     }
 
     /*
-      this collection hasn't been registered already (ie. looked up
-      before)
-    */
+       this collection hasn't been registered already (ie. looked up
+       before)
+       */
     coll_p = (struct dbpf_collection *)malloc(
         sizeof(struct dbpf_collection));
     if (coll_p == NULL)
@@ -1369,7 +1373,8 @@ int dbpf_collection_lookup(char *collnam
 
     DBPF_GET_COLL_ATTRIB_DBNAME(path_name, PATH_MAX,
                                 sto_p->name, coll_p->coll_id);
-    coll_p->coll_attr_db = dbpf_db_open(sto_p->name, path_name, coll_p->coll_env, &ret, NULL);
+    coll_p->coll_attr_db = dbpf_db_open(sto_p->name, path_name, coll_p->coll_env,
+                                        &ret, NULL, 0);
     if (coll_p->coll_attr_db == NULL)
     {
         dbpf_putdb_env(coll_p->coll_env, coll_p->path_name);
@@ -1406,7 +1411,37 @@ int dbpf_collection_lookup(char *collnam
     gossip_debug(GOSSIP_TROVE_DEBUG, "collection lookup: version is "
                  "%s\n", trove_dbpf_version);
 
-    if (strcmp(trove_dbpf_version, TROVE_DBPF_VERSION_VALUE) != 0)
+    ret = sscanf(trove_dbpf_version, "%d.%d.%d", 
+                 &sto_major, &sto_minor, &sto_inc);
+    if(ret < 3)
+    {
+        gossip_err("Failed to get the version "
+                   "components from the storage version: %s\n",
+                   trove_dbpf_version);
+        return -TROVE_EINVAL;
+    }
+
+    ret = sscanf(TROVE_DBPF_VERSION_VALUE, "%d.%d.%d",
+                 &major, &minor, &inc);
+    if(ret < 3)
+    {
+        gossip_err("Failed to get the version "
+                   "components from the implementation's version: %s\n",
+                   TROVE_DBPF_VERSION_VALUE);
+        return -TROVE_EINVAL;
+    }
+
+    /* before version 0.1.3, no storage formats were compatible.
+     * Now 0.1.2 is compatible with 0.1.3, with the caveat that the right
+     * dspace db comparison function is specified when its opened.
+     *
+     * From 0.1.1 to 0.1.2, the storage formats aren't compatible, but
+     * in future (> 0.1.3) releases, only incremental version changes
+     * means backward compatibility is maintained, 
+     * while anything else is incompatible.
+     */
+    if(sto_major < major || sto_minor < minor ||
+       !strcmp(trove_dbpf_version, "0.1.1"))
     {
         db_close(coll_p->coll_attr_db);
         dbpf_putdb_env(coll_p->coll_env, coll_p->path_name);
@@ -1423,7 +1458,24 @@ int dbpf_collection_lookup(char *collnam
 
     DBPF_GET_DS_ATTRIB_DBNAME(path_name, PATH_MAX,
                               sto_p->name, coll_p->coll_id);
-    coll_p->ds_db = dbpf_db_open(sto_p->name, path_name, coll_p->coll_env, &ret, &PINT_trove_dbpf_ds_attr_compare);
+
+    if(sto_major == 0 && sto_minor == 1 && sto_inc < 3)
+    {
+        /* use old comparison function */
+        coll_p->ds_db = dbpf_db_open(
+            sto_p->name, path_name, coll_p->coll_env, &ret,
+            &PINT_trove_dbpf_ds_attr_compare_reversed, 0);
+    }
+    else
+    {
+        /* new comparison function orders dspace entries so that berkeley
+         * DB does page reads in the right order (for handle_iterate)
+         */
+        coll_p->ds_db = dbpf_db_open(
+            sto_p->name, path_name, coll_p->coll_env, &ret,
+            &PINT_trove_dbpf_ds_attr_compare, 0);
+    }
+
     if (coll_p->ds_db == NULL)
     {
         db_close(coll_p->coll_attr_db);
@@ -1436,8 +1488,8 @@ int dbpf_collection_lookup(char *collnam
 
     DBPF_GET_KEYVAL_DBNAME(path_name, PATH_MAX,
                            sto_p->name, coll_p->coll_id);
-    coll_p->keyval_db = dbpf_db_open(sto_p->name, path_name, coll_p->coll_env, &ret, 
-                                     PINT_trove_dbpf_keyval_compare);
+    coll_p->keyval_db = dbpf_db_open(sto_p->name, path_name, coll_p->coll_env,
+                                     &ret, PINT_trove_dbpf_keyval_compare, 0);
     if(coll_p->keyval_db == NULL)
     {
         db_close(coll_p->coll_attr_db);
@@ -1463,15 +1515,15 @@ int dbpf_collection_lookup(char *collnam
     }
 
     coll_p->next_p = NULL;
-    
+
     /*
      * Initialize defaults to ensure working
      */
     coll_p->c_high_watermark = 10;
     coll_p->c_low_watermark = 1;
     coll_p->meta_sync_enabled = 1; /* MUST be 1 !*/
-    
-    
+
+
     dbpf_collection_register(coll_p);
     *out_coll_id_p = coll_p->coll_id;
     return 1;
@@ -1546,7 +1598,8 @@ struct dbpf_storage *dbpf_storage_lookup
         return NULL;
     }
 
-    sto_p->sto_attr_db = dbpf_db_open(sto_p->name, path_name, NULL, error_p, NULL);
+    sto_p->sto_attr_db = dbpf_db_open(sto_p->name, path_name, NULL,
+                                      error_p, NULL, 0);
     if (sto_p->sto_attr_db == NULL)
     {
         free(sto_p->name);
@@ -1557,7 +1610,8 @@ struct dbpf_storage *dbpf_storage_lookup
 
     DBPF_GET_COLLECTIONS_DBNAME(path_name, PATH_MAX, stoname);
 
-    sto_p->coll_db = dbpf_db_open(sto_p->name, path_name, NULL, error_p, NULL);
+    sto_p->coll_db = dbpf_db_open(sto_p->name, path_name, NULL, 
+                                  error_p, NULL, DB_RECNUM);
     if (sto_p->coll_db == NULL)
     {
         db_close(sto_p->sto_attr_db);
@@ -1584,7 +1638,7 @@ static int dbpf_mkpath(char *pathname, m
     {
         return ret;
     }
-    
+
     while (pos < len)
     {
         nullpos = pos;
@@ -1624,7 +1678,7 @@ static int dbpf_mkpath(char *pathname, m
                     return -trove_errno_to_trove_error(errno);
                 }
             }
-            
+
             if (killed_slash)
             {
                 pathname[nullpos] = '/';
@@ -1652,8 +1706,32 @@ int db_open(DB *db_p, const char *dbname
                           flags,
                           mode)) != 0)
     {
-        db_p->err(db_p, ret, "%s", dbname);
-        return ret;
+        if(ret == EINVAL)
+        {
+            /* assume older db with DB_RECNUM flag set.  Set the flag
+             * and try again */
+            ret = db_p->set_flags(db_p, DB_RECNUM);
+            if(ret != 0)
+            {
+                /* well, we tried.  ok nothing we can do */
+                db_p->err(db_p, ret, "%s", dbname);
+                return ret;
+            }
+
+            if ((ret = db_p->open(db_p,
+#ifdef HAVE_TXNID_PARAMETER_TO_DB_OPEN
+                                  NULL,
+#endif
+                                  dbname,
+                                  NULL,
+                                  TROVE_DB_TYPE,
+                                  flags,
+                                  mode)) != 0)
+            {
+                db_p->err(db_p, ret, "%s", dbname);
+                return ret;
+            }
+        }
     }
     return 0;
 }
@@ -1674,7 +1752,10 @@ int db_close(DB *db_p)
 /* Internal function for creating first instances of the databases for
  * a db plus files storage region.
  */
-static int dbpf_db_create(const char *sto_path, char *dbname, DB_ENV *envp)
+static int dbpf_db_create(const char *sto_path,
+                          char *dbname,
+                          DB_ENV *envp,
+                          uint32_t flags)
 {
     int ret = -TROVE_EINVAL;
     DB *db_p = NULL;
@@ -1685,12 +1766,9 @@ static int dbpf_db_create(const char *st
         return -dbpf_db_error_to_trove_error(ret);
     }
 
-    /* DB_RECNUM makes it easier to iterate through every key in chunks */
-    if ((ret = db_p->set_flags(db_p, DB_RECNUM)) != 0)
+    if(flags)
     {
-        db_p->err(db_p, ret, "%s: set_flags", dbname);
-        db_close(db_p);
-        return -dbpf_db_error_to_trove_error(ret);
+        ret = db_p->set_flags(db_p, flags);
     }
 
     if ((ret = db_open(db_p, dbname, TROVE_DB_CREATE_FLAGS, TROVE_DB_MODE)) != 0)
@@ -1719,7 +1797,8 @@ static int dbpf_db_create(const char *st
  */
 static DB *dbpf_db_open(
     const char *sto_path, char *dbname, DB_ENV *envp, int *error_p,
-    int (*compare_fn) (DB *db, const DBT *dbt1, const DBT *dbt2))
+    int (*compare_fn) (DB *db, const DBT *dbt1, const DBT *dbt2),
+    uint32_t flags)
 {
     int ret = -TROVE_EINVAL;
     DB *db_p = NULL;
@@ -1737,8 +1816,7 @@ static DB *dbpf_db_open(
         db_p->set_bt_compare(db_p, compare_fn);
     }
 
-    /* DB_RECNUM makes it easier to iterate through every key in chunks */
-    if ((ret = db_p->set_flags(db_p, DB_RECNUM)) != 0)
+    if (flags && (ret = db_p->set_flags(db_p, flags)) != 0)
     {
         db_p->err(db_p, ret, "%s: set_flags", dbname);
         *error_p = -dbpf_db_error_to_trove_error(ret);
Index: src/io/trove/trove-dbpf/dbpf.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf.h,v
retrieving revision 1.81
diff -u -a -p -r1.81 dbpf.h
--- src/io/trove/trove-dbpf/dbpf.h	2 Feb 2007 02:08:59 -0000	1.81
+++ src/io/trove/trove-dbpf/dbpf.h	14 Mar 2007 22:21:21 -0000
@@ -23,8 +23,14 @@ extern "C" {
  */
 #define DBPF_ERROR_UNKNOWN 4243
 
+/* Incremental versions are backward compatible with previous releases
+ * that have the same major and minor versions.
+ * Minor versions are NOT backward compatible.
+ * Major versions aren't either, but refer to architectural storage format changes.
+ */
 #define TROVE_DBPF_VERSION_KEY                       "trove-dbpf-version"
-#define TROVE_DBPF_VERSION_VALUE                                  "0.1.2"
+#define TROVE_DBPF_VERSION_VALUE                                  "0.1.3"
+
 #define LAST_HANDLE_STRING                                  "last_handle"
 
 #ifdef HAVE_DB_DIRTY_READ
@@ -232,6 +238,8 @@ struct dbpf_collection_db_entry
 int PINT_trove_dbpf_keyval_compare(
     DB * dbp, const DBT * a, const DBT * b);
 int PINT_trove_dbpf_ds_attr_compare(
+    DB * dbp, const DBT * a, const DBT * b);
+int PINT_trove_dbpf_ds_attr_compare_reversed(
     DB * dbp, const DBT * a, const DBT * b);
 
 struct dbpf_dspace_create_op
Index: src/io/trove/trove-handle-mgmt/trove-handle-mgmt.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-handle-mgmt/trove-handle-mgmt.h,v
retrieving revision 1.13
diff -u -a -p -r1.13 trove-handle-mgmt.h
--- src/io/trove/trove-handle-mgmt/trove-handle-mgmt.h	28 Jul 2004 14:32:52 -0000	1.13
+++ src/io/trove/trove-handle-mgmt/trove-handle-mgmt.h	14 Mar 2007 22:21:21 -0000
@@ -7,7 +7,7 @@
 #ifndef __TROVE_HANDLE_MGMT_H
 #define __TROVE_HANDLE_MGMT_H
 
-#define MAX_NUM_VERIFY_HANDLE_COUNT        512
+#define MAX_NUM_VERIFY_HANDLE_COUNT        4096
 
 #define TROVE_DEFAULT_HANDLE_PURGATORY_SEC 360
 
Index: src/kernel/linux-2.6/dir.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/dir.c,v
retrieving revision 1.47
diff -u -a -p -r1.47 dir.c
--- src/kernel/linux-2.6/dir.c	9 Nov 2006 20:29:33 -0000	1.47
+++ src/kernel/linux-2.6/dir.c	14 Mar 2007 22:21:21 -0000
@@ -147,8 +147,8 @@ static int pvfs2_readdir(
     case 0:
         token_set = 1;
         ino = get_ino_from_handle(dentry->d_inode);
-        gossip_debug(GOSSIP_DIR_DEBUG, 
-                     "calling filldir of . with pos = %d\n", pos);
+        gossip_debug(GOSSIP_DIR_DEBUG,
+                     "calling filldir of . with pos = %llu\n", llu(pos));
         if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
         {
             break;
@@ -160,7 +160,7 @@ static int pvfs2_readdir(
         token_set = 1;
         ino = get_parent_ino_from_dentry(dentry);
         gossip_debug(GOSSIP_DIR_DEBUG, 
-                     "calling filldir of .. with pos = %d\n", pos);
+                     "calling filldir of .. with pos = %llu\n", llu(pos));
         if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
         {
             break;
@@ -282,7 +282,8 @@ static int pvfs2_readdir(
                     file->f_pos = i;
             }
             gossip_debug(GOSSIP_DIR_DEBUG, 
-                         "pos = %d, file->f_pos should have been %ld\n", pos, 
+                         "pos = %llu, file->f_pos should have been %ld\n", 
+                         llu(pos),
                          (unsigned long) file->f_pos);
         }
         else
Index: src/kernel/linux-2.6/downcall.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/downcall.h,v
retrieving revision 1.28
diff -u -a -p -r1.28 downcall.h
--- src/kernel/linux-2.6/downcall.h	13 Sep 2006 20:22:55 -0000	1.28
+++ src/kernel/linux-2.6/downcall.h	14 Mar 2007 22:21:21 -0000
@@ -78,7 +78,6 @@ struct pvfs2_dirent
 typedef struct
 {
     PVFS_ds_position token;
-    uint32_t  __pad1;
     uint64_t directory_version;
     uint32_t  __pad2;
     uint32_t pvfs_dirent_outcount;
@@ -89,7 +88,6 @@ typedef struct
 typedef struct
 {
     PVFS_ds_position token;
-    uint32_t  __pad1;
     uint64_t directory_version;
     uint32_t  __pad2;
     uint32_t pvfs_dirent_outcount;
@@ -146,10 +144,11 @@ typedef struct {
 
 typedef struct {
     int32_t  returned_count;
+    int32_t __pad1;
     PVFS_ds_position token;
     char key[PVFS_MAX_XATTR_LISTLEN*PVFS_MAX_XATTR_NAMELEN];
     int32_t  keylen;
-    int32_t  __pad1;
+    int32_t  __pad2;
     int32_t  lengths[PVFS_MAX_XATTR_LISTLEN];
 } pvfs2_listxattr_response_t;
 /* the removexattr response is a blank downcall */
Index: src/kernel/linux-2.6/upcall.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/upcall.h,v
retrieving revision 1.35
diff -u -a -p -r1.35 upcall.h
--- src/kernel/linux-2.6/upcall.h	13 Sep 2006 20:22:56 -0000	1.35
+++ src/kernel/linux-2.6/upcall.h	14 Mar 2007 22:21:21 -0000
@@ -89,7 +89,6 @@ typedef struct
     PVFS_ds_position token;
     int32_t max_dirent_count;
     int32_t buf_index;
-    uint32_t __pad1;
 } pvfs2_readdir_request_t;
 
 typedef struct
@@ -99,6 +98,7 @@ typedef struct
     int32_t max_dirent_count;
     uint32_t mask;
     int32_t  buf_index;
+    int32_t  __pad1;
 } pvfs2_readdirplus_request_t;
 
 typedef struct
@@ -158,6 +158,7 @@ typedef struct 
 {
     PVFS_object_ref refn;
     int32_t  requested_count;
+    int32_t  __pad1;
     PVFS_ds_position token;
 } pvfs2_listxattr_request_t;
 
Index: src/proto/pvfs2-req-proto.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/proto/pvfs2-req-proto.h,v
retrieving revision 1.147
diff -u -a -p -r1.147 pvfs2-req-proto.h
--- src/proto/pvfs2-req-proto.h	26 Sep 2006 03:44:18 -0000	1.147
+++ src/proto/pvfs2-req-proto.h	14 Mar 2007 22:21:21 -0000
@@ -22,11 +22,11 @@
  * compatibility (such as changing the semantics or protocol fields for an
  * existing request type)
  */
-#define PVFS2_PROTO_MAJOR 3
+#define PVFS2_PROTO_MAJOR 4
 /* update PVFS2_PROTO_MINOR on wire protocol changes that preserve backwards
  * compatibility (such as adding a new request type)
  */
-#define PVFS2_PROTO_MINOR 4
+#define PVFS2_PROTO_MINOR 0
 #define PVFS2_PROTO_VERSION ((PVFS2_PROTO_MAJOR*1000)+(PVFS2_PROTO_MINOR))
 
 /* we set the maximum possible size of a small I/O packed message as 64K.  This
@@ -642,10 +642,11 @@ struct PVFS_servreq_readdir
     PVFS_ds_position token; /* dir offset */
     uint32_t dirent_count;  /* desired # of entries */
 };
-endecode_fields_4_struct(
+endecode_fields_5_struct(
     PVFS_servreq_readdir,
     PVFS_handle, handle,
     PVFS_fs_id, fs_id,
+    skip4,,
     PVFS_ds_position, token,
     uint32_t, dirent_count)
 
@@ -673,10 +674,9 @@ struct PVFS_servresp_readdir
     uint32_t dirent_count;   /* # of entries retrieved */
     uint64_t directory_version;
 };
-endecode_fields_4a_struct(
+endecode_fields_3a_struct(
     PVFS_servresp_readdir,
     PVFS_ds_position, token,
-    skip4,,
     uint64_t, directory_version,
     skip4,,
     uint32_t, dirent_count,
@@ -1217,9 +1217,10 @@ struct PVFS_servresp_mgmt_iterate_handle
     PVFS_handle *handle_array;
     int handle_count;
 };
-endecode_fields_1a_struct(
+endecode_fields_2a_struct(
     PVFS_servresp_mgmt_iterate_handles,
     PVFS_ds_position, position,
+    skip4,,
     int32_t, handle_count,
     PVFS_handle, handle_array)
 #define extra_size_PVFS_servresp_mgmt_iterate_handles \
@@ -1450,8 +1451,8 @@ endecode_fields_4a_struct(
     PVFS_servreq_listeattr,
     PVFS_handle, handle,
     PVFS_fs_id, fs_id,
-    PVFS_ds_position, token,
     skip4,,
+    PVFS_ds_position, token,
     uint32_t, nkey,
     PVFS_size, keysz);
 #define extra_size_PVFS_servreq_listeattr \
@@ -1481,9 +1482,10 @@ struct PVFS_servresp_listeattr
     uint32_t nkey;   /* # of keys retrieved */
     PVFS_ds_keyval *key; /* array of keys returned */
 };
-endecode_fields_1a_struct(
+endecode_fields_2a_struct(
     PVFS_servresp_listeattr,
     PVFS_ds_position, token,
+    skip4,,
     uint32_t, nkey,
     PVFS_ds_keyval, key)
 #define extra_size_PVFS_servresp_listeattr \
Index: src/server/readdir.sm
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/server/readdir.sm,v
retrieving revision 1.48
diff -u -a -p -r1.48 readdir.sm
--- src/server/readdir.sm	17 Feb 2007 21:16:48 -0000	1.48
+++ src/server/readdir.sm	14 Mar 2007 22:21:21 -0000
@@ -202,9 +202,9 @@ static int readdir_iterate_on_entries(
 
     gossip_debug(
         GOSSIP_READDIR_DEBUG, " - iterating keyvals: [%llu,%d], "
-        "\n\ttoken=%d, count=%d\n",
+        "\n\ttoken=%llu, count=%d\n",
         llu(s_op->u.readdir.dirent_handle), s_op->req->u.readdir.fs_id,
-        s_op->req->u.readdir.token, 
+        llu(s_op->req->u.readdir.token),
         s_op->req->u.readdir.dirent_count);
 
     ret = job_trove_keyval_iterate(
Index: test/automated/nightly-tests.cfg
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/automated/nightly-tests.cfg,v
retrieving revision 1.1
diff -u -a -p -r1.1 nightly-tests.cfg
--- test/automated/nightly-tests.cfg	29 Nov 2006 21:46:47 -0000	1.1
+++ test/automated/nightly-tests.cfg	14 Mar 2007 22:21:21 -0000
@@ -1,11 +1,11 @@
 
 # a working directory for all the nightly test data: where the scripts will
 # check out CVS, build the source, run the tests, and log what happened
-#export PVFS2_DEST=${HOME}/pvfs2-nightly
+export PVFS2_DEST=/sandbox/slang/pvfs-test
 
 # a mountpoint (either a real vfs mountpoint, or a pseudo mountpoint in a pvfs
 # tabfile) for these nightly tests
-#export PVFS2_MOUNTPOINT=/pvfs2-nightly
+export PVFS2_MOUNTPOINT=/sandbox/slang/mnt
 
 # this one is kindof annoying:  EXTRA_TESTS points to the location for several
 # benchmarks: bonnie++, IOR, dbench, others.
