[Pvfs2-cvs] commit by dbonnie in pvfs2/src/io/trove/trove-dbpf: dbpf-null-aio.c dbpf-dspace.c dbpf-keyval.c dbpf-mgmt.c dbpf.h module.mk.in

CVS commit program cvs at parl.clemson.edu
Fri May 16 11:15:47 EDT 2008


Update of /anoncvs/pvfs2/src/io/trove/trove-dbpf
In directory parlweb1:/tmp/cvs-serv1762/src/io/trove/trove-dbpf

Modified Files:
      Tag: cu-security-branch
	dbpf-dspace.c dbpf-keyval.c dbpf-mgmt.c dbpf.h module.mk.in 
Added Files:
      Tag: cu-security-branch
	dbpf-null-aio.c 
Log Message:
Updated branch with code from HEAD


--- /dev/null	2004-06-24 14:04:38.000000000 -0400
+++ dbpf-null-aio.c	2008-05-16 11:15:47.000000000 -0400
@@ -0,0 +1,403 @@
+
+#include <string.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <assert.h>
+#include <errno.h>
+#include <aio.h>
+
+#include "gossip.h"
+#include "pvfs2-debug.h"
+#include "trove.h"
+#include "trove-internal.h"
+#include "dbpf.h"
+#include "quicklist.h"
+#include "pthread.h"
+#include "dbpf.h"
+
+
+static int null_lio_listio(int mode, struct aiocb * const list[],
+                          int nent, struct sigevent *sig);
+static int null_aio_error(const struct aiocb *aiocbp);
+static ssize_t null_aio_return(struct aiocb *aiocbp);
+static int null_aio_cancel(int filedesc, struct aiocb * aiocbp);
+static int null_aio_suspend(const struct aiocb * const list[], int nent,
+                           const struct timespec * timeout);
+static int null_aio_read(struct aiocb * aiocbp);
+static int null_aio_write(struct aiocb * aiocbp);
+static int null_aio_fsync(int operation, struct aiocb * aiocbp);
+
+static struct dbpf_aio_ops null_aio_ops;
+
+struct null_aio_item
+{
+    struct aiocb *cb_p;
+    struct sigevent *sig;
+    struct qlist_head list_link;
+    int master;
+    pthread_t *tids;
+    int nent;
+};
+static void* null_lio_thread(void*);
+
+int null_lio_listio(int mode, struct aiocb * const list[], 
+                   int nent, struct sigevent *sig) 
+{
+    struct null_aio_item* tmp_item;
+    int ret, i;
+    pthread_t *tids;
+    pthread_attr_t attr;
+
+    tids = (pthread_t *)malloc(sizeof(pthread_t) * nent);
+    if(!tids)
+    {
+        return (-1);
+    }
+
+    for(i = 0; i < nent; ++i)
+    {
+	int spawnmode= PTHREAD_CREATE_JOINABLE;
+        tmp_item = (struct null_aio_item*)malloc(sizeof(struct null_aio_item)*nent);
+        if(!tmp_item)
+        {
+            return (-1);
+        }
+        memset(tmp_item, 0, sizeof(struct null_aio_item));
+
+        if(mode == LIO_NOWAIT && i == (nent - 1))
+        {
+            /* This is the master thread and needs to wait for the others.
+             * We make the master the last thread to get created, so that
+             * we don't end up in a race with the thread ids getting set
+             * properly 
+             */
+            tmp_item->master = 1;
+            tmp_item->tids = tids;
+            tmp_item->nent = nent;
+	    spawnmode= PTHREAD_CREATE_DETACHED;
+        }
+
+        tmp_item->cb_p = list[i];
+        tmp_item->sig = sig;
+
+        /* setup state */
+#ifdef HAVE_AIOCB_ERROR_CODE
+        tmp_item->cb_p->__error_code = EINPROGRESS;
+#endif
+
+        /* set detached state */
+        ret = pthread_attr_init(&attr);
+        if(ret != 0)
+        {
+            free(tmp_item);
+            errno = ret;
+
+            return(-1);
+        }
+        ret = pthread_attr_setdetachstate(
+            &attr,
+	    spawnmode
+        );
+        if(ret != 0)
+        {
+            free(tmp_item);
+            errno = ret;
+            return(-1);
+        }
+
+        /* create thread to perform I/O and trigger callback */
+        ret = pthread_create(&tids[i], &attr, null_lio_thread, tmp_item);
+        if(ret != 0)
+        {
+            int j = 0;
+
+            if(mode == LIO_WAIT)
+            {
+                for(; j < i; ++j)
+                {
+                    pthread_join(tids[j], NULL);
+                }
+            }
+
+            free(tmp_item);
+            free(tids);
+            errno = ret;
+            return(-1);
+        }
+        gossip_debug(GOSSIP_BSTREAM_DEBUG, 
+                     "[null-aio]: pthread_create completed:"
+                     " id: %d, thread_id: %p\n",
+                     i, (void *)tids[i]);
+    }
+
+    ret = 0;
+    if(mode == LIO_WAIT)
+    {
+        for(i = 0; i < nent; ++i)
+        {
+            pthread_join(tids[i], NULL);
+            if(ret != 0 && null_aio_error(list[i]) != 0)
+            {
+                /* for now we're just overwriting previous errors
+                 * since we have no way to store and return them
+                 * in the blocking case.
+                 * The caller should call aio_error to get the
+                 * element specific errors
+                 */
+                ret = null_aio_error(list[i]);
+            }
+        }
+
+        free(tids);
+    }
+    return(ret);
+}
+
+static int null_aio_error(const struct aiocb *aiocbp)
+{
+#ifdef HAVE_AIOCB_ERROR_CODE
+    return aiocbp->__error_code;
+#else
+    return 0;
+#endif
+}
+
+static ssize_t null_aio_return(struct aiocb *aiocbp)
+{
+#ifdef HAVE_AIOCB_RETURN_VALUE
+    return aiocbp->__return_value;
+#else
+    return 0;
+#endif
+}
+
+static int null_aio_cancel(int filedesc, struct aiocb *aiocbp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
+static int null_aio_suspend(const struct aiocb * const list[], int nent,
+                           const struct timespec * timeout)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
+static int null_aio_read(struct aiocb * aiocbp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
+static int null_aio_write(struct aiocb * aiocbp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
+static int null_aio_fsync(int operation, struct aiocb * aiocbp)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
+static void* null_lio_thread(void* foo)
+{
+    struct null_aio_item* tmp_item = (struct null_aio_item*)foo;
+    int ret = 0;
+    struct stat statbuf;
+
+    if(tmp_item->cb_p->aio_lio_opcode == LIO_READ)
+    {
+        ret = tmp_item->cb_p->aio_nbytes;
+    }
+    else if(tmp_item->cb_p->aio_lio_opcode == LIO_WRITE)
+    {
+        gossip_debug(GOSSIP_BSTREAM_DEBUG,
+                     "[null-aio]: pwrite: cb_p: %p, "
+                     "fd: %d, bufp: %p, size: %zd off:%llu\n",
+                     tmp_item->cb_p, tmp_item->cb_p->aio_fildes, 
+                     tmp_item->cb_p->aio_buf, tmp_item->cb_p->aio_nbytes,
+		     llu(tmp_item->cb_p->aio_offset));
+
+        /* check size of file */
+        /* note, if either fstat or ftruncate fail, then we let the ret and
+         * errno drop through to the logic below.  Otherwise we report the
+         * size that would have been written.
+         */
+        ret = fstat(tmp_item->cb_p->aio_fildes, &statbuf);
+        if(ret == 0)
+        {
+            if(statbuf.st_size < 
+                (tmp_item->cb_p->aio_nbytes + tmp_item->cb_p->aio_offset))
+            {
+                /* this write would extend the file */
+                ret = ftruncate(tmp_item->cb_p->aio_fildes, 
+                    (tmp_item->cb_p->aio_nbytes + tmp_item->cb_p->aio_offset));
+                if(ret == 0)
+                {
+                    ret = tmp_item->cb_p->aio_nbytes;
+                }
+            }
+            else
+            {
+                ret = tmp_item->cb_p->aio_nbytes;
+            }
+        }
+    }
+    else
+    {
+        /* this should have been caught already */
+        assert(0);
+    }
+
+    /* store error and return codes */
+    if(ret < 0)
+    {
+#ifdef HAVE_AIOCB_ERROR_CODE
+        tmp_item->cb_p->__error_code = errno;
+#endif
+    }
+    else
+    {
+#ifdef HAVE_AIOCB_ERROR_CODE
+        tmp_item->cb_p->__error_code = 0;
+#endif
+
+#ifdef HAVE_AIOCB_RETURN_VALUE
+        tmp_item->cb_p->__return_value = ret;
+#endif
+    }
+
+    if(tmp_item->master)
+    {
+        int i;
+        /* I'm the master, gotta wait for the others to call notify */
+
+        /* we skip the last one because that's us */
+        for(i = 0; i < (tmp_item->nent - 1); ++i)
+        {
+            ret = pthread_join(tmp_item->tids[i], NULL);
+            if(ret != 0)
+            {
+                gossip_err("pthread_join failed: %d (%s), i: %d, tid: %p\n",
+                           ret, strerror(ret), i, (void *)tmp_item->tids[i]);
+            }
+        }
+
+        free(tmp_item->tids);
+        /* run callback fn */
+        tmp_item->sig->sigev_notify_function(tmp_item->sig->sigev_value);
+    }
+
+    free(tmp_item);
+
+    pthread_exit(NULL);
+    return NULL;
+}
+
+static int null_aio_bstream_read_list(TROVE_coll_id coll_id,
+                                     TROVE_handle handle,
+                                     char **mem_offset_array, 
+                                     TROVE_size *mem_size_array,
+                                     int mem_count,
+                                     TROVE_offset *stream_offset_array, 
+                                     TROVE_size *stream_size_array,
+                                     int stream_count,
+                                     TROVE_size *out_size_p,
+                                     TROVE_ds_flags flags, 
+                                     TROVE_vtag_s *vtag,
+                                     void *user_ptr,
+                                     TROVE_context_id context_id,
+                                     TROVE_op_id *out_op_id_p)
+{
+    return dbpf_bstream_rw_list(coll_id,
+                                handle,
+                                mem_offset_array, 
+                                mem_size_array,
+                                mem_count,
+                                stream_offset_array, 
+                                stream_size_array,
+                                stream_count,
+                                out_size_p,
+                                flags, 
+                                vtag,
+                                user_ptr,
+                                context_id,
+                                out_op_id_p,
+                                LIO_READ,
+                                &null_aio_ops);
+}
+
+static int null_aio_bstream_write_list(TROVE_coll_id coll_id,
+                                      TROVE_handle handle,
+                                      char **mem_offset_array, 
+                                      TROVE_size *mem_size_array,
+                                      int mem_count,
+                                      TROVE_offset *stream_offset_array, 
+                                      TROVE_size *stream_size_array,
+                                      int stream_count,
+                                      TROVE_size *out_size_p,
+                                      TROVE_ds_flags flags, 
+                                      TROVE_vtag_s *vtag,
+                                      void *user_ptr,
+                                      TROVE_context_id context_id,
+                                      TROVE_op_id *out_op_id_p)
+{
+    return dbpf_bstream_rw_list(coll_id,
+                                handle,
+                                mem_offset_array, 
+                                mem_size_array,
+                                mem_count,
+                                stream_offset_array, 
+                                stream_size_array,
+                                stream_count,
+                                out_size_p,
+                                flags, 
+                                vtag,
+                                user_ptr,
+                                context_id,
+                                out_op_id_p,
+                                LIO_WRITE,
+                                &null_aio_ops);
+}
+
+static struct dbpf_aio_ops null_aio_ops =
+{
+    null_aio_read,
+    null_aio_write,
+    null_lio_listio,
+    null_aio_error,
+    null_aio_return,
+    null_aio_cancel,
+    null_aio_suspend,
+    null_aio_fsync
+};
+
+struct TROVE_bstream_ops null_aio_bstream_ops =
+{
+    dbpf_bstream_read_at,
+    dbpf_bstream_write_at,
+    dbpf_bstream_resize,
+    dbpf_bstream_validate,
+    null_aio_bstream_read_list,
+    null_aio_bstream_write_list,
+    dbpf_bstream_flush
+};
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */

Index: dbpf-dspace.c
===================================================================
RCS file: /anoncvs/pvfs2/src/io/trove/trove-dbpf/dbpf-dspace.c,v
diff -p -u -r1.153 -r1.153.2.1
--- dbpf-dspace.c	15 Feb 2008 15:09:10 -0000	1.153
+++ dbpf-dspace.c	16 May 2008 15:15:47 -0000	1.153.2.1
@@ -93,6 +93,9 @@ static inline void organize_post_op_stat
 
 static int dbpf_dspace_remove_keyval(
     void * args, TROVE_handle handle, TROVE_keyval_s *key, TROVE_keyval_s *val);
+static int getattr_one_handle(TROVE_object_ref ref, 
+    TROVE_ds_attributes *attr, 
+    DB* ds_db);
 
 static int dbpf_dspace_iterate_handles_op_svc(struct dbpf_op *op_p);
 static int dbpf_dspace_create_op_svc(struct dbpf_op *op_p);
@@ -979,9 +982,10 @@ static int dbpf_dspace_getattr_list(TROV
     struct dbpf_collection *coll_p = NULL;
     TROVE_object_ref ref;
     int i;
+    int cache_hits = 0; 
 
-    /* fast path cache hit; skips queueing */
     gen_mutex_lock(&dbpf_attr_cache_mutex);
+    /* go ahead and try to hit attr cache for all handles up front */ 
     for (i = 0; i < nhandles; i++) 
     {
         ref.handle = handle_array[i];
@@ -998,21 +1002,30 @@ static int dbpf_dspace_getattr_list(TROV
                 (int)ds_attr_p->type, (int)ds_attr_p->dfile_count,
                 (int)ds_attr_p->dist_size);
 #endif
-            gossip_debug(GOSSIP_DBPF_ATTRCACHE_DEBUG, "dspace_getattr fast "
+            gossip_debug(GOSSIP_DBPF_ATTRCACHE_DEBUG, "dspace_getattr_list fast "
                          "path attr cache hit on %llu\n (dfile_count=%d | "
                          "dist_size=%d | data_size=%lld)\n", llu(handle_array[i]),
-                         ds_attr_p->dfile_count, ds_attr_p->dist_size,
-                         lld(ds_attr_p->b_size));
+                         ds_attr_p[i].dfile_count, ds_attr_p[i].dist_size,
+                         lld(ds_attr_p[i].b_size));
 
             UPDATE_PERF_METADATA_READ();
             error_array[i] = 0;
-            continue;
+            cache_hits++;
+        }
+        else
+        {
+            /* no hit; mark attr entry so that we can detect that in the
+             * service routine
+             */
+            ds_attr_p[i].type = PVFS_TYPE_NONE;
         }
-        break;
     }
     gen_mutex_unlock(&dbpf_attr_cache_mutex);
+
     /* All handles hit in the cache, return */
-    if (i == nhandles) {
+    if (cache_hits == nhandles) 
+    {
+        gossip_debug(GOSSIP_DBPF_ATTRCACHE_DEBUG, "dspace_getattr_list serviced entirely from attr cache.\n");
         return 1;
     }
 
@@ -1038,10 +1051,10 @@ static int dbpf_dspace_getattr_list(TROV
                         context_id);
 
     /* initialize op-specific members */
-    q_op_p->op.u.d_getattr_list.count = (nhandles - i);
-    q_op_p->op.u.d_getattr_list.handle_array = &handle_array[i];
-    q_op_p->op.u.d_getattr_list.attr_p = &ds_attr_p[i];
-    q_op_p->op.u.d_getattr_list.error_p = &error_array[i];
+    q_op_p->op.u.d_getattr_list.count = nhandles;
+    q_op_p->op.u.d_getattr_list.handle_array = handle_array;
+    q_op_p->op.u.d_getattr_list.attr_p = ds_attr_p;
+    q_op_p->op.u.d_getattr_list.error_p = error_array;
 
     *out_op_id_p = dbpf_queued_op_queue(q_op_p);
 
@@ -1145,20 +1158,20 @@ return_error:
     return ret;
 }
 
-static int dbpf_dspace_getattr_op_svc(struct dbpf_op *op_p)
+static int getattr_one_handle(TROVE_object_ref ref, 
+    TROVE_ds_attributes *attr, 
+    DB* ds_db)
 {
     int ret = -TROVE_EINVAL;
     DBT key, data;
     TROVE_ds_storedattr_s s_attr;
-    TROVE_ds_attributes *attr = NULL;
     TROVE_size b_size;
     struct stat b_stat;
-    TROVE_object_ref ref = {op_p->handle, op_p->coll_p->coll_id};
     struct open_cache_ref tmp_ref;
 
     /* get an fd for the bstream so we can check size */
     ret = dbpf_open_cache_get(
-        op_p->coll_p->coll_id, op_p->handle, 0, &tmp_ref);
+        ref.fs_id, ref.handle, 0, &tmp_ref);
     if (ret < 0)
     {
         b_size = 0;
@@ -1169,14 +1182,13 @@ static int dbpf_dspace_getattr_op_svc(st
         dbpf_open_cache_put(&tmp_ref);
         if (ret < 0)
         {
-            ret = -TROVE_EBADF;
-            goto return_error;
+            return(-TROVE_EBADF);
         }
         b_size = (TROVE_size)b_stat.st_size;
     }
 
     memset(&key, 0, sizeof(key));
-    key.data = &op_p->handle;
+    key.data = &ref.handle;
     key.size = key.ulen = sizeof(TROVE_handle);
 
     memset(&data, 0, sizeof(data));
@@ -1185,27 +1197,24 @@ static int dbpf_dspace_getattr_op_svc(st
     data.size = data.ulen = sizeof(TROVE_ds_storedattr_s);
     data.flags |= DB_DBT_USERMEM;
 
-    ret = op_p->coll_p->ds_db->get(op_p->coll_p->ds_db, 
-                                   NULL, &key, &data, 0);
+    ret = ds_db->get(ds_db, NULL, &key, &data, 0);
     if (ret != 0)
     {
         if(ret != DB_NOTFOUND)
         {
-            op_p->coll_p->ds_db->err(op_p->coll_p->ds_db, ret, "DB->get");
+            ds_db->err(ds_db, ret, "DB->get");
         }
-        ret = -dbpf_db_error_to_trove_error(ret);
-        goto return_error;
+        return(-dbpf_db_error_to_trove_error(ret));
     }
 
     gossip_debug(
         GOSSIP_TROVE_DEBUG, "ATTRIB: retrieved attributes "
         "from DISK for key %llu\n\tuid = %d, mode = %d, type = %d, "
         "dfile_count = %d, dist_size = %d\n\tb_size = %lld\n",
-        llu(op_p->handle), (int)s_attr.uid, (int)s_attr.mode,
+        llu(ref.handle), (int)s_attr.uid, (int)s_attr.mode,
         (int)s_attr.type, (int)s_attr.dfile_count, (int)s_attr.dist_size,
         llu(b_size));
 
-    attr = op_p->u.d_getattr.attr_p;
     trove_ds_stored_to_attr(s_attr, *attr, b_size);
 
     /* add retrieved ds_attr to dbpf_attr cache here */
@@ -1213,115 +1222,49 @@ static int dbpf_dspace_getattr_op_svc(st
     dbpf_attr_cache_insert(ref, attr);
     gen_mutex_unlock(&dbpf_attr_cache_mutex);
 
+    return 0;
+}
+
+static int dbpf_dspace_getattr_op_svc(struct dbpf_op *op_p)
+{
+    int ret = -TROVE_EINVAL;
+    TROVE_object_ref ref = {op_p->handle, op_p->coll_p->coll_id};
+
+    ret = getattr_one_handle(ref, 
+        op_p->u.d_getattr.attr_p, 
+        op_p->coll_p->ds_db);
+
+    if(ret < 0)
+    {
+        return(ret);
+    }
+
     return 1;
-    
-return_error:
-    return ret;
 }
 
 static int dbpf_dspace_getattr_list_op_svc(struct dbpf_op *op_p)
 {
     int i;
+    TROVE_object_ref ref;
 
     for (i = 0; i < op_p->u.d_getattr_list.count; i++)
     {
-        int ret;
-        TROVE_ds_storedattr_s s_attr;
-        TROVE_ds_attributes *attr = NULL;
-        struct stat b_stat;
-        DBT key, data;
-        struct open_cache_ref tmp_ref;
-        TROVE_object_ref ref;
-        TROVE_size b_size = 0, k_size = 0;
-        DB_BTREE_STAT *k_stat_p = NULL;
-
-        ref.handle = op_p->u.d_getattr_list.handle_array[i];
-        ref.fs_id = op_p->coll_p->coll_id;
-        /* It is still possible that we could hit in the attribute cache because of the way
-         * we do queueing in the getattr_list operation 
-         */
-        if (dbpf_attr_cache_ds_attr_fetch_cached_data(ref, &op_p->u.d_getattr_list.attr_p[i]) == 0)
-        {
-            UPDATE_PERF_METADATA_READ();
-            op_p->u.d_getattr_list.error_p[i] = 0;
-            continue;
-        }
-
-        /* get an fd for the bstream so we can check size */
-        ret = dbpf_open_cache_get(
-            op_p->coll_p->coll_id, op_p->u.d_getattr_list.handle_array[i], 0, &tmp_ref);
-        if (ret < 0)
-        {
-        }
-        else
-        {
-            ret = DBPF_FSTAT(tmp_ref.fd, &b_stat);
-            dbpf_open_cache_put(&tmp_ref);
-            if (ret < 0)
-            {
-                op_p->u.d_getattr_list.error_p[i] = -TROVE_EBADF;
-                continue;
-            }
-            b_size = (TROVE_size)b_stat.st_size;
-        }
-
-        ret = op_p->coll_p->ds_db->stat(op_p->coll_p->ds_db,
-#ifdef HAVE_TXNID_PARAMETER_TO_DB_STAT
-                                        (DB_TXN *) NULL,
-#endif
-                                        &k_stat_p,
-#ifdef HAVE_UNKNOWN_PARAMETER_TO_DB_STAT
-                                        NULL,
-#endif
-                                        0);
-        if (ret == 0)
+        if(op_p->u.d_getattr_list.attr_p[i].type != PVFS_TYPE_NONE)
         {
-            k_size = (TROVE_size) k_stat_p->bt_ndata;
-            free(k_stat_p);
-        }
-        else
-        {
-            gossip_err("Error: unable to stat handle %llu (%llx).\n",
-                       llu(op_p->handle), llu(op_p->handle));
-            op_p->u.d_getattr_list.error_p[i] = -TROVE_EIO;
+            /* we already serviced this one from the cache at post time;
+             * skip to the next element
+             */
+            gossip_debug(GOSSIP_TROVE_DEBUG, 
+                "dbpf_dspace_getattr_list_op_svc() skipping element %d resolved from cache.\n", i);
             continue;
         }
 
-        memset(&key, 0, sizeof(key));
-        key.data = &op_p->u.d_getattr_list.handle_array[i];
-        key.size = key.ulen = sizeof(TROVE_handle);
-
-        memset(&data, 0, sizeof(data));
-        memset(&s_attr, 0, sizeof(TROVE_ds_storedattr_s));
-        data.data = &s_attr;
-        data.size = data.ulen = sizeof(TROVE_ds_storedattr_s);
-        data.flags |= DB_DBT_USERMEM;
-
-        ret = op_p->coll_p->ds_db->get(op_p->coll_p->ds_db, 
-                                       NULL, &key, &data, 0);
-        if (ret != 0)
-        {
-            op_p->coll_p->ds_db->err(op_p->coll_p->ds_db, ret, "DB->get");
-            op_p->u.d_getattr_list.error_p[i] = -TROVE_EIO;
-            continue;
-        }
+        ref.handle = op_p->u.d_getattr_list.handle_array[i];
+        ref.fs_id = op_p->coll_p->coll_id;
 
-        gossip_debug(
-            GOSSIP_TROVE_DEBUG, "ATTRIB: retrieved attributes "
-            "from DISK for key %llu\n\tuid = %d, mode = %d, type = %d, "
-            "dfile_count = %d, dist_size = %d\n\tb_size = %lld, k_size = %lld\n",
-            llu(op_p->u.d_getattr_list.handle_array[i]), (int)s_attr.uid, (int)s_attr.mode,
-            (int)s_attr.type, (int)s_attr.dfile_count, (int)s_attr.dist_size,
-            llu(b_size), llu(k_size));
-
-        attr = &op_p->u.d_getattr_list.attr_p[i];
-        trove_ds_stored_to_attr(s_attr, *attr, b_size);
-
-        /* add retrieved ds_attr to dbpf_attr cache here */
-        gen_mutex_lock(&dbpf_attr_cache_mutex);
-        dbpf_attr_cache_insert(ref, attr);
-        gen_mutex_unlock(&dbpf_attr_cache_mutex);
-        op_p->u.d_getattr_list.error_p[i] = 0;
+        op_p->u.d_getattr_list.error_p[i] = getattr_one_handle(ref,
+           &op_p->u.d_getattr_list.attr_p[i],
+           op_p->coll_p->ds_db);
     }
 
     return 1;

Index: dbpf-keyval.c
===================================================================
RCS file: /anoncvs/pvfs2/src/io/trove/trove-dbpf/dbpf-keyval.c,v
diff -p -u -r1.86 -r1.86.2.1
--- dbpf-keyval.c	4 Mar 2008 00:22:12 -0000	1.86
+++ dbpf-keyval.c	16 May 2008 15:15:47 -0000	1.86.2.1
@@ -1471,7 +1471,7 @@ static int dbpf_keyval_iterate_skip_to_p
         /* strip the session out of the position; we need to use a true
          * integer offset if we get past the cache
          */
-        pos = pos & 0xffff;
+        pos = pos & 0xffffffff;
         return dbpf_keyval_iterate_step_to_position(handle, pos, dbc_p);
     }
 

Index: dbpf-mgmt.c
===================================================================
RCS file: /anoncvs/pvfs2/src/io/trove/trove-dbpf/dbpf-mgmt.c,v
diff -p -u -r1.100 -r1.100.2.1
--- dbpf-mgmt.c	28 Jan 2008 19:43:31 -0000	1.100
+++ dbpf-mgmt.c	16 May 2008 15:15:47 -0000	1.100.2.1
@@ -1900,12 +1900,17 @@ static __dbpf_op_type_str_map_t s_dbpf_o
     { KEYVAL_READ_LIST, "KEYVAL_READ_LIST" },
     { KEYVAL_WRITE_LIST, "KEYVAL_WRITE_LIST" },
     { KEYVAL_FLUSH, "KEYVAL_FLUSH" },
+    { KEYVAL_GET_HANDLE_INFO, "KEYVAL_GET_HANDLE_INFO" },
     { DSPACE_CREATE, "DSPACE_CREATE" },
     { DSPACE_REMOVE, "DSPACE_REMOVE" },
     { DSPACE_ITERATE_HANDLES, "DSPACE_ITERATE_HANDLES" },
     { DSPACE_VERIFY, "DSPACE_VERIFY" },
     { DSPACE_GETATTR, "DSPACE_GETATTR" },
-    { DSPACE_SETATTR, "DSPACE_SETATTR" }
+    { DSPACE_SETATTR, "DSPACE_SETATTR" },
+    { DSPACE_GETATTR_LIST, "DSPACE_GETATTR_LIST" }
+    /* NOTE: this list should be kept in sync with enum dbpf_op_type 
+     * from dbpf.h 
+     */ 
 };
 
 char *dbpf_op_type_to_str(enum dbpf_op_type op_type)

Index: dbpf.h
===================================================================
RCS file: /anoncvs/pvfs2/src/io/trove/trove-dbpf/dbpf.h,v
diff -p -u -r1.83 -r1.83.4.1
--- dbpf.h	18 Jan 2008 18:41:13 -0000	1.83
+++ dbpf.h	16 May 2008 15:15:47 -0000	1.83.4.1
@@ -455,6 +455,9 @@ enum dbpf_op_type
     DSPACE_GETATTR,
     DSPACE_SETATTR,
     DSPACE_GETATTR_LIST,
+    /* NOTE: if you change or add items to this list, please update
+     * s_dbpf_op_type_str_map[] accordingly (dbpf-mgmt.c)
+     */
 };
 
 #define DBPF_OP_DOES_SYNC(__op)    \

Index: module.mk.in
===================================================================
RCS file: /anoncvs/pvfs2/src/io/trove/trove-dbpf/module.mk.in,v
diff -p -u -r1.20 -r1.20.18.1
--- module.mk.in	18 Oct 2006 16:01:12 -0000	1.20
+++ module.mk.in	16 May 2008 15:15:47 -0000	1.20.18.1
@@ -15,7 +15,8 @@ SERVERSRC += \
 	$(DIR)/dbpf-mgmt.c \
 	$(DIR)/dbpf-keyval-pcache.c \
 	$(DIR)/dbpf-sync.c \
-	$(DIR)/dbpf-alt-aio.c 
+	$(DIR)/dbpf-alt-aio.c \
+	$(DIR)/dbpf-null-aio.c 
 
 # Grab trove-ledger.h from handle-mgmt.  Also make _GNU_SOURCE definition 
 # required for access to pread/pwrite on Linux.  _XOPEN_SOURCE seems to be



More information about the Pvfs2-cvs mailing list