[Pvfs2-cvs] commit by slang in pvfs2/src/io/trove/trove-dbpf:
dbpf-dspace.c dbpf-keyval.c dbpf-mgmt.c dbpf.h
CVS commit program
cvs at parl.clemson.edu
Tue Dec 5 19:39:05 EST 2006
Update of /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf
In directory parlweb1:/tmp/cvs-serv9364/src/io/trove/trove-dbpf
Modified Files:
Tag: pvfs-2-6-branch
dbpf-dspace.c dbpf-keyval.c dbpf-mgmt.c dbpf.h
Log Message:
merge changes from trunk to 2.6 branch: this fix uses the keyval_iterate_keys to see if any entries exist in a directory, instead of looking at the directory count. This is a workaround in case the directory count becomes invalid somehow (as seen on bgl).
Index: dbpf-dspace.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-dspace.c,v
diff -p -u -r1.141 -r1.141.8.1
--- dbpf-dspace.c 25 Sep 2006 23:48:23 -0000 1.141
+++ dbpf-dspace.c 6 Dec 2006 00:39:05 -0000 1.141.8.1
@@ -100,6 +100,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 dbpf_dspace_iterate_handles_op_svc(struct dbpf_op *op_p);
static int dbpf_dspace_create_op_svc(struct dbpf_op *op_p);
static int dbpf_dspace_remove_op_svc(struct dbpf_op *op_p);
@@ -437,7 +440,7 @@ static int dbpf_dspace_remove_op_svc(str
NULL,
&count,
TROVE_ITERATE_START,
- PINT_dbpf_keyval_remove);
+ dbpf_dspace_remove_keyval);
if(ret != 0 && ret != -TROVE_ENOENT)
{
goto return_error;
@@ -461,6 +464,22 @@ static int dbpf_dspace_remove_op_svc(str
return_error:
return ret;
+}
+
+static int dbpf_dspace_remove_keyval(
+ void * args, TROVE_handle handle, TROVE_keyval_s *key, TROVE_keyval_s *val)
+{
+ int ret;
+ DBC * dbc_p = (DBC *)args;
+
+ ret = dbc_p->c_del(dbc_p, 0);
+ if(ret != 0)
+ {
+ ret = -dbpf_db_error_to_trove_error(ret);
+ }
+
+ return ret;
+
}
static int dbpf_dspace_iterate_handles(TROVE_coll_id coll_id,
Index: dbpf-keyval.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-keyval.c,v
diff -p -u -r1.78 -r1.78.8.1
--- dbpf-keyval.c 22 Sep 2006 19:27:31 -0000 1.78
+++ dbpf-keyval.c 6 Dec 2006 00:39:05 -0000 1.78.8.1
@@ -40,8 +40,34 @@
extern int synccount;
+/**
+ * Structure for key in the keyval DB:
+ *
+ * The keys in the keyval database are now stored as the following
+ * struct (dbpf_keyval_db_entry). The size of key field (the common
+ * name or component name of the key) is not explicitly specified in the
+ * struct, instead it is calculated from the DBT->size field of the
+ * berkeley db key using the macros below. Its important that the
+ * 'size' and 'ulen' fields of the DBT key struct are set correctly when
+ * calling get and put. 'size' should be the actual size of the string, 'ulen'
+ * should be the size available for the dbpf_keyval_db_entry struct, most
+ * likely sizeof(struct dbpf_keyval_db_entry).
+ */
+
#define DBPF_MAX_KEY_LENGTH PVFS_NAME_MAX
+struct dbpf_keyval_db_entry
+{
+ TROVE_handle handle;
+ char key[DBPF_MAX_KEY_LENGTH];
+};
+
+#define DBPF_KEYVAL_DB_ENTRY_TOTAL_SIZE(_size) \
+ (sizeof(TROVE_handle) + _size)
+
+#define DBPF_KEYVAL_DB_ENTRY_KEY_SIZE(_size) \
+ (_size - sizeof(TROVE_handle))
+
/**
* The keyval database contains attributes for pvfs2 handles
* (files, directories, symlinks, etc.) that are not considered
@@ -59,7 +85,9 @@ extern int synccount;
* symlink COMMON "st" Target Handle
* directory COMMON "de" Entries Handle
* dir-ent COMPONENT <component name> Entry Handle
- * ALL XATTR <extended attribute name> <extended attribute content>
+ * [metafile,
+ * symlink,
+ * directory] XATTR <extended attribute name> <extended attribute content>
*
* The descriptions for the common keys are:
*
@@ -79,34 +107,11 @@ extern int synccount;
* passed in through the API.
*/
-/**
- * Structure for key in the keyval DB:
- *
- * The keys in the keyval database are now stored as the following
- * struct (dbpf_keyval_db_entry). The size of key field (the common
- * name or component name of the key) is not explicitly specified in the
- * struct, instead it is calculated from the DBT->size field of the
- * berkeley db key using the macros below. Its important that the
- * 'size' and 'ulen' fields of the DBT key struct are set correctly when
- * calling get and put. 'size' should be the actual size of the string, 'ulen'
- * should be the size available for the dbpf_keyval_db_entry struct, most
- * likely sizeof(struct dbpf_keyval_db_entry).
- */
-
-struct dbpf_keyval_db_entry
-{
- TROVE_handle handle;
- char key[DBPF_MAX_KEY_LENGTH];
-};
-
-#define DBPF_KEYVAL_DB_ENTRY_TOTAL_SIZE(_size) \
- (sizeof(TROVE_handle) + _size)
-
-#define DBPF_KEYVAL_DB_ENTRY_KEY_SIZE(_size) \
- (_size - sizeof(TROVE_handle))
-
extern gen_mutex_t dbpf_attr_cache_mutex;
+static int dbpf_keyval_do_remove(
+ DB *db_p, TROVE_handle handle, TROVE_keyval_s *key, TROVE_keyval_s *val);
+
static int dbpf_keyval_read_op_svc(struct dbpf_op *op_p);
static int dbpf_keyval_read_list_op_svc(struct dbpf_op *op_p);
static int dbpf_keyval_write_op_svc(struct dbpf_op *op_p);
@@ -556,9 +561,10 @@ static int dbpf_keyval_remove_op_svc(str
op_p->u.k_remove.key.buffer_sz,
(char *)op_p->u.k_remove.key.buffer);
- ret = PINT_dbpf_keyval_remove(op_p->coll_p->keyval_db, op_p->handle,
- &op_p->u.k_remove.key,
- &op_p->u.k_remove.val);
+ ret = dbpf_keyval_do_remove(op_p->coll_p->keyval_db,
+ op_p->handle,
+ &op_p->u.k_remove.key,
+ &op_p->u.k_remove.val);
if (ret != 0)
{
goto return_error;
@@ -1279,7 +1285,7 @@ int PINT_dbpf_keyval_iterate(
if(callback)
{
key->buffer_sz = key->read_sz;
- ret = callback(db_p, handle, key, NULL);
+ ret = callback(dbc_p, handle, key, NULL);
if(ret != 0)
{
goto return_error;
@@ -1319,7 +1325,7 @@ int PINT_dbpf_keyval_iterate(
if(callback)
{
key->buffer_sz = key->read_sz;
- ret = callback(db_p, handle, key, NULL);
+ ret = callback(dbc_p, handle, key, NULL);
if(ret != 0)
{
goto return_error;
@@ -1343,7 +1349,7 @@ return_error:
return ret;
}
-int PINT_dbpf_keyval_remove(
+static int dbpf_keyval_do_remove(
DB *db_p, TROVE_handle handle, TROVE_keyval_s *key, TROVE_keyval_s *val)
{
int ret;
Index: dbpf-mgmt.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf-mgmt.c,v
diff -p -u -r1.95 -r1.95.6.1
--- dbpf-mgmt.c 23 Oct 2006 21:28:43 -0000 1.95
+++ dbpf-mgmt.c 6 Dec 2006 00:39:05 -0000 1.95.6.1
@@ -120,7 +120,10 @@ retry:
{
/* user wants the standard db cache which uses mmap */
ret = dbenv->open(dbenv, path,
- DB_INIT_MPOOL|DB_CREATE|DB_THREAD, 0);
+ DB_INIT_MPOOL|
+ DB_CREATE|
+ DB_THREAD,
+ 0);
if(ret != 0)
{
gossip_err("dbpf_getdb_env(%s): %s\n", path, db_strerror(ret));
@@ -143,7 +146,11 @@ retry:
}
ret = dbenv->open(dbenv, path,
- DB_INIT_MPOOL|DB_CREATE|DB_THREAD|DB_SYSTEM_MEM, 0);
+ DB_INIT_MPOOL|
+ DB_CREATE|
+ DB_THREAD|
+ DB_SYSTEM_MEM,
+ 0);
/* In some cases (oddly configured systems with pvfs2-server running as
* non-root) DB_SYSTEM_MEM, which uses sysV shared memory, can fail
* with EAGAIN (resource temporarily unavailable). berkely DB can use
@@ -182,7 +189,11 @@ retry:
return NULL;
}
assert(my_storage_p != NULL);
- ret = dbenv->open(dbenv, path, DB_CREATE|DB_THREAD|DB_PRIVATE, 0);
+ ret = dbenv->open(dbenv, path,
+ DB_CREATE|
+ DB_THREAD|
+ DB_PRIVATE,
+ 0);
}
if(ret == DB_RUNRECOVERY)
Index: dbpf.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/trove/trove-dbpf/dbpf.h,v
diff -p -u -r1.79 -r1.79.6.1
--- dbpf.h 18 Oct 2006 16:01:12 -0000 1.79
+++ dbpf.h 6 Dec 2006 00:39:05 -0000 1.79.6.1
@@ -165,7 +165,7 @@ struct dbpf_aio_ops
};
typedef int (* PINT_dbpf_keyval_iterate_callback)(
- DB * db_p, TROVE_handle handle, TROVE_keyval_s *key, TROVE_keyval_s *val);
+ void *, TROVE_handle handle, TROVE_keyval_s *key, TROVE_keyval_s *val);
int PINT_dbpf_keyval_iterate(
DB *db_p,
@@ -176,9 +176,6 @@ int PINT_dbpf_keyval_iterate(
int *count,
TROVE_ds_position pos,
PINT_dbpf_keyval_iterate_callback callback);
-
-int PINT_dbpf_keyval_remove(
- DB *db_p, TROVE_handle handle, TROVE_keyval_s *key, TROVE_keyval_s *val);
struct dbpf_storage
{
More information about the Pvfs2-cvs
mailing list