[Pvfs2-cvs] commit by pcarns in pvfs2-1/src/io/trove/trove-dbpf: dbpf-keyval.c

CVS commit program cvs at parl.clemson.edu
Mon Feb 25 16:12:18 EST 2008


Update of /projects/cvsroot/pvfs2-1/src/io/trove/trove-dbpf
In directory parlweb1:/tmp/cvs-serv3062

Modified Files:
      Tag: small-file-branch
	dbpf-keyval.c 
Log Message:
tweaks to binary key handling


Index: dbpf-keyval.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/io/trove/trove-dbpf/dbpf-keyval.c,v
diff -p -u -r1.85.6.8 -r1.85.6.9
--- dbpf-keyval.c	25 Feb 2008 20:21:21 -0000	1.85.6.8
+++ dbpf-keyval.c	25 Feb 2008 21:12:18 -0000	1.85.6.9
@@ -181,7 +181,7 @@ static int dbpf_keyval_read(TROVE_coll_i
 
     gen_mutex_lock(&dbpf_attr_cache_mutex);
     cache_elem = dbpf_attr_cache_elem_lookup(ref);
-    if (cache_elem)
+    if (cache_elem && (!(flags & TROVE_BINARY_KEY)))
     {
         dbpf_keyval_pair_cache_elem_t *keyval_pair =
             dbpf_attr_cache_elem_get_data_based_on_key(
@@ -276,30 +276,30 @@ static int dbpf_keyval_read_op_svc(struc
     op_p->u.k_read.val->read_sz = data.size;
 
     /* cache this data in the attr cache if we can */
-    gen_mutex_lock(&dbpf_attr_cache_mutex);
-    if (dbpf_attr_cache_elem_set_data_based_on_key(
-            ref, key_entry.key,
-            op_p->u.k_read.val->buffer, data.size))
+    if(!(op_p->flags & TROVE_BINARY_KEY))
     {
-        /*
-         * NOTE: this can happen if the keyword isn't registered, or if
-         * there is no associated cache_elem for this key
-         */
-        if(!(op_p->flags & TROVE_BINARY_KEY))
+        gen_mutex_lock(&dbpf_attr_cache_mutex);
+        if (dbpf_attr_cache_elem_set_data_based_on_key(
+                ref, key_entry.key,
+                op_p->u.k_read.val->buffer, data.size))
         {
+            /*
+             * NOTE: this can happen if the keyword isn't registered, or if
+             * there is no associated cache_elem for this key
+             */
             gossip_debug(
                 GOSSIP_DBPF_ATTRCACHE_DEBUG,"** CANNOT cache data retrieved "
                 "(key is %s)\n", (char *)key_entry.key);
         }
+        else
+        {
+            gossip_debug(
+                GOSSIP_DBPF_ATTRCACHE_DEBUG,"*** cached keyval data "
+                "retrieved (key is %s)\n",
+                (char *)key_entry.key);
+        }
+        gen_mutex_unlock(&dbpf_attr_cache_mutex);
     }
-    else
-    {
-        gossip_debug(
-            GOSSIP_DBPF_ATTRCACHE_DEBUG,"*** cached keyval data "
-            "retrieved (key is %s)\n",
-            (char *)key_entry.key);
-    }
-    gen_mutex_unlock(&dbpf_attr_cache_mutex);
 
     return 1;
 
@@ -479,36 +479,35 @@ static int dbpf_keyval_write_op_svc(stru
      * now that the data is written to disk, update the cache if it's
      * an attr keyval we manage.
      */
-    gen_mutex_lock(&dbpf_attr_cache_mutex);
-    cache_elem = dbpf_attr_cache_elem_lookup(ref);
-    if (cache_elem)
+    if(!(op_p->flags & TROVE_BINARY_KEY))
     {
-        if (dbpf_attr_cache_elem_set_data_based_on_key(
-                ref, key_entry.key,
-                op_p->u.k_write.val.buffer, data.size))
+        gen_mutex_lock(&dbpf_attr_cache_mutex);
+        cache_elem = dbpf_attr_cache_elem_lookup(ref);
+        if (cache_elem)
         {
-            /*
-             * NOTE: this can happen if the keyword isn't registered,
-             * or if there is no associated cache_elem for this key
-             */
-            if(!(op_p->flags & TROVE_BINARY_KEY))
+            if (dbpf_attr_cache_elem_set_data_based_on_key(
+                    ref, key_entry.key,
+                    op_p->u.k_write.val.buffer, data.size))
             {
+                /*
+                 * NOTE: this can happen if the keyword isn't registered,
+                 * or if there is no associated cache_elem for this key
+                 */
                 gossip_debug(
                     GOSSIP_DBPF_ATTRCACHE_DEBUG,"** CANNOT cache data written "
                     "(key is %s)\n", (char *)key_entry.key);
             }
+            else
+            {
+                gossip_debug(
+                    GOSSIP_DBPF_ATTRCACHE_DEBUG,"*** cached keyval data "
+                    "written (key is %s)\n",
+                    (char *)key_entry.key);
+            }
         }
-        else
-        {
-            gossip_debug(
-                GOSSIP_DBPF_ATTRCACHE_DEBUG,"*** cached keyval data "
-                "written (key is %s)\n",
-                (char *)key_entry.key);
-        }
+        gen_mutex_unlock(&dbpf_attr_cache_mutex);
     }
 
-    gen_mutex_unlock(&dbpf_attr_cache_mutex);
-
     ret = DBPF_OP_COMPLETE;
     PINT_perf_count(PINT_server_pc, PINT_PERF_METADATA_KEYVAL_OPS,
                     1, PINT_PERF_SUB);
@@ -1332,35 +1331,35 @@ static int dbpf_keyval_write_list_op_svc
            now that the data is written to disk, update the cache if it's
            an attr keyval we manage.
            */
-        gen_mutex_lock(&dbpf_attr_cache_mutex);
-        cache_elem = dbpf_attr_cache_elem_lookup(ref);
-        if (cache_elem)
+        if(!(op_p->flags & TROVE_BINARY_KEY))
         {
-            if (dbpf_attr_cache_elem_set_data_based_on_key(
-                    ref, key_entry.key,
-                    data.data, data.size))
+            gen_mutex_lock(&dbpf_attr_cache_mutex);
+            cache_elem = dbpf_attr_cache_elem_lookup(ref);
+            if (cache_elem)
             {
-                /*
-NOTE: this can happen if the keyword isn't registered,
-or if there is no associated cache_elem for this key
-*/
-                if(!(op_p->flags & TROVE_BINARY_KEY))
+                if (dbpf_attr_cache_elem_set_data_based_on_key(
+                        ref, key_entry.key,
+                        data.data, data.size))
                 {
+                    /*
+    NOTE: this can happen if the keyword isn't registered,
+    or if there is no associated cache_elem for this key
+    */
                     gossip_debug(
                         GOSSIP_DBPF_ATTRCACHE_DEBUG,"** CANNOT cache data written "
                         "(key is %s)\n", 
                         (char *)key_entry.key);
                 }
+                else
+                {
+                    gossip_debug(
+                        GOSSIP_DBPF_ATTRCACHE_DEBUG,"*** cached keyval data "
+                        "written (key is %s)\n",
+                        (char *)key_entry.key);
+                }
             }
-            else
-            {
-                gossip_debug(
-                    GOSSIP_DBPF_ATTRCACHE_DEBUG,"*** cached keyval data "
-                    "written (key is %s)\n",
-                    (char *)key_entry.key);
-            }
+            gen_mutex_unlock(&dbpf_attr_cache_mutex);
         }
-        gen_mutex_unlock(&dbpf_attr_cache_mutex);
     }
 
     ret = DBPF_OP_COMPLETE;



More information about the Pvfs2-cvs mailing list