summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5FPclient.c144
-rw-r--r--src/H5FPprivate.h40
-rw-r--r--src/H5FPserver.c110
3 files changed, 226 insertions, 68 deletions
diff --git a/src/H5FPclient.c b/src/H5FPclient.c
index e5df311..56949fe 100644
--- a/src/H5FPclient.c
+++ b/src/H5FPclient.c
@@ -30,6 +30,7 @@
#ifdef H5_HAVE_FPHDF5
+#include "H5FDfphdf5.h" /* File Driver for FPHDF5 */
#include "H5FPprivate.h" /* Flexible Parallel Functions */
/* Pablo mask */
@@ -41,7 +42,7 @@ static int interface_initialize_g = 0;
/* local functions */
static unsigned H5FP_gen_request_id(void);
-static herr_t H5FP_dump_to_file(H5FD_t *file, H5FP_read *sap_read);
+static herr_t H5FP_dump_to_file(H5FD_t *file, hid_t dxpl_id, H5FP_read *sap_read);
/*
*===----------------------------------------------------------------------===
@@ -68,8 +69,8 @@ static herr_t H5FP_dump_to_file(H5FD_t *file, H5FP_read *sap_read);
* Modifications:
*/
herr_t
-H5FP_request_open(const char *mdata, int md_size, H5FP_obj_t obj_type,
- MPI_Offset maxaddr, unsigned *file_id, unsigned *req_id)
+H5FP_request_open(H5FP_obj_t obj_type, MPI_Offset maxaddr,
+ unsigned *file_id, unsigned *req_id)
{
H5FP_request req;
MPI_Status mpi_status;
@@ -79,7 +80,6 @@ H5FP_request_open(const char *mdata, int md_size, H5FP_obj_t obj_type,
FUNC_ENTER_NOAPI(H5FP_request_open, FAIL);
/* check args */
- assert(mdata);
assert(file_id);
assert(req_id);
@@ -97,17 +97,13 @@ H5FP_request_open(const char *mdata, int md_size, H5FP_obj_t obj_type,
req.req_type = H5FP_REQ_OPEN;
req.req_id = H5FP_gen_request_id();
req.proc_rank = my_rank;
- req.md_size = md_size;
+ req.md_size = 0;
req.obj_type = obj_type;
req.addr = maxaddr;
if ((mrc = MPI_Send(&req, 1, H5FP_request_t, (int)H5FP_sap_rank,
H5FP_TAG_REQUEST, H5FP_SAP_COMM)) != MPI_SUCCESS)
HMPI_GOTO_ERROR(FAIL, "MPI_Send failed", mrc);
-
- if (H5FP_send_metadata(mdata, md_size, (int)H5FP_sap_rank))
- HGOTO_ERROR(H5E_FPHDF5, H5E_CANTSENDMDATA, FAIL,
- "can't send metadata to server");
}
if ((mrc = MPI_Recv(file_id, 1, MPI_UNSIGNED, (int)H5FP_sap_rank,
@@ -279,9 +275,10 @@ done:
* Modifications:
*/
herr_t
-H5FP_request_read_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
- MPI_Offset addr, size_t size, uint8_t **buf,
- int *bytes_read, unsigned *req_id, H5FP_status_t *status)
+H5FP_request_read_metadata(H5FD_t *file, unsigned file_id, hid_t dxpl_id,
+ H5FD_mem_t UNUSED mem_type, MPI_Offset addr,
+ size_t size, uint8_t **buf, int *bytes_read,
+ unsigned *req_id, H5FP_status_t *status)
{
H5FP_request req;
H5FP_read sap_read; /* metadata info read from the SAP's cache */
@@ -341,7 +338,7 @@ H5FP_request_read_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
* the file. We fall through because at this point the metadata
* won't be cached on the server anymore.
*/
- if (H5FP_dump_to_file(file, &sap_read) == FAIL)
+ if (H5FP_dump_to_file(file, dxpl_id, &sap_read) == FAIL)
HGOTO_ERROR(H5E_FPHDF5, H5E_WRITEERROR, FAIL,
"can't write metadata update to file");
/* FALLTHROUGH */
@@ -378,9 +375,10 @@ done:
* Modifications:
*/
herr_t
-H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
- uint8_t *obj_oid, MPI_Offset addr, int mdata_size,
- const char *mdata, unsigned *req_id, H5FP_status_t *status)
+H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, hid_t dxpl_id,
+ H5FD_mem_t mem_type, MPI_Offset addr,
+ int mdata_size, const char *mdata,
+ unsigned *req_id, H5FP_status_t *status)
{
H5FP_reply sap_reply;
H5FP_read sap_read; /* metadata info read from the SAP's cache */
@@ -394,7 +392,6 @@ H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
/* check args */
assert(file);
assert(mdata);
- assert(obj_oid);
assert(req_id);
assert(status);
@@ -403,7 +400,6 @@ H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, &my_rank)) != MPI_SUCCESS)
HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
- H5FP_COPY_OID(req.oid, obj_oid);
req.req_type = H5FP_REQ_WRITE;
req.req_id = H5FP_gen_request_id();
req.proc_rank = my_rank;
@@ -446,7 +442,7 @@ H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, H5FD_mem_t mem_type,
HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mrc);
}
- if (H5FP_dump_to_file(file, &sap_read) == FAIL) {
+ if (H5FP_dump_to_file(file, dxpl_id, &sap_read) == FAIL) {
*status = H5FP_STATUS_DUMPING_FAILED;
HGOTO_ERROR(H5E_FPHDF5, H5E_WRITEERROR, FAIL,
"can't write metadata update to file");
@@ -466,11 +462,10 @@ done:
}
/*
- * Function: H5FP_request_close
- * Purpose: Tell the SAP that we want all of the structural changes
- * made on the file and then close the file. The request ID
- * is returned in a pointer passed to the function by the
- * user.
+ * Function: H5FP_request_flush_metadata
+ * Purpose: Tell the SAP that we want to change a piece of metadata
+ * associated with the file. The request ID is returned in a
+ * pointer supplied by the user.
*
* This function has the potential of causing the process to
* act as a dumper for the SAP's metadata. Places which call
@@ -482,8 +477,8 @@ done:
* Modifications:
*/
herr_t
-H5FP_request_close(H5FD_t *file, unsigned file_id, unsigned *req_id,
- H5FP_status_t *status)
+H5FP_request_flush_metadata(H5FD_t *file, unsigned file_id, hid_t dxpl_id,
+ unsigned *req_id, H5FP_status_t *status)
{
H5FP_reply sap_reply;
H5FP_read sap_read; /* metadata info read from the SAP's cache */
@@ -492,7 +487,7 @@ H5FP_request_close(H5FD_t *file, unsigned file_id, unsigned *req_id,
int mrc, my_rank;
int ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5FP_request_close, FAIL);
+ FUNC_ENTER_NOAPI(H5FP_request_flush_metadata, FAIL);
/* check args */
assert(file);
@@ -504,7 +499,7 @@ H5FP_request_close(H5FD_t *file, unsigned file_id, unsigned *req_id,
if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, &my_rank)) != MPI_SUCCESS)
HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
- req.req_type = H5FP_REQ_CLOSE;
+ req.req_type = H5FP_REQ_FLUSH;
req.req_id = H5FP_gen_request_id();
req.file_id = file_id;
req.proc_rank = my_rank;
@@ -539,7 +534,7 @@ H5FP_request_close(H5FD_t *file, unsigned file_id, unsigned *req_id,
HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mrc);
}
- if (H5FP_dump_to_file(file, &sap_read) == FAIL) {
+ if (H5FP_dump_to_file(file, dxpl_id, &sap_read) == FAIL) {
*status = H5FP_STATUS_DUMPING_FAILED;
HGOTO_ERROR(H5E_FPHDF5, H5E_WRITEERROR, FAIL,
"can't write metadata update to file");
@@ -559,6 +554,69 @@ done:
}
/*
+ * Function: H5FP_request_close
+ * Purpose: Tell the SAP that we want all of the structural changes
+ * made on the file and then close the file. The request ID
+ * is returned in a pointer passed to the function by the
+ * user.
+ *
+ * This function has the potential of causing the process to
+ * act as a dumper for the SAP's metadata. Places which call
+ * this function and check the STATUS variable should take
+ * this into account.
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ * Programmer: Bill Wendling, 02. August, 2002
+ * Modifications:
+ */
+herr_t
+H5FP_request_close(H5FD_t *file, unsigned file_id, unsigned *req_id,
+ H5FP_status_t *status)
+{
+ H5FP_reply sap_reply;
+ H5FP_request req;
+ MPI_Status mpi_status;
+ int mrc, my_rank;
+ int ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(H5FP_request_close, FAIL);
+
+ /* check args */
+ assert(file);
+ assert(req_id);
+ assert(status);
+
+ HDmemset(&req, 0, sizeof(req));
+
+ if ((mrc = MPI_Comm_rank(H5FP_SAP_COMM, &my_rank)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mrc);
+
+ req.req_type = H5FP_REQ_CLOSE;
+ req.req_id = H5FP_gen_request_id();
+ req.file_id = file_id;
+ req.proc_rank = my_rank;
+
+ if ((mrc = MPI_Send(&req, 1, H5FP_request_t, (int)H5FP_sap_rank,
+ H5FP_TAG_REQUEST, H5FP_SAP_COMM)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Send failed", mrc);
+
+ HDmemset(&mpi_status, 0, sizeof(mpi_status));
+
+ if ((mrc = MPI_Recv(&sap_reply, 1, H5FP_reply_t, (int)H5FP_sap_rank,
+ H5FP_TAG_REPLY, H5FP_SAP_COMM, &mpi_status)) != MPI_SUCCESS)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mrc);
+
+ if (sap_reply.status != H5FP_STATUS_OK)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCHANGE, FAIL, "can't close file on server");
+
+ *status = H5FP_STATUS_OK;
+
+done:
+ *req_id = req.req_id;
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
+/*
*===----------------------------------------------------------------------===
* Functions Private to Client Module
*===----------------------------------------------------------------------===
@@ -589,8 +647,11 @@ H5FP_gen_request_id()
* Modifications:
*/
static herr_t
-H5FP_dump_to_file(H5FD_t *file, H5FP_read *sap_read)
+H5FP_dump_to_file(H5FD_t *file, hid_t dxpl_id, H5FP_read *sap_read)
{
+ hid_t new_dxpl_id = FAIL;
+ H5P_genplist_t *plist = NULL, *old_plist;
+ unsigned dumping = 1;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOINIT(H5FP_dump_to_file);
@@ -599,6 +660,25 @@ H5FP_dump_to_file(H5FD_t *file, H5FP_read *sap_read)
assert(file);
assert(sap_read);
+ if ((old_plist = H5I_object(dxpl_id)) == NULL)
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist");
+
+ /* Compare property lists */
+ if ((new_dxpl_id = H5P_copy_plist(old_plist)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list");
+
+ if (new_dxpl_id == FAIL)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property list");
+
+ if ((plist = H5P_object_verify(new_dxpl_id, H5P_DATASET_XFER)) == NULL)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataset transfer list");
+
+ /* Set the fact that we're dumping metadata to the file */
+ if (H5P_insert(plist, H5FD_FPHDF5_XFER_DUMPING_METADATA,
+ H5FD_FPHDF5_XFER_DUMPING_SIZE, &dumping,
+ NULL, NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert MPI-I/O property");
+
/*
* At this point, we've received a message saying that the SAP is
* dumping info to us. There's a metadata read waiting for us right
@@ -625,6 +705,10 @@ H5FP_dump_to_file(H5FD_t *file, H5FP_read *sap_read)
} while (sap_read->status != H5FP_STATUS_DUMPING_FINISHED);
done:
+ if (plist)
+ /* FIXME: What can I do if this fail?? */
+ H5P_close(plist);
+
FUNC_LEAVE_NOAPI(ret_value);
}
diff --git a/src/H5FPprivate.h b/src/H5FPprivate.h
index 65bce85..adac0b0 100644
--- a/src/H5FPprivate.h
+++ b/src/H5FPprivate.h
@@ -46,6 +46,7 @@ typedef enum {
H5FP_REQ_RELEASE_END, /* Last unlock request in unlock sequence */
H5FP_REQ_WRITE, /* Writing a piece of metadata */
H5FP_REQ_READ, /* Reading a piece of metadata */
+ H5FP_REQ_FLUSH, /* Flush the metadata out to disk */
H5FP_REQ_CLOSE, /* Close a file (or eventually an object) */
H5FP_REQ_STOP /* Stop SAP */
} H5FP_req_t;
@@ -151,12 +152,15 @@ typedef enum sap_status {
H5FP_STATUS_CATASTROPHIC
} H5FP_status_t;
-/*
+/*===----------------------------------------------------------------------===
+ * H5FP_request
+ *===----------------------------------------------------------------------===
+ *
* The structure sent to the SAP which holds all of the requested action
*/
typedef struct {
- H5FP_req_t req_type; /* Request type */
unsigned req_id; /* ID for request set by sending process */
+ H5FP_req_t req_type; /* Request type */
unsigned proc_rank; /* Rank of sending process */
unsigned file_id; /* SAP's file ID for the specific file */
H5FP_obj_t obj_type; /* Type of the object */
@@ -169,7 +173,10 @@ typedef struct {
extern MPI_Datatype H5FP_request_t; /* MPI datatype for the H5FP_request obj*/
-/*
+/*===----------------------------------------------------------------------===
+ * H5FP_reply
+ *===----------------------------------------------------------------------===
+ *
* Reply from the SAP on an H5FP_request send
*/
typedef struct {
@@ -181,7 +188,10 @@ typedef struct {
extern MPI_Datatype H5FP_reply_t; /* MPI datatype for the H5FP_reply obj */
-/*
+/*===----------------------------------------------------------------------===
+ * H5FP_read
+ *===----------------------------------------------------------------------===
+ *
* The reply message from the SAP on an H5FP_request H5FP_REQ_READ send
*/
typedef struct {
@@ -213,27 +223,29 @@ extern "C" {
extern herr_t H5FP_sap_receive_loop(void);
/* Use these functions to communicate with the SAP */
-extern herr_t H5FP_request_open(const char *mdata, int md_len, H5FP_obj_t obj_type,
- MPI_Offset maxaddr, unsigned *file_id, unsigned *req_id);
+extern herr_t H5FP_request_open(H5FP_obj_t obj_type, MPI_Offset maxaddr,
+ unsigned *file_id, unsigned *req_id);
extern herr_t H5FP_request_lock(unsigned sap_file_id, unsigned char *mdata,
H5FP_lock_t rw_lock, int last, unsigned *req_id,
H5FP_status_t *status);
extern herr_t H5FP_request_release_lock(unsigned sap_file_id, unsigned char *mdata,
int last, unsigned *req_id,
H5FP_status_t *status);
-extern herr_t H5FP_request_read_metadata(H5FD_t *file, unsigned sap_file_id,
+extern herr_t H5FP_request_read_metadata(H5FD_t *file, unsigned sap_file_id, hid_t dxpl_id,
H5FD_mem_t mem_type, MPI_Offset addr,
size_t size, uint8_t **buf, int *bytes_read,
unsigned *req_id, H5FP_status_t *status);
-extern herr_t H5FP_request_write_metadata(H5FD_t *file, unsigned file_id,
- H5FD_mem_t mem_type, unsigned char *obj_oid,
- MPI_Offset addr, int mdata_size,
- const char *mdata, unsigned *req_id,
+extern herr_t H5FP_request_write_metadata(H5FD_t *file, unsigned file_id, hid_t dxpl_id,
+ H5FD_mem_t mem_type, MPI_Offset addr,
+ int mdata_size, const char *mdata,
+ unsigned *req_id, H5FP_status_t *status);
+extern herr_t H5FP_request_flush_metadata(H5FD_t *file, unsigned file_id,
+ hid_t dxpl_id, unsigned *req_id,
H5FP_status_t *status);
-extern herr_t H5FP_request_close(H5FD_t *file, unsigned sap_file_id, unsigned *req_id,
- H5FP_status_t *status);
+extern herr_t H5FP_request_close(H5FD_t *file, unsigned sap_file_id,
+ unsigned *req_id, H5FP_status_t *status);
-/* NOTE: Don't use these functions outside of the H5FD* modules! */
+/* NOTE: Don't use these functions outside of the H5FP* modules! */
extern herr_t H5FP_send_metadata(const char *mdata, int len, int to);
extern herr_t H5FP_read_metadata(char **mdata, int len, int from);
diff --git a/src/H5FPserver.c b/src/H5FPserver.c
index ef99cb8..1144976 100644
--- a/src/H5FPserver.c
+++ b/src/H5FPserver.c
@@ -44,6 +44,13 @@ static int interface_initialize_g = 0;
/* Internal SAP structures */
+/*===----------------------------------------------------------------------===
+ * H5FP_object_lock
+ *===----------------------------------------------------------------------===
+ *
+ * A lock on a given object. A list of current locks is kept in the
+ * appropriate H5FP_file_info structure.
+ */
typedef struct {
uint8_t oid[H5R_OBJ_REF_BUF_SIZE]; /* Buffer to store OID of object */
unsigned owned_rank; /* rank which has the lock */
@@ -52,6 +59,14 @@ typedef struct {
H5FP_lock_t rw_lock; /* indicates if it's a read or write lock */
} H5FP_object_lock;
+/*===----------------------------------------------------------------------===
+ * H5FP_mdata_mod
+ *===----------------------------------------------------------------------===
+ *
+ * A given modification (write) of metadata in the file. A list of
+ * current modifications is kept in the appropriate H5FP_file_info
+ * structure.
+ */
typedef struct {
H5FD_mem_t mem_type; /* type of memory updated */
H5FP_obj_t obj_type; /* type of object modified */
@@ -60,10 +75,21 @@ typedef struct {
char *metadata; /* encoded metadata about the object */
} H5FP_mdata_mod;
+/*===----------------------------------------------------------------------===
+ * H5FP_file_info
+ *===----------------------------------------------------------------------===
+ *
+ * This has all the information the SAP cares about for a given file: a
+ * copy of the H5FD_t structure for keeping track of metadata allocations
+ * in the file, the file ID assigned by the SAP, whether the file is in
+ * the process of being closed (and, therefore, can't accept anymore
+ * modifications), a count of the number of modifications not written to
+ * the file, a list of modifications (writes) made by clients to the
+ * metadata, and a list of current locks on objects in the file.
+ */
typedef struct {
H5FD_t file; /* file driver structure */
unsigned file_id; /* the file id the SAP keeps per file */
- char *filename; /* the filename - of dubious use */
int closing; /* we're closing the file - no more changes */
unsigned num_mods; /* number of mdata writes outstanding */
H5TB_TREE *mod_tree; /* a tree of metadata updates done */
@@ -99,10 +125,9 @@ static herr_t H5FP_remove_object_lock_from_list(H5FP_file_info *info,
H5FP_object_lock *ol);
/* local file information handling functions */
-static herr_t H5FP_add_new_file_info_to_list(unsigned file_id, char *filename,
- MPI_Offset maxaddr);
+static herr_t H5FP_add_new_file_info_to_list(unsigned file_id, MPI_Offset maxaddr);
static int H5FP_file_info_cmp(H5FP_file_info *k1, H5FP_file_info *k2, int cmparg);
-static H5FP_file_info *H5FP_new_file_info_node(unsigned file_id, char *filename);
+static H5FP_file_info *H5FP_new_file_info_node(unsigned file_id);
static H5FP_file_info *H5FP_find_file_info(unsigned file_id);
static herr_t H5FP_remove_file_id_from_list(unsigned file_id);
static herr_t H5FP_free_file_info_node(H5FP_file_info *info);
@@ -116,15 +141,14 @@ static H5FP_mdata_mod *H5FP_new_file_mod_node(unsigned rank,
static herr_t H5FP_free_mod_node(H5FP_mdata_mod *info);
/* local request handling functions */
-static herr_t H5FP_sap_handle_open_request(H5FP_request req,
- char *mdata,
- unsigned md_size);
+static herr_t H5FP_sap_handle_open_request(H5FP_request req, unsigned md_size);
static herr_t H5FP_sap_handle_lock_request(H5FP_request req);
static herr_t H5FP_sap_handle_release_lock_request(H5FP_request req);
+static herr_t H5FP_sap_handle_read_request(H5FP_request req);
static herr_t H5FP_sap_handle_write_request(H5FP_request req,
char *mdata,
unsigned md_size);
-static herr_t H5FP_sap_handle_read_request(H5FP_request req);
+static herr_t H5FP_sap_handle_flush_request(H5FP_request req);
static herr_t H5FP_sap_handle_close_request(H5FP_request req);
/*
@@ -172,7 +196,7 @@ H5FP_sap_receive_loop(void)
switch (req.req_type) {
case H5FP_REQ_OPEN:
- if ((hrc = H5FP_sap_handle_open_request(req, buf, req.md_size)) != SUCCEED)
+ if ((hrc = H5FP_sap_handle_open_request(req, req.md_size)) != SUCCEED)
HGOTO_ERROR(H5E_FPHDF5, H5E_CANTOPENOBJ, FAIL, "cannot open file");
break;
case H5FP_REQ_LOCK:
@@ -189,6 +213,9 @@ H5FP_sap_receive_loop(void)
case H5FP_REQ_READ:
hrc = H5FP_sap_handle_read_request(req);
break;
+ case H5FP_REQ_FLUSH:
+ hrc = H5FP_sap_handle_flush_request(req);
+ break;
case H5FP_REQ_CLOSE:
hrc = H5FP_sap_handle_close_request(req);
break;
@@ -509,7 +536,6 @@ H5FP_free_file_info_node(H5FP_file_info *info)
if (info) {
H5TB_dfree(info->mod_tree, (void (*)(void*))H5FP_free_mod_node, NULL);
H5TB_dfree(info->locks, (void (*)(void*))H5FP_free_object_lock, NULL);
- HDfree(info->filename);
HDfree(info);
}
@@ -541,7 +567,7 @@ H5FP_file_info_cmp(H5FP_file_info *k1, H5FP_file_info *k2, int UNUSED cmparg)
* Modifications:
*/
static H5FP_file_info *
-H5FP_new_file_info_node(unsigned file_id, char *filename)
+H5FP_new_file_info_node(unsigned file_id)
{
H5FP_file_info *ret_value;
@@ -551,7 +577,6 @@ H5FP_new_file_info_node(unsigned file_id, char *filename)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "out of memory");
ret_value->file_id = file_id;
- ret_value->filename = filename;
ret_value->closing = FALSE;
ret_value->num_mods = 0;
@@ -609,14 +634,14 @@ H5FP_find_file_info(unsigned file_id)
* Modifications:
*/
static herr_t
-H5FP_add_new_file_info_to_list(unsigned file_id, char *filename, MPI_Offset maxaddr)
+H5FP_add_new_file_info_to_list(unsigned file_id, MPI_Offset maxaddr)
{
H5FP_file_info *info;
herr_t ret_value = FAIL;
FUNC_ENTER_NOINIT(H5FP_add_new_file_info_to_list);
- if ((info = H5FP_new_file_info_node(file_id, filename)) != NULL) {
+ if ((info = H5FP_new_file_info_node(file_id)) != NULL) {
if (!H5TB_dins(file_info_tree, (void *)info, NULL)) {
H5FP_free_file_info_node(info);
HGOTO_ERROR(H5E_FPHDF5, H5E_CANTINSERT, FAIL,
@@ -723,6 +748,7 @@ H5FP_dump(H5FP_file_info *info, unsigned to, unsigned req_id, unsigned file_id)
FUNC_ENTER_NOINIT(H5FP_dump);
+ /* check args */
assert(info);
if (!info->mod_tree)
@@ -803,7 +829,7 @@ H5FP_gen_sap_file_id()
* Modifications:
*/
static herr_t
-H5FP_sap_handle_open_request(H5FP_request req, char *mdata, unsigned UNUSED md_size)
+H5FP_sap_handle_open_request(H5FP_request req, unsigned UNUSED md_size)
{
herr_t ret_value = SUCCEED;
int mrc;
@@ -814,7 +840,7 @@ H5FP_sap_handle_open_request(H5FP_request req, char *mdata, unsigned UNUSED md_s
unsigned new_file_id = H5FP_gen_sap_file_id();
/* N.B. At this point, req.addr is equiv. to maxaddr in H5FD_open() */
- if (H5FP_add_new_file_info_to_list(new_file_id, mdata, req.addr) != SUCCEED)
+ if (H5FP_add_new_file_info_to_list(new_file_id, req.addr) != SUCCEED)
HGOTO_ERROR(H5E_FPHDF5, H5E_CANTINSERT, FAIL,
"can't insert new file structure to list");
@@ -1219,6 +1245,11 @@ done:
* Function: H5FP_sap_handle_write_request
* Purpose: Handle a request to write a piece of metadata in the
* file.
+ *
+ * N.B: We assume that the client has the lock on the
+ * requesting object before getting here. Why? Because it's
+ * hard to pass the OID for that object down to the
+ * low-level I/O routines...*sigh*
* Return: Success: SUCCEED
* Failure: FAIL
* Programmer: Bill Wendling, 06. August, 2002
@@ -1261,6 +1292,12 @@ H5FP_sap_handle_write_request(H5FP_request req, char *mdata, unsigned md_size)
HGOTO_DONE(FAIL);
}
+#if 0
+ /*
+ * We're assuming that the client has the correct lock at this
+ * point...
+ */
+
/* handle the change request */
lock = H5FP_find_object_lock(info, req.oid);
@@ -1273,6 +1310,7 @@ H5FP_sap_handle_write_request(H5FP_request req, char *mdata, unsigned md_size)
exit_state = H5FP_STATUS_NO_LOCK;
HGOTO_DONE(FAIL);
}
+#endif /* 0 */
if (H5FP_add_file_mod_to_list(info, req.mem_type, req.addr,
req.proc_rank, md_size, mdata) != SUCCEED) {
@@ -1291,25 +1329,24 @@ done:
}
/*
- * Function: H5FP_sap_handle_close_request
- * Purpose: Handle a request to close a file.
+ * Function: H5FP_sap_handle_flush_request
+ * Purpose: Handle a request to flush the metadata to a file.
* Return: Success: SUCCEED
* Failure: FAIL
- * Programmer: Bill Wendling, 06. August, 2002
+ * Programmer: Bill Wendling
+ * 12. February 2003
* Modifications:
*/
static herr_t
-H5FP_sap_handle_close_request(H5FP_request req)
+H5FP_sap_handle_flush_request(H5FP_request req)
{
H5FP_file_info *info;
H5FP_status_t exit_state = H5FP_STATUS_OK;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOINIT(H5FP_sap_handle_close_request);
-
- if ((info = H5FP_find_file_info(req.file_id)) != NULL) {
- int comm_size;
+ FUNC_ENTER_NOINIT(H5FP_sap_handle_flush_request);
+ if ((info = H5FP_find_file_info(req.file_id)) != NULL)
if (info->num_mods) {
/*
* If there are any modifications not written out yet, dump
@@ -1329,6 +1366,31 @@ H5FP_sap_handle_close_request(H5FP_request req)
}
}
+done:
+ H5FP_send_reply(req.proc_rank, req.req_id, req.file_id, exit_state);
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
+/*
+ * Function: H5FP_sap_handle_close_request
+ * Purpose: Handle a request to close a file.
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ * Programmer: Bill Wendling, 06. August, 2002
+ * Modifications:
+ */
+static herr_t
+H5FP_sap_handle_close_request(H5FP_request req)
+{
+ H5FP_file_info *info;
+ H5FP_status_t exit_state = H5FP_STATUS_OK;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOINIT(H5FP_sap_handle_close_request);
+
+ if ((info = H5FP_find_file_info(req.file_id)) != NULL) {
+ int comm_size;
+
/* Get the size of the SAP communicator */
if (MPI_Comm_size(H5FP_SAP_COMM, &comm_size) != MPI_SUCCESS)
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Comm_size failed");