diff options
-rw-r--r-- | src/H5E.c | 3 | ||||
-rw-r--r-- | src/H5Epublic.h | 3 | ||||
-rw-r--r-- | src/H5FP.c | 56 | ||||
-rw-r--r-- | src/H5FPclient.c | 135 | ||||
-rw-r--r-- | src/H5FPprivate.h | 39 | ||||
-rw-r--r-- | src/H5FPserver.c | 86 |
6 files changed, 293 insertions, 29 deletions
@@ -176,7 +176,8 @@ static const H5E_minor_mesg_t H5E_minor_mesg_g[] = { {H5E_CANTMAKETREE, "Can't create a binary tree node"}, {H5E_CANTRECV, "Can't receive messages from processes"}, {H5E_CANTSENDMDATA, "Can't send metadata message"}, - {H5E_CANTCHANGE, "Can't register change with server"} + {H5E_CANTCHANGE, "Can't register change with server"}, + {H5E_CANTALLOC, "Can't allocate from file"} }; /* Interface initialization? */ diff --git a/src/H5Epublic.h b/src/H5Epublic.h index f9e6e4a..b520745 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -207,7 +207,8 @@ typedef enum H5E_minor_t { H5E_CANTMAKETREE, /*can't make a TBBT tree */ H5E_CANTRECV, /*can't receive messages from processes */ H5E_CANTSENDMDATA, /*can't send metadata message */ - H5E_CANTCHANGE /*can't register change on server */ + H5E_CANTCHANGE, /*can't register change on server */ + H5E_CANTALLOC /*can't allocate from file */ } H5E_minor_t; /* Information about an error */ @@ -32,6 +32,7 @@ static int interface_initialize_g = 0; MPI_Datatype H5FP_request_t; /* MPI datatype for the H5FP_request obj*/ MPI_Datatype H5FP_reply_t; /* MPI datatype for the H5FP_reply obj */ MPI_Datatype H5FP_read_t; /* MPI datatype for the H5FP_read obj */ +MPI_Datatype H5FP_alloc_t; /* MPI datatype for the H5FP_alloc obj */ /* SAP specific variables */ MPI_Comm H5FP_SAP_COMM; /* Comm we use: Supplied by user */ @@ -73,6 +74,7 @@ H5FPinit(MPI_Comm comm, int sap_rank) H5FP_request_t = MPI_DATATYPE_NULL; H5FP_reply_t = MPI_DATATYPE_NULL; H5FP_read_t = MPI_DATATYPE_NULL; + H5FP_alloc_t = MPI_DATATYPE_NULL; H5FP_SAP_COMM = MPI_COMM_NULL; H5FP_SAP_BARRIER_COMM = MPI_COMM_NULL; @@ -137,6 +139,10 @@ done: if (MPI_Type_free(&H5FP_read_t) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + if (H5FP_alloc_t != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_alloc_t) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + if (H5FP_SAP_BARRIER_COMM != MPI_COMM_NULL) /* this comm will be NULL for the SAP */ if (MPI_Comm_free(&H5FP_SAP_BARRIER_COMM) != MPI_SUCCESS) @@ -194,6 +200,9 @@ H5FPfinalize(void) if (MPI_Type_free(&H5FP_read_t) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + if (MPI_Type_free(&H5FP_alloc_t) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + /* Release the barrier communicator */ if (H5FP_SAP_BARRIER_COMM != MPI_COMM_NULL) /* this comm will be NULL for the SAP */ @@ -289,8 +298,8 @@ done: /* * Function: H5FP_commit_sap_datatypes - * Purpose: Commit the H5FP_request_t, H5FP_reply_t, and H5FP_read_t - * structure datatypes to MPI. + * Purpose: Commit the H5FP_request_t, H5FP_reply_t, H5FP_read_t, and + * H5FP_alloc_t structure datatypes to MPI. * Return: Success: SUCCEED * Failure: FAIL * Programmer: Bill Wendling, 26. July, 2002 @@ -299,9 +308,9 @@ done: static herr_t H5FP_commit_sap_datatypes(void) { - int block_length[3]; - MPI_Aint displs[3]; - MPI_Datatype old_types[3]; + int block_length[5]; + MPI_Aint displs[5]; + MPI_Datatype old_types[5]; H5FP_request req; H5FP_read sap_read; herr_t ret_value = SUCCEED; @@ -311,18 +320,26 @@ H5FP_commit_sap_datatypes(void) /* Commit the H5FP_request_t datatype */ block_length[0] = 8; block_length[1] = 1; - block_length[2] = sizeof(req.oid); - old_types[0] = MPI_INT; + block_length[2] = 1; + block_length[3] = 4; + block_length[4] = sizeof(req.oid); + old_types[0] = MPI_UNSIGNED; old_types[1] = HADDR_AS_MPI_TYPE; - old_types[2] = MPI_UNSIGNED_CHAR; + old_types[2] = MPI_UNSIGNED_LONG; + old_types[3] = MPI_LONG_LONG_INT; + old_types[4] = MPI_UNSIGNED_CHAR; MPI_Address(&req.req_type, &displs[0]); MPI_Address(&req.addr, &displs[1]); - MPI_Address(&req.oid, &displs[2]); + MPI_Address(&req.feature_flags, &displs[2]); + MPI_Address(&req.meta_block_size, &displs[3]); + MPI_Address(&req.oid, &displs[4]); + displs[4] -= displs[3]; + displs[3] -= displs[2]; displs[2] -= displs[1]; displs[1] -= displs[0]; displs[0] -= displs[0]; - if (MPI_Type_struct(3, block_length, displs, old_types, + if (MPI_Type_struct(5, block_length, displs, old_types, &H5FP_request_t) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_struct failed"); @@ -344,7 +361,7 @@ H5FP_commit_sap_datatypes(void) /* Commit the H5FP_read_t datatype */ block_length[0] = 5; block_length[1] = 1; - old_types[0] = MPI_INT; + old_types[0] = MPI_UNSIGNED; old_types[1] = HADDR_AS_MPI_TYPE; MPI_Address(&sap_read.req_id, &displs[0]); MPI_Address(&sap_read.addr, &displs[1]); @@ -358,6 +375,23 @@ H5FP_commit_sap_datatypes(void) if (MPI_Type_commit(&H5FP_read_t) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_commit failed"); + /* Commit the H5FP_alloc_t datatype */ + block_length[0] = 4; + block_length[1] = 1; + old_types[0] = MPI_UNSIGNED; + old_types[1] = HADDR_AS_MPI_TYPE; + MPI_Address(&sap_read.req_id, &displs[0]); + MPI_Address(&sap_read.addr, &displs[1]); + displs[1] -= displs[0]; + displs[0] -= displs[0]; + + if (MPI_Type_struct(2, block_length, displs, old_types, + &H5FP_alloc_t) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_struct failed"); + + if (MPI_Type_commit(&H5FP_alloc_t) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_commit failed"); + done: FUNC_LEAVE_NOAPI(ret_value); } diff --git a/src/H5FPclient.c b/src/H5FPclient.c index 56949fe..0ddaafe 100644 --- a/src/H5FPclient.c +++ b/src/H5FPclient.c @@ -70,7 +70,9 @@ static herr_t H5FP_dump_to_file(H5FD_t *file, hid_t dxpl_id, H5FP_read *sap_read */ herr_t H5FP_request_open(H5FP_obj_t obj_type, MPI_Offset maxaddr, - unsigned *file_id, unsigned *req_id) + unsigned long feature_flags, hsize_t meta_block_size, + hsize_t sdata_block_size, hsize_t threshold, + hsize_t alignment, unsigned *file_id, unsigned *req_id) { H5FP_request req; MPI_Status mpi_status; @@ -100,6 +102,11 @@ H5FP_request_open(H5FP_obj_t obj_type, MPI_Offset maxaddr, req.md_size = 0; req.obj_type = obj_type; req.addr = maxaddr; + req.feature_flags = feature_flags; + req.meta_block_size = meta_block_size; + req.sdata_block_size = sdata_block_size; + req.threshold = threshold; + req.alignment = alignment; if ((mrc = MPI_Send(&req, 1, H5FP_request_t, (int)H5FP_sap_rank, H5FP_TAG_REQUEST, H5FP_SAP_COMM)) != MPI_SUCCESS) @@ -573,11 +580,11 @@ 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; + H5FP_reply sap_reply; + H5FP_request req; + MPI_Status mpi_status; + int mrc; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FP_request_close, FAIL); @@ -587,14 +594,10 @@ H5FP_request_close(H5FD_t *file, unsigned file_id, unsigned *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; + req.proc_rank = H5FD_fphdf5_mpi_rank(file); if ((mrc = MPI_Send(&req, 1, H5FP_request_t, (int)H5FP_sap_rank, H5FP_TAG_REQUEST, H5FP_SAP_COMM)) != MPI_SUCCESS) @@ -617,6 +620,116 @@ done: } /* + * Function: H5FP_request_allocate + * Purpose: Request an allocation of space from the SAP. + * Return: Success: SUCCEED + * Failure: FAIL + * Programmer: Bill Wendling, 19. February 2003 + * Modifications: + */ +herr_t +H5FP_request_allocate(H5FD_t *file, H5FD_mem_t mem_type, hsize_t size, + haddr_t *addr, unsigned *req_id, H5FP_status_t *status) +{ + H5FP_alloc sap_alloc; + H5FP_request req; + MPI_Status mpi_status; + int mrc; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FP_request_allocate, FAIL); + + /* check args */ + assert(file); + assert(req_id); + assert(status); + + HDmemset(&req, 0, sizeof(req)); + + req.req_type = H5FP_REQ_ALLOC; + req.req_id = H5FP_gen_request_id(); + req.file_id = H5FD_fphdf5_file_id(file); + req.proc_rank = H5FD_fphdf5_mpi_rank(file); + req.mem_type = mem_type; + req.meta_block_size = size; /* use this field as the size to allocate */ + + 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_alloc, 1, H5FP_alloc_t, (int)H5FP_sap_rank, + H5FP_TAG_ALLOC, H5FP_SAP_COMM, &mpi_status)) != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mrc); + + if (sap_alloc.status != H5FP_STATUS_OK) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCHANGE, FAIL, "can't allocate space on server"); + + *status = H5FP_STATUS_OK; + *addr = sap_alloc.addr; + +done: + *req_id = req.req_id; + FUNC_LEAVE_NOAPI(ret_value); +} + +/* + * Function: H5FP_request_free + * Purpose: Request freeing of space from the SAP. + * Return: Success: SUCCEED + * Failure: FAIL + * Programmer: Bill Wendling, 20. February 2003 + * Modifications: + */ +herr_t +H5FP_request_free(H5FD_t *file, H5FD_mem_t mem_type, haddr_t addr, + hsize_t size, unsigned *req_id, H5FP_status_t *status) +{ + H5FP_reply sap_reply; + H5FP_request req; + MPI_Status mpi_status; + int mrc; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FP_request_free, FAIL); + + /* check args */ + assert(file); + assert(req_id); + assert(status); + + HDmemset(&req, 0, sizeof(req)); + + req.req_type = H5FP_REQ_ALLOC; + req.req_id = H5FP_gen_request_id(); + req.file_id = H5FD_fphdf5_file_id(file); + req.proc_rank = H5FD_fphdf5_mpi_rank(file); + req.mem_type = mem_type; + req.addr = addr; + req.meta_block_size = size; /* use this field as the size to free */ + + 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 free space on server"); + + *status = H5FP_STATUS_OK; + +done: + *req_id = req.req_id; + FUNC_LEAVE_NOAPI(ret_value); +} + +/* *===----------------------------------------------------------------------=== * Functions Private to Client Module *===----------------------------------------------------------------------=== diff --git a/src/H5FPprivate.h b/src/H5FPprivate.h index adac0b0..f34278f 100644 --- a/src/H5FPprivate.h +++ b/src/H5FPprivate.h @@ -39,6 +39,7 @@ * for that object. */ typedef enum { + /* Metadata Requests */ H5FP_REQ_OPEN, /* Open a file (or eventually an object) */ H5FP_REQ_LOCK, /* Lock an object (in a sequence) */ H5FP_REQ_LOCK_END, /* Last lock request in lock sequence */ @@ -48,7 +49,11 @@ typedef enum { 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_STOP, /* Stop SAP */ + + /* Allocation Requests */ + H5FP_REQ_ALLOC, /* Allocate a region of metadata */ + H5FP_REQ_FREE /* Free a region of metadata */ } H5FP_req_t; /*===----------------------------------------------------------------------=== @@ -105,6 +110,7 @@ enum { H5FP_TAG_REPLY, H5FP_TAG_READ, H5FP_TAG_METADATA, + H5FP_TAG_ALLOC, H5FP_TAG_FILE_ID }; @@ -168,6 +174,11 @@ typedef struct { H5FD_mem_t mem_type; /* Type of memory updated, if req'd */ unsigned md_size; /* Size of the metadata sent in next msg */ MPI_Offset addr; /* Address of the metadata */ + unsigned long feature_flags; /* Feature flags for the file driver */ + hsize_t meta_block_size; /* Metadata block size */ + hsize_t sdata_block_size; /* Small data block size */ + hsize_t threshold; /* Alignment threshold */ + hsize_t alignment; /* Alignment (really!) */ unsigned char oid[H5R_OBJ_REF_BUF_SIZE]; /* Buffer to store OID of object */ } H5FP_request; @@ -205,6 +216,22 @@ typedef struct { extern MPI_Datatype H5FP_read_t; /* MPI datatype for the H5FP_read obj */ +/*===----------------------------------------------------------------------=== + * H5FP_alloc + *===----------------------------------------------------------------------=== + * + * The reply message from the SAP on an H5FP_alloc H5FP_REQ_ALLOC send. + */ +typedef struct { + unsigned req_id; /* Request ID copied from the SAP_request */ + unsigned file_id; /* SAP's file ID for the specific file */ + H5FP_status_t status; /* Status of the request */ + H5FD_mem_t mem_type; /* Type of memory updated, if req'd */ + haddr_t addr; /* Address of the metadata */ +} H5FP_alloc; + +extern MPI_Datatype H5FP_alloc_t; /* MPI datatype for the H5FP_alloc obj */ + /* Handy #define for copying OIDs */ #define H5FP_COPY_OID(dst, src) HDmemcpy((dst), (src), H5R_OBJ_REF_BUF_SIZE) @@ -224,6 +251,9 @@ extern herr_t H5FP_sap_receive_loop(void); /* Use these functions to communicate with the SAP */ extern herr_t H5FP_request_open(H5FP_obj_t obj_type, MPI_Offset maxaddr, + unsigned long feature_flags, hsize_t + meta_block_size, hsize_t sdata_block_size, + hsize_t threshold, hsize_t alignment, 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, @@ -245,6 +275,13 @@ extern herr_t H5FP_request_flush_metadata(H5FD_t *file, unsigned file_id, 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_allocate(H5FD_t *file, H5FD_mem_t mem_type, + hsize_t size, haddr_t *addr, + unsigned *req_id, H5FP_status_t *status); +extern herr_t H5FP_request_free(H5FD_t *file, H5FD_mem_t mem_type, + haddr_t addr, hsize_t size, + unsigned *req_id, H5FP_status_t *status); + /* 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 1144976..2561396 100644 --- a/src/H5FPserver.c +++ b/src/H5FPserver.c @@ -28,11 +28,13 @@ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata Cache */ #include "H5Eprivate.h" /* Error Handling */ +#include "H5FDprivate.h" /* File driver */ #include "H5Oprivate.h" /* Object Headers */ #include "H5TBprivate.h" /* Threaded, Balanced, Binary Trees */ #ifdef H5_HAVE_FPHDF5 +#include "H5FDfphdf5.h" /* File Driver for FPHDF5 */ #include "H5FPprivate.h" /* Flexible Parallel Functions */ /* Pablo mask */ @@ -125,7 +127,12 @@ 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, MPI_Offset maxaddr); +static herr_t H5FP_add_new_file_info_to_list(unsigned file_id, MPI_Offset maxaddr, + unsigned long feature_flags, + hsize_t meta_block_size, + hsize_t sdata_block_size, + hsize_t threshold, + hsize_t alignment); 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); static H5FP_file_info *H5FP_find_file_info(unsigned file_id); @@ -150,6 +157,7 @@ static herr_t H5FP_sap_handle_write_request(H5FP_request req, unsigned md_size); static herr_t H5FP_sap_handle_flush_request(H5FP_request req); static herr_t H5FP_sap_handle_close_request(H5FP_request req); +static herr_t H5FP_sap_handle_alloc_request(H5FP_request req); /* *===----------------------------------------------------------------------=== @@ -219,6 +227,9 @@ H5FP_sap_receive_loop(void) case H5FP_REQ_CLOSE: hrc = H5FP_sap_handle_close_request(req); break; + case H5FP_REQ_ALLOC: + hrc = H5FP_sap_handle_alloc_request(req); + break; case H5FP_REQ_STOP: if (++stop == comm_size - 1) goto done; @@ -634,7 +645,12 @@ H5FP_find_file_info(unsigned file_id) * Modifications: */ static herr_t -H5FP_add_new_file_info_to_list(unsigned file_id, MPI_Offset maxaddr) +H5FP_add_new_file_info_to_list(unsigned file_id, MPI_Offset maxaddr, + unsigned long feature_flags, + hsize_t meta_block_size, + hsize_t sdata_block_size, + hsize_t threshold, + hsize_t alignment) { H5FP_file_info *info; herr_t ret_value = FAIL; @@ -652,9 +668,15 @@ H5FP_add_new_file_info_to_list(unsigned file_id, MPI_Offset maxaddr) * Initialize some of the information needed for metadata * allocation requests */ + HDmemset(info->file.fl, 0, sizeof(info->file.fl)); + info->file.cls = &H5FD_fphdf5_g; info->file.maxaddr = maxaddr; info->file.accum_loc = HADDR_UNDEF; - HDmemset(info->file.fl, 0, sizeof(info->file.fl)); + info->file.feature_flags = feature_flags; + info->file.def_meta_block_size = meta_block_size; + info->file.def_sdata_block_size = sdata_block_size; + info->file.threshold = threshold; + info->file.alignment = alignment; ret_value = SUCCEED; } @@ -840,7 +862,9 @@ H5FP_sap_handle_open_request(H5FP_request req, unsigned UNUSED md_size) 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, req.addr) != SUCCEED) + if (H5FP_add_new_file_info_to_list(new_file_id, req.addr, req.feature_flags, + req.meta_block_size, req.sdata_block_size, + req.threshold, req.alignment) != SUCCEED) HGOTO_ERROR(H5E_FPHDF5, H5E_CANTINSERT, FAIL, "can't insert new file structure to list"); @@ -1265,7 +1289,9 @@ H5FP_sap_handle_write_request(H5FP_request req, char *mdata, unsigned md_size) FUNC_ENTER_NOINIT(H5FP_sap_handle_write_request); if ((info = H5FP_find_file_info(req.file_id)) != NULL) { +#if 0 H5FP_object_lock *lock; +#endif /* 0 */ if (info->num_mods >= H5FP_MDATA_CACHE_HIGHWATER_MARK) { /* @@ -1409,4 +1435,56 @@ done: FUNC_LEAVE_NOAPI(ret_value); } +/* + * Function: H5FP_sap_handle_alloc_request + * Purpose: Handle a request to allocate data from the file. + * Return: Success: SUCCEED + * Failure: FAIL + * Programmer: Bill Wendling, 19. February 2003 + * Modifications: + */ +static herr_t +H5FP_sap_handle_alloc_request(H5FP_request req) +{ + H5FP_alloc alloc; + H5FP_file_info *info; + int mrc; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOINIT(H5FP_sap_handle_alloc_request); + + if ((info = H5FP_find_file_info(req.file_id)) != NULL) { + alloc.req_id = req.req_id; + alloc.file_id = info->file_id; + alloc.status = H5FP_STATUS_OK; + alloc.mem_type = req.mem_type; + + /* + * Try allocating from the free-list that is kept on the server + * first. If that fails, then call the specified allocation + * functions depending upon what type of data is being allocated. + * + * Note: H5P_DEFAULT is passed in as the data xfer property list. + * This is okay since the only situation where that will be used + * is if you have a "hole" in the middle of your metadata (in + * aggregate mode) that needs to be freed. We've turned off + * metadata aggregation for FPHDF5 because we don't have the + * proper information. + * + * Whatta pain. + */ + if ((alloc.addr = H5FD_alloc(&info->file, req.mem_type, + H5P_DEFAULT, req.meta_block_size)) == HADDR_UNDEF) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, + "SAP unable to allocate file memory"); + + if ((mrc = MPI_Send(&alloc, 1, H5FP_alloc_t, (int)req.proc_rank, + H5FP_TAG_ALLOC, H5FP_SAP_COMM)) != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_Send failed", mrc); + } + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + #endif /* H5_HAVE_FPHDF5 */ |