[PVFS2-CVS]
commit by neill in pvfs2/src/io/trove/trove-dbpf: dbpf-attr-cache.c
dbpf-dspace.c dbpf-keyval.c
CVS commit program
cvs at parl.clemson.edu
Fri Feb 27 14:05:40 EST 2004
Update of /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf
In directory parlweb:/tmp/cvs-serv15615/src/io/trove/trove-dbpf
Modified Files:
dbpf-attr-cache.c dbpf-dspace.c dbpf-keyval.c
Log Message:
- properly cache attributes at create and write time instead of waiting
until the first read is done
Index: dbpf-attr-cache.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-attr-cache.c,v
diff -p -u -r1.10 -r1.11
--- dbpf-attr-cache.c 30 Jan 2004 20:12:12 -0000 1.10
+++ dbpf-attr-cache.c 27 Feb 2004 19:05:40 -0000 1.11
@@ -433,35 +433,6 @@ int dbpf_attr_cache_elem_set_data_based_
return ret;
}
-int dbpf_attr_cache_keyval_pair_update_cached_data(
- dbpf_attr_cache_elem_t *cache_elem,
- dbpf_keyval_pair_cache_elem_t *keyval_pair,
- void *src_data, int src_data_sz)
-{
- int ret = -1;
-
- if (DBPF_ATTR_CACHE_INITIALIZED() && (keyval_pair && src_data))
- {
- gen_mutex_lock(s_dbpf_attr_mutex);
- DBPF_ATTR_CACHE_ASSERT_OK(ret);
-
- if (cache_elem && keyval_pair)
- {
- if (keyval_pair->data)
- {
- free(keyval_pair->data);
- }
- keyval_pair->data = malloc(src_data_sz);
- assert(keyval_pair->data);
- memcpy(keyval_pair->data, src_data, src_data_sz);
- keyval_pair->data_sz = src_data_sz;
- ret = 0;
- }
- gen_mutex_unlock(s_dbpf_attr_mutex);
- }
- return ret;
-}
-
int dbpf_attr_cache_keyval_pair_fetch_cached_data(
dbpf_attr_cache_elem_t *cache_elem,
dbpf_keyval_pair_cache_elem_t *keyval_pair,
Index: dbpf-dspace.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-dspace.c,v
diff -p -u -r1.91 -r1.92
--- dbpf-dspace.c 23 Feb 2004 19:35:06 -0000 1.91
+++ dbpf-dspace.c 27 Feb 2004 19:05:40 -0000 1.92
@@ -150,6 +150,7 @@ static int dbpf_dspace_create_op_svc(str
{
int ret, got_db = 0, error = -TROVE_EINVAL;
TROVE_ds_storedattr_s s_attr;
+ TROVE_ds_attributes attr;
TROVE_handle new_handle = TROVE_HANDLE_NULL;
DBT key, data;
DB *db_p;
@@ -264,6 +265,11 @@ static int dbpf_dspace_create_op_svc(str
error = -dbpf_db_error_to_trove_error(ret);
goto return_error;
}
+
+ trove_ds_stored_to_attr(s_attr, attr, 0, 0);
+
+ /* add retrieved ds_attr to dbpf_attr cache here */
+ dbpf_attr_cache_insert(new_handle, &attr);
DBPF_DB_SYNC_IF_NECESSARY(op_p, db_p);
Index: dbpf-keyval.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-keyval.c,v
diff -p -u -r1.35 -r1.36
--- dbpf-keyval.c 23 Feb 2004 19:35:06 -0000 1.35
+++ dbpf-keyval.c 27 Feb 2004 19:05:40 -0000 1.36
@@ -268,23 +268,34 @@ static int dbpf_keyval_write_op_svc(stru
goto return_error;
}
- /*
- now that the data is written to disk, update
- the cache if it's an attr keyval we manage
- */
gossip_debug(GOSSIP_DBPF_ATTRCACHE_DEBUG, "*** Trove KeyVal Write "
"of %s\n", (char *)op_p->u.k_write.key.buffer);
+ /*
+ now that the data is written to disk, update the cache if it's
+ an attr keyval we manage.
+ */
cache_elem = dbpf_attr_cache_elem_lookup(op_p->handle);
if (cache_elem)
{
- dbpf_keyval_pair_cache_elem_t *keyval_pair =
- dbpf_attr_cache_elem_get_data_based_on_key(
- cache_elem, op_p->u.k_write.key.buffer);
- if (keyval_pair)
+ if (dbpf_attr_cache_elem_set_data_based_on_key(
+ op_p->handle, op_p->u.k_write.key.buffer,
+ 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 *)op_p->u.k_write.key.buffer);
+ }
+ else
{
- dbpf_attr_cache_keyval_pair_update_cached_data(
- cache_elem, keyval_pair, data.data, data.size);
+ gossip_debug(
+ GOSSIP_DBPF_ATTRCACHE_DEBUG,"*** cached keyval data "
+ "written (key is %s)\n",
+ (char *)op_p->u.k_write.key.buffer);
}
}
More information about the PVFS2-CVS
mailing list