summaryrefslogtreecommitdiffstats
path: root/src/H5FPserver.c
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2003-08-15 00:30:21 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2003-08-15 00:30:21 (GMT)
commitad13ea65abf246f25841f1bb32ee232c1767b9df (patch)
tree0ced53d37b2689643234f6919cc5f101bc905081 /src/H5FPserver.c
parentef90db21a40b8892b79991ecb66b29b305e102de (diff)
downloadhdf5-ad13ea65abf246f25841f1bb32ee232c1767b9df.zip
hdf5-ad13ea65abf246f25841f1bb32ee232c1767b9df.tar.gz
hdf5-ad13ea65abf246f25841f1bb32ee232c1767b9df.tar.bz2
[svn-r7367] Purpose:
Update Description: Added an extra flag to the clear functions that triggers a "destroy" of the object being cleared if necessary. This is a fix for the FPHDF5 stuff which had an object sticking around after it was cleared. (In FPHDF5, some processes are in charge of destroying the object, but all processes might actually allocate the object.) Platforms tested: AIX (Copper: Fortran & C++) Linux (Verbena: Fortran & C++) IRIX (Modi4: Parallel & Fortran) (Sol is down) Misc. update:
Diffstat (limited to 'src/H5FPserver.c')
-rw-r--r--src/H5FPserver.c87
1 files changed, 70 insertions, 17 deletions
diff --git a/src/H5FPserver.c b/src/H5FPserver.c
index 36a6fa8..d9f5d7c 100644
--- a/src/H5FPserver.c
+++ b/src/H5FPserver.c
@@ -28,8 +28,10 @@
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata Cache */
#include "H5Eprivate.h" /* Error Handling */
-#include "H5FDprivate.h" /* File driver */
+#include "H5FDprivate.h" /* File Driver */
#include "H5Oprivate.h" /* Object Headers */
+#include "H5Pprivate.h" /* Property List */
+#include "H5Rprivate.h" /* References */
#include "H5TBprivate.h" /* Threaded, Balanced, Binary Trees */
#ifdef H5_HAVE_FPHDF5
@@ -54,7 +56,7 @@ static int interface_initialize_g = 0;
* appropriate H5FP_file_info structure.
*/
typedef struct {
- uint8_t oid[H5R_OBJ_REF_BUF_SIZE]; /* Buffer to store OID of object */
+ hobj_ref_t oid; /* Buffer to store OID of object */
unsigned owned_rank; /* rank which has the lock */
H5FP_obj_t obj_type; /* type of object being locked */
unsigned ref_count; /* number of times lock was aquired by proc */
@@ -116,13 +118,13 @@ static unsigned H5FP_gen_sap_file_id(void);
static int H5FP_object_lock_cmp(H5FP_object_lock *o1,
H5FP_object_lock *o2,
int cmparg);
-static H5FP_object_lock *H5FP_new_object_lock(const unsigned char *oid,
+static H5FP_object_lock *H5FP_new_object_lock(hobj_ref_t oid,
unsigned rank,
H5FP_obj_t obj_type,
H5FP_lock_t rw_lock);
static herr_t H5FP_free_object_lock(H5FP_object_lock *ol);
static H5FP_object_lock *H5FP_find_object_lock(H5FP_file_info *info,
- unsigned char *oid);
+ hobj_ref_t oid);
static herr_t H5FP_remove_object_lock_from_list(H5FP_file_info *info,
H5FP_object_lock *ol);
@@ -162,6 +164,7 @@ static herr_t H5FP_sap_handle_flush_request(H5FP_request_t *req);
static herr_t H5FP_sap_handle_close_request(H5FP_request_t *req);
static herr_t H5FP_sap_handle_alloc_request(H5FP_request_t *req);
static herr_t H5FP_sap_handle_free_request(H5FP_request_t *req);
+static herr_t H5FP_sap_handle_update_eoma_eosda_request(H5FP_request_t *req);
/*
*===----------------------------------------------------------------------===
@@ -237,6 +240,9 @@ H5FP_sap_receive_loop(void)
case H5FP_REQ_FREE:
hrc = H5FP_sap_handle_free_request(&req);
break;
+ case H5FP_REQ_UPDATE_EOMA_EOSDA:
+ hrc = H5FP_sap_handle_update_eoma_eosda_request(&req);
+ break;
case H5FP_REQ_STOP:
hrc = SUCCEED;
if (++stop == comm_size - 1)
@@ -307,7 +313,7 @@ H5FP_object_lock_cmp(H5FP_object_lock *o1,
FUNC_ENTER_NOINIT(H5FP_object_lock_cmp);
assert(o1);
assert(o2);
- FUNC_LEAVE_NOAPI(HDmemcmp(o1->oid, o2->oid, sizeof(o1->oid)));
+ FUNC_LEAVE_NOAPI(o1->oid == o2->oid);
}
/*
@@ -325,18 +331,17 @@ H5FP_object_lock_cmp(H5FP_object_lock *o1,
* Modifications:
*/
static H5FP_object_lock *
-H5FP_new_object_lock(const unsigned char *oid, unsigned rank,
- H5FP_obj_t obj_type, H5FP_lock_t rw_lock)
+H5FP_new_object_lock(hobj_ref_t oid, unsigned rank, H5FP_obj_t obj_type,
+ H5FP_lock_t rw_lock)
{
H5FP_object_lock *ret_value = NULL;
FUNC_ENTER_NOINIT(H5FP_new_object_lock);
- assert(oid);
if ((ret_value = (H5FP_object_lock *)HDmalloc(sizeof(H5FP_object_lock))) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "out of memory");
- H5FP_COPY_OID(ret_value->oid, oid);
+ ret_value->oid = oid;
ret_value->owned_rank = rank;
ret_value->obj_type = obj_type;
ret_value->ref_count = 1;
@@ -370,7 +375,7 @@ H5FP_free_object_lock(H5FP_object_lock *ol)
* Modifications:
*/
static H5FP_object_lock *
-H5FP_find_object_lock(H5FP_file_info *info, unsigned char *oid)
+H5FP_find_object_lock(H5FP_file_info *info, hobj_ref_t oid)
{
H5FP_object_lock *ret_value = NULL;
@@ -383,7 +388,7 @@ H5FP_find_object_lock(H5FP_file_info *info, unsigned char *oid)
H5TB_NODE *node;
H5FP_object_lock ol;
- H5FP_COPY_OID(ol.oid, oid); /* This is the key field for the TBBT */
+ ol.oid = oid; /* This is the key field for the TBBT */
if ((node = H5TB_dfind(info->locks, (void *)&ol, NULL)) == NULL)
HGOTO_ERROR(H5E_FPHDF5, H5E_NOTFOUND, NULL, "lock not found");
@@ -924,7 +929,7 @@ static herr_t
H5FP_sap_handle_lock_request(H5FP_request_t *req)
{
struct lock_group {
- unsigned char oid[sizeof(req->oid)];
+ hobj_ref_t oid;
unsigned file_id;
unsigned locked;
H5FP_lock_t rw_lock;
@@ -949,7 +954,7 @@ H5FP_sap_handle_lock_request(H5FP_request_t *req)
* at one time.
*/
for (i = 0;; ++i) {
- if (req->oid[0]) {
+ if (req->oid) {
if (i == list_size) {
list_size <<= 1; /* equiv to list_size *= 2; */
oids = HDrealloc(oids, list_size * sizeof(struct lock_group));
@@ -960,7 +965,7 @@ H5FP_sap_handle_lock_request(H5FP_request_t *req)
}
}
- H5FP_COPY_OID(oids[i].oid, req->oid);
+ oids[i].oid = req->oid;
oids[i].file_id = req->file_id;
oids[i].rw_lock = req->rw_lock;
oids[i].locked = FALSE;
@@ -1127,7 +1132,7 @@ static herr_t
H5FP_sap_handle_release_lock_request(H5FP_request_t *req)
{
struct release_group {
- unsigned char oid[sizeof(req->oid)];
+ hobj_ref_t oid;
unsigned file_id;
H5FP_file_info *info;
H5FP_object_lock *lock;
@@ -1150,7 +1155,7 @@ H5FP_sap_handle_release_lock_request(H5FP_request_t *req)
* release locks at one time.
*/
for (i = 0;; ++i) {
- if (req->oid[0]) {
+ if (req->oid) {
if (i == list_size) {
list_size <<= 1; /* equiv to list_size *= 2; */
oids = HDrealloc(oids, list_size * sizeof(struct release_group));
@@ -1161,7 +1166,7 @@ H5FP_sap_handle_release_lock_request(H5FP_request_t *req)
}
}
- H5FP_COPY_OID(oids[i].oid, req->oid);
+ oids[i].oid = req->oid;
oids[i].file_id = req->file_id;
}
@@ -1548,6 +1553,54 @@ H5FP_sap_handle_free_request(H5FP_request_t *req)
sap_alloc.req_id = req->req_id;
sap_alloc.file_id = req->file_id;
sap_alloc.status = H5FP_STATUS_OK;
+ sap_alloc.mem_type = req->mem_type;
+
+ if ((info = H5FP_find_file_info(req->file_id)) != NULL) {
+ if (H5FD_free((H5FD_t*)&info->file, req->mem_type, H5P_DEFAULT,
+ req->addr, req->meta_block_size) != SUCCEED) {
+ exit_state = H5FP_STATUS_CANT_FREE;
+ sap_alloc.status = H5FP_STATUS_CANT_FREE;
+ HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL,
+ "SAP unable to free metadata block");
+ }
+
+ /* Get the EOA - This call doesn't fail */
+ sap_alloc.eoa = ((H5FD_t*)&info->file)->cls->get_eoa((H5FD_t*)&info->file);
+ sap_alloc.status = H5FP_STATUS_OK;
+ } else {
+ sap_alloc.status = H5FP_STATUS_CANT_FREE;
+ }
+
+done:
+ if ((mrc = MPI_Send(&sap_alloc, 1, H5FP_alloc, (int)req->proc_rank,
+ H5FP_TAG_ALLOC, H5FP_SAP_COMM)) != MPI_SUCCESS)
+ HMPI_DONE_ERROR(FAIL, "MPI_Send failed", mrc);
+
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
+/*
+ * Function: H5FP_sap_handle_update_eoma_eosda_request
+ * Purpose: Handle a request to update the EOMA and EOSDA for a file.
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ * Programmer: Bill Wendling, 02. April 2003
+ * Modifications:
+ */
+static herr_t
+H5FP_sap_handle_update_eoma_eosda_request(H5FP_request_t *req)
+{
+ H5FP_alloc_t sap_alloc;
+ H5FP_file_info *info;
+ H5FP_status_t exit_state = H5FP_STATUS_OK;
+ herr_t ret_value = SUCCEED;
+ int mrc;
+
+ FUNC_ENTER_NOINIT(H5FP_sap_handle_update_eoma_eosda_request);
+
+ sap_alloc.req_id = req->req_id;
+ sap_alloc.file_id = req->file_id;
+ sap_alloc.status = H5FP_STATUS_OK;
sap_alloc.addr = HADDR_UNDEF;
if ((info = H5FP_find_file_info(req->file_id)) != NULL) {