diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-10-31 21:46:58 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-10-31 21:46:58 (GMT) |
commit | d677a77c4d56460b7e0238ba512933c7fd67e3d6 (patch) | |
tree | af5e59454b544db6056964d08d010febd3e56647 /src | |
parent | 61d964625ebb39af5326bc11dc52790ab39c8202 (diff) | |
download | hdf5-d677a77c4d56460b7e0238ba512933c7fd67e3d6.zip hdf5-d677a77c4d56460b7e0238ba512933c7fd67e3d6.tar.gz hdf5-d677a77c4d56460b7e0238ba512933c7fd67e3d6.tar.bz2 |
[svn-r7805] Purpose:
Bug Fix
Description:
The End of Address information needed to be kept by the SAP. Some
processes were trying to get the EOA information in collective mode,
but the action wasn't collective at the time.
Solution:
Keep the EOA information for the file on the SAP. Clients query the
SAP to get/set it when needed.
Platforms tested:
Linux (w/ FPHDF5)
Copper (w/o FPHDF5)
(FPHDF5 specific, so no need for full testing)
Misc. update:
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDfphdf5.c | 23 | ||||
-rw-r--r-- | src/H5FP.c | 57 | ||||
-rw-r--r-- | src/H5FPclient.c | 129 | ||||
-rw-r--r-- | src/H5FPprivate.h | 22 | ||||
-rw-r--r-- | src/H5FPserver.c | 112 |
5 files changed, 297 insertions, 46 deletions
diff --git a/src/H5FDfphdf5.c b/src/H5FDfphdf5.c index 850f344..b9f5b64 100644 --- a/src/H5FDfphdf5.c +++ b/src/H5FDfphdf5.c @@ -1003,6 +1003,8 @@ static haddr_t H5FD_fphdf5_get_eoa(H5FD_t *_file) { H5FD_fphdf5_t *file = (H5FD_fphdf5_t *)_file; + unsigned req_id = 0; + H5FP_status_t status = H5FP_STATUS_OK; haddr_t ret_value; FUNC_ENTER_NOAPI(H5FD_fphdf5_get_eoa, HADDR_UNDEF) @@ -1011,6 +1013,12 @@ H5FD_fphdf5_get_eoa(H5FD_t *_file) assert(file); assert(file->pub.driver_id == H5FD_FPHDF5); + /* The SAP's eoa field is correct */ + if (!H5FD_fphdf5_is_sap(_file)) + /* Retrieve the EOA information */ + if (H5FP_request_get_eoa(_file, &file->eoa, &req_id, &status)) + HGOTO_ERROR(H5E_FPHDF5, H5E_CANTRECV, HADDR_UNDEF, "can't retrieve eoa information") + /* Set return value */ ret_value = file->eoa; @@ -1036,6 +1044,8 @@ static herr_t H5FD_fphdf5_set_eoa(H5FD_t *_file, haddr_t addr) { H5FD_fphdf5_t *file = (H5FD_fphdf5_t *)_file; + unsigned req_id = 0; + H5FP_status_t status = H5FP_STATUS_OK; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_fphdf5_set_eoa, FAIL) @@ -1044,6 +1054,12 @@ H5FD_fphdf5_set_eoa(H5FD_t *_file, haddr_t addr) assert(file); assert(file->pub.driver_id == H5FD_FPHDF5); + /* The SAP's eoa field is correct */ + if (!H5FD_fphdf5_is_sap(_file)) + /* Retrieve the EOA information */ + if (H5FP_request_set_eoa(_file, addr, &req_id, &status)) + HGOTO_ERROR(H5E_FPHDF5, H5E_CANTRECV, HADDR_UNDEF, "can't retrieve eoa information") + file->eoa = addr; done: @@ -1570,11 +1586,8 @@ H5FD_fphdf5_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) /* Only the captain process needs to flush the metadata. */ if (H5FD_fphdf5_is_captain(_file)) { if (H5FP_request_flush_metadata(_file, file->file_id, dxpl_id, - &req_id, &status) != SUCCEED) { - /* FIXME: This failed */ -H5Eprint(H5E_DEFAULT,stderr); -HDfprintf(stderr, "%s:%d: Flush failed (%d)\n", FUNC, __LINE__, status); - } + &req_id, &status) != SUCCEED) + HGOTO_ERROR(H5E_FPHDF5, H5E_CANTFLUSH, FAIL, "can't flush metadata") /* Only sync the file if we are not going to immediately close it */ if (!closing) @@ -33,6 +33,7 @@ MPI_Datatype H5FP_request; /* MPI datatype for the H5FP_request_t type */ MPI_Datatype H5FP_reply; /* MPI datatype for the H5FP_reply_t type */ MPI_Datatype H5FP_read; /* MPI datatype for the H5FP_read_t type */ MPI_Datatype H5FP_alloc; /* MPI datatype for the H5FP_alloc_t type */ +MPI_Datatype H5FP_eoa; /* MPI datatype for the H5FP_eoa_t type */ MPI_Datatype H5FP_super; /* MPI datatype for the H5FP_super_t type */ /* SAP specific variables */ @@ -77,6 +78,7 @@ H5FPinit(MPI_Comm comm, int sap_rank, MPI_Comm *sap_comm, MPI_Comm *sap_barrier_ H5FP_reply = MPI_DATATYPE_NULL; H5FP_read = MPI_DATATYPE_NULL; H5FP_alloc = MPI_DATATYPE_NULL; + H5FP_eoa = MPI_DATATYPE_NULL; H5FP_super = MPI_DATATYPE_NULL; *sap_comm = H5FP_SAP_COMM = MPI_COMM_NULL; @@ -164,6 +166,10 @@ done: if (MPI_Type_free(&H5FP_alloc) != MPI_SUCCESS) HDONE_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + if (H5FP_eoa != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_eoa) != MPI_SUCCESS) + HDONE_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + if (H5FP_super != MPI_DATATYPE_NULL) if (MPI_Type_free(&H5FP_super) != MPI_SUCCESS) HDONE_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); @@ -216,20 +222,29 @@ H5FPfinalize(void) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Error stopping the SAP"); /* Release the MPI types we created */ - if (MPI_Type_free(&H5FP_request) != MPI_SUCCESS) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + if (H5FP_request != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_request) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); - if (MPI_Type_free(&H5FP_reply) != MPI_SUCCESS) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + if (H5FP_reply != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_reply) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); - if (MPI_Type_free(&H5FP_read) != MPI_SUCCESS) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + if (H5FP_read != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_read) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); - if (MPI_Type_free(&H5FP_alloc) != MPI_SUCCESS) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + if (H5FP_alloc != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_alloc) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); - if (MPI_Type_free(&H5FP_super) != MPI_SUCCESS) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + if (H5FP_eoa != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_eoa) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_free failed"); + + if (H5FP_super != MPI_DATATYPE_NULL) + if (MPI_Type_free(&H5FP_super) != 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) @@ -327,7 +342,8 @@ done: /* * Function: H5FP_commit_sap_datatypes * Purpose: Commit the H5FP_request, H5FP_reply, H5FP_read, - * H5FP_alloc and H5FP_super structure datatypes to MPI. + * H5FP_alloc, H5FP_eoa and H5FP_super structure datatypes + * to MPI. * Return: Success: SUCCEED * Failure: FAIL * Programmer: Bill Wendling, 26. July, 2002 @@ -344,6 +360,7 @@ H5FP_commit_sap_datatypes(void) H5FP_reply_t sap_reply; H5FP_read_t sap_read; H5FP_alloc_t sap_alloc; + H5FP_eoa_t sap_eoa; H5FP_super_t sap_super; herr_t ret_value = SUCCEED; @@ -424,6 +441,24 @@ H5FP_commit_sap_datatypes(void) if (MPI_Type_commit(&H5FP_alloc) != MPI_SUCCESS) HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_commit failed"); + /* Commit the H5FP_eoa datatype */ + block_length[0] = 3; + block_length[1] = 1; + old_types[0] = MPI_UNSIGNED; + old_types[1] = HADDR_AS_MPI_TYPE; + MPI_Address(&sap_eoa.req_id, &displs[0]); + MPI_Address(&sap_eoa.eoa, &displs[1]); + + /* Calculate the displacements */ + for (i = 1; i >= 0; --i) + displs[i] -= displs[0]; + + if (MPI_Type_struct(2, block_length, displs, old_types, &H5FP_eoa) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_struct failed"); + + if (MPI_Type_commit(&H5FP_eoa) != MPI_SUCCESS) + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Type_commit failed"); + /* Commit the H5FP_super datatype */ block_length[0] = 1; block_length[1] = 1; diff --git a/src/H5FPclient.c b/src/H5FPclient.c index 2628fb9..200517c 100644 --- a/src/H5FPclient.c +++ b/src/H5FPclient.c @@ -639,6 +639,8 @@ H5FP_request_allocate(H5FD_t *file, H5FD_mem_t mem_type, hsize_t size, /* check args */ assert(file); + assert(addr); + assert(eoa); assert(req_id); assert(status); @@ -725,10 +727,6 @@ H5FP_request_free(H5FD_t *file, H5FD_mem_t mem_type, haddr_t addr, hsize_t size, if (sap_alloc.status != H5FP_STATUS_OK) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCHANGE, FAIL, "can't free space on server"); - if ((mrc = MPI_Bcast(&sap_alloc, 1, H5FP_alloc, (int)H5FP_capt_barrier_rank, - H5FP_SAP_BARRIER_COMM)) != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed!", mrc); - /* Set the EOA for all processes. This call doesn't fail. */ file->cls->set_eoa(file, sap_alloc.eoa); *status = H5FP_STATUS_OK; @@ -739,6 +737,112 @@ done: } /* + * Function: H5FP_request_get_eoa + * Purpose: Request the SAP send the EOA of the file. + * Return: Success: SUCCEED + * Failure: FAIL + * Programmer: Bill Wendling, 30. October 2003 + * Modifications: + */ +herr_t +H5FP_request_get_eoa(H5FD_t *file, haddr_t *eoa, unsigned *req_id, H5FP_status_t *status) +{ + H5FP_eoa_t sap_eoa; + H5FP_request_t req; + MPI_Status mpi_status; + int mrc; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FP_request_get_eoa, FAIL); + + /* check args */ + assert(file); + assert(eoa); + assert(req_id); + assert(status); + + HDmemset(&req, 0, sizeof(req)); + + req.req_type = H5FP_REQ_GET_EOA; + req.req_id = H5FP_gen_request_id(); + req.file_id = H5FD_fphdf5_file_id(file); + req.proc_rank = H5FD_fphdf5_mpi_rank(file); + + if ((mrc = MPI_Send(&req, 1, H5FP_request, (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_eoa, 1, H5FP_eoa, (int)H5FP_sap_rank, + H5FP_TAG_EOA, H5FP_SAP_COMM, &mpi_status)) != MPI_SUCCESS) + HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mrc); + + if (sap_eoa.status != H5FP_STATUS_OK) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCHANGE, FAIL, "can't free space on server"); + + /* Set the EOA for all processes. This doesn't fail. */ + *eoa = sap_eoa.eoa; + *status = H5FP_STATUS_OK; + +done: + *req_id = req.req_id; + FUNC_LEAVE_NOAPI(ret_value); +} + +/* + * Function: H5FP_request_set_eoa + * Purpose: Request the SAP set the EOA of the file. + * Return: Success: SUCCEED + * Failure: FAIL + * Programmer: Bill Wendling, 31. October 2003 + * Modifications: + */ +herr_t +H5FP_request_set_eoa(H5FD_t *file, haddr_t eoa, unsigned *req_id, H5FP_status_t *status) +{ + H5FP_reply_t sap_reply; + H5FP_request_t req; + MPI_Status mpi_status; + int mrc; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5FP_request_set_eoa, FAIL); + + /* check args */ + assert(file); + assert(req_id); + assert(status); + + HDmemset(&req, 0, sizeof(req)); + + req.req_type = H5FP_REQ_SET_EOA; + req.req_id = H5FP_gen_request_id(); + req.file_id = H5FD_fphdf5_file_id(file); + req.proc_rank = H5FD_fphdf5_mpi_rank(file); + req.addr = eoa; + + if ((mrc = MPI_Send(&req, 1, H5FP_request, (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, (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); +} + +/* * Function: H5FP_request_update_eoma_eosda * Purpose: Request the SAP updates the EOMA and EOSDA information * for the file. @@ -748,10 +852,9 @@ done: * Modifications: */ herr_t -H5FP_request_update_eoma_eosda(H5FD_t *file, unsigned *req_id, - H5FP_status_t *status) +H5FP_request_update_eoma_eosda(H5FD_t *file, unsigned *req_id, H5FP_status_t *status) { - H5FP_alloc_t sap_alloc; + H5FP_eoa_t sap_eoa; H5FP_request_t req; MPI_Status mpi_status; int mrc; @@ -777,19 +880,19 @@ H5FP_request_update_eoma_eosda(H5FD_t *file, unsigned *req_id, HDmemset(&mpi_status, 0, sizeof(mpi_status)); - if ((mrc = MPI_Recv(&sap_alloc, 1, H5FP_alloc, (int)H5FP_sap_rank, - H5FP_TAG_ALLOC, H5FP_SAP_COMM, &mpi_status)) != MPI_SUCCESS) + if ((mrc = MPI_Recv(&sap_eoa, 1, H5FP_eoa, (int)H5FP_sap_rank, + H5FP_TAG_EOA, H5FP_SAP_COMM, &mpi_status)) != MPI_SUCCESS) HMPI_GOTO_ERROR(FAIL, "MPI_Recv failed", mrc); - if (sap_alloc.status != H5FP_STATUS_OK) + if (sap_eoa.status != H5FP_STATUS_OK) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCHANGE, FAIL, "can't free space on server"); - if ((mrc = MPI_Bcast(&sap_alloc, 1, H5FP_alloc, (int)H5FP_capt_barrier_rank, + if ((mrc = MPI_Bcast(&sap_eoa, 1, H5FP_eoa, (int)H5FP_capt_barrier_rank, H5FP_SAP_BARRIER_COMM)) != MPI_SUCCESS) - HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mrc); + HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed!", mrc); /* Set the EOA for all processes. This doesn't fail. */ - file->cls->set_eoa(file, sap_alloc.eoa); + file->cls->set_eoa(file, sap_eoa.eoa); *status = H5FP_STATUS_OK; done: diff --git a/src/H5FPprivate.h b/src/H5FPprivate.h index 0502fbe..0abd9cf 100644 --- a/src/H5FPprivate.h +++ b/src/H5FPprivate.h @@ -51,6 +51,8 @@ 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_GET_EOA, /* Get end of address space information */ + H5FP_REQ_SET_EOA, /* Set end of address space information */ H5FP_REQ_STOP, /* Stop SAP */ /* Allocation Requests */ @@ -114,6 +116,7 @@ enum { H5FP_TAG_READ, H5FP_TAG_METADATA, H5FP_TAG_ALLOC, + H5FP_TAG_EOA, H5FP_TAG_DUMP, H5FP_TAG_FILE_ID }; @@ -242,6 +245,21 @@ typedef struct { extern MPI_Datatype H5FP_alloc; /* MPI datatype for the H5FP_alloc obj */ /*===----------------------------------------------------------------------=== + * H5FP_eoa + *===----------------------------------------------------------------------=== + * + * 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 */ + haddr_t eoa; /* End of address space */ +} H5FP_eoa_t; + +extern MPI_Datatype H5FP_eoa; /* MPI datatype for the H5FP_eoa obj */ + +/*===----------------------------------------------------------------------=== * H5FP_super *===----------------------------------------------------------------------=== * @@ -305,6 +323,10 @@ extern herr_t H5FP_request_allocate(H5FD_t *file, H5FD_mem_t mem_type, 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); +extern herr_t H5FP_request_get_eoa(H5FD_t *file, haddr_t *eoa, unsigned *req_id, + H5FP_status_t *status); +extern herr_t H5FP_request_set_eoa(H5FD_t *file, haddr_t eoa, unsigned *req_id, + H5FP_status_t *status); extern herr_t H5FP_request_update_eoma_eosda(H5FD_t *file, unsigned *req_id, H5FP_status_t *status); diff --git a/src/H5FPserver.c b/src/H5FPserver.c index 5d85021..06ac060 100644 --- a/src/H5FPserver.c +++ b/src/H5FPserver.c @@ -164,6 +164,8 @@ 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_get_eoa_request(H5FP_request_t *req); +static herr_t H5FP_sap_handle_set_eoa_request(H5FP_request_t *req); static herr_t H5FP_sap_handle_update_eoma_eosda_request(H5FP_request_t *req); /* @@ -240,6 +242,12 @@ H5FP_sap_receive_loop(void) case H5FP_REQ_FREE: hrc = H5FP_sap_handle_free_request(&req); break; + case H5FP_REQ_GET_EOA: + hrc = H5FP_sap_handle_get_eoa_request(&req); + break; + case H5FP_REQ_SET_EOA: + hrc = H5FP_sap_handle_set_eoa_request(&req); + break; case H5FP_REQ_UPDATE_EOMA_EOSDA: hrc = H5FP_sap_handle_update_eoma_eosda_request(&req); break; @@ -1529,8 +1537,8 @@ H5FP_sap_handle_alloc_request(H5FP_request_t *req) "SAP unable to allocate file memory"); } - /* Get the EOA from the file. This call doesn't fail. */ - sap_alloc.eoa = ((H5FD_t*)&info->file)->cls->get_eoa((H5FD_t*)&info->file); + /* Get the EOA. */ + sap_alloc.eoa = ((H5FD_fphdf5_t*)&info->file)->eoa; sap_alloc.status = H5FP_STATUS_OK; } else { sap_alloc.addr = HADDR_UNDEF; @@ -1579,8 +1587,8 @@ H5FP_sap_handle_free_request(H5FP_request_t *req) "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); + /* Get the EOA. */ + sap_alloc.eoa = ((H5FD_fphdf5_t*)&info->file)->eoa; sap_alloc.status = H5FP_STATUS_OK; } else { sap_alloc.status = H5FP_STATUS_CANT_FREE; @@ -1595,6 +1603,77 @@ done: } /* + * Function: H5FP_sap_handle_get_eoa_request + * Purpose: Handle a request for the EOA of the file. + * Return: Success: SUCCEED + * Failure: FAIL + * Programmer: Bill Wendling, 31. October 2003 + * Modifications: + */ +static herr_t +H5FP_sap_handle_get_eoa_request(H5FP_request_t *req) +{ + H5FP_eoa_t sap_eoa; + H5FP_file_info *info; + int mrc; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOINIT(H5FP_sap_handle_get_eoa_request); + + sap_eoa.req_id = req->req_id; + sap_eoa.file_id = req->file_id; + + if ((info = H5FP_find_file_info(req->file_id)) != NULL) { + /* Get the EOA. */ + sap_eoa.eoa = ((H5FD_fphdf5_t*)&info->file)->eoa; + sap_eoa.status = H5FP_STATUS_OK; + } else { + sap_eoa.eoa = HADDR_UNDEF; + sap_eoa.status = H5FP_STATUS_CANT_ALLOC; + ret_value = FAIL; + } + +done: + if ((mrc = MPI_Send(&sap_eoa, 1, H5FP_eoa, (int)req->proc_rank, + H5FP_TAG_EOA, H5FP_SAP_COMM)) != MPI_SUCCESS) + HMPI_DONE_ERROR(FAIL, "MPI_Send failed", mrc); + + FUNC_LEAVE_NOAPI(ret_value); +} + +/* + * Function: H5FP_sap_handle_set_eoa_request + * Purpose: Handle a request setting the EOA of the file. + * Return: Success: SUCCEED + * Failure: FAIL + * Programmer: Bill Wendling, 31. October 2003 + * Modifications: + */ +static herr_t +H5FP_sap_handle_set_eoa_request(H5FP_request_t *req) +{ + H5FP_status_t exit_state = H5FP_STATUS_OK; + H5FP_file_info *info; + int mrc; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOINIT(H5FP_sap_handle_set_eoa_request); + + if ((info = H5FP_find_file_info(req->file_id)) != NULL) { + /* Get the EOA. */ + ((H5FD_fphdf5_t*)&info->file)->eoa = req->addr; + exit_state = H5FP_STATUS_OK; + } else { + exit_state = H5FP_STATUS_CANT_ALLOC; + ret_value = FAIL; + } + +done: + H5FP_send_reply(req->proc_rank, req->req_id, req->file_id, exit_state); + 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 @@ -1605,7 +1684,7 @@ done: static herr_t H5FP_sap_handle_update_eoma_eosda_request(H5FP_request_t *req) { - H5FP_alloc_t sap_alloc; + H5FP_eoa_t sap_eoa; H5FP_file_info *info; H5FP_status_t exit_state = H5FP_STATUS_OK; herr_t ret_value = SUCCEED; @@ -1613,10 +1692,9 @@ H5FP_sap_handle_update_eoma_eosda_request(H5FP_request_t *req) 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; + sap_eoa.req_id = req->req_id; + sap_eoa.file_id = req->file_id; + sap_eoa.status = H5FP_STATUS_OK; if ((info = H5FP_find_file_info(req->file_id)) != NULL) { H5FD_t *f = (H5FD_t*)&info->file; @@ -1625,7 +1703,7 @@ H5FP_sap_handle_update_eoma_eosda_request(H5FP_request_t *req) if (H5FD_free(f, H5FD_MEM_DEFAULT, H5P_DEFAULT, f->eoma, f->cur_meta_block_size) != SUCCEED) { exit_state = H5FP_STATUS_CANT_FREE; - sap_alloc.status = H5FP_STATUS_CANT_FREE; + sap_eoa.status = H5FP_STATUS_CANT_FREE; HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "SAP unable to free metadata block"); } @@ -1638,7 +1716,7 @@ H5FP_sap_handle_update_eoma_eosda_request(H5FP_request_t *req) if (H5FD_free(f, H5FD_MEM_DRAW, H5P_DEFAULT, f->eosda, f->cur_sdata_block_size) != SUCCEED) { exit_state = H5FP_STATUS_CANT_FREE; - sap_alloc.status = H5FP_STATUS_CANT_FREE; + sap_eoa.status = H5FP_STATUS_CANT_FREE; HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "SAP unable to free 'small data' block"); } @@ -1647,16 +1725,16 @@ H5FP_sap_handle_update_eoma_eosda_request(H5FP_request_t *req) f->eosda = 0; f->cur_sdata_block_size = 0; - /* Get the EOA from the file. This call doesn't fail. */ - sap_alloc.eoa = ((H5FD_t*)&info->file)->cls->get_eoa((H5FD_t*)&info->file); + /* Get the EOA. */ + sap_eoa.eoa = ((H5FD_fphdf5_t*)&info->file)->eoa; } else { - sap_alloc.eoa = HADDR_UNDEF; - sap_alloc.status = H5FP_STATUS_CANT_FREE; + sap_eoa.eoa = HADDR_UNDEF; + sap_eoa.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) + if ((mrc = MPI_Send(&sap_eoa, 1, H5FP_eoa, (int)req->proc_rank, + H5FP_TAG_EOA, H5FP_SAP_COMM)) != MPI_SUCCESS) HMPI_DONE_ERROR(FAIL, "MPI_Send failed", mrc); FUNC_LEAVE_NOAPI(ret_value); |