diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-01-27 20:38:38 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2003-01-27 20:38:38 (GMT) |
commit | 749c50fcd861429c408cb21b6e595addafa959f2 (patch) | |
tree | b61c79b80b21c8f33b4bc740901c217d149fe564 /src/H5FPprivate.h | |
parent | a6542d06b12340af99731eacb1d9687cdc8738ed (diff) | |
download | hdf5-749c50fcd861429c408cb21b6e595addafa959f2.zip hdf5-749c50fcd861429c408cb21b6e595addafa959f2.tar.gz hdf5-749c50fcd861429c408cb21b6e595addafa959f2.tar.bz2 |
[svn-r6336] Purpose:
Update
Description:
This is the first conversion of the FPHDF5 code to be a metadata
cache. There's an extra error message. I rewrote the sync/change code
to be read metadata/write metadata instead.
I still need to hook these changes into the HDF5 code so that it
looks at the SAP first before checking the file for metadata.
Platforms tested:
Linux
Diffstat (limited to 'src/H5FPprivate.h')
-rw-r--r-- | src/H5FPprivate.h | 229 |
1 files changed, 130 insertions, 99 deletions
diff --git a/src/H5FPprivate.h b/src/H5FPprivate.h index 9c7caba..1e5c3aa 100644 --- a/src/H5FPprivate.h +++ b/src/H5FPprivate.h @@ -11,86 +11,113 @@ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + #ifndef H5FPPRIVATE_H__ #define H5FPPRIVATE_H__ 0 +#include "H5ACpublic.h" /* Metadata Cache */ #include "H5FPpublic.h" /* Flexible Parallel HDF5 */ #include "H5Oprivate.h" /* Object Headers */ #include "H5Rprivate.h" /* References */ -#define H5FP_BYTE_BITS 8 - -/* Different types of requests */ - -/* +/*===----------------------------------------------------------------------=== + * Request Types + *===----------------------------------------------------------------------=== + * * The H5FP_REQ_LOCK_END and H5FP_REQ_RELEASE_END are used to lock and * release a collection of objects at the same time. The last object you * need to lock is sent with the H5FP_REQ_LOCK_END request type (this can * also be a null message - where you're just sending a message that has * H5FP_REQ_LOCK_END as the request type with no data associated with it. - * In that case, the md_len MUST be set to 0). The SAP will then try to - * lock all of the objects you've requested to lock at once. If it cannot - * do so, then it will fail and you have to try again at a later time. + * In that case, the md_size *MUST* be set to 0). The SAP will then try + * to lock all of the objects you've requested to lock at once. If it + * cannot do so, then it will fail and you have to try again at a later + * time. * * Releasing locks is done in the exact same way, except that the action * will always release locks (i.e., not fail) if there is a vaild lock * for that object. */ -enum sap_request { +typedef enum { 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 */ H5FP_REQ_RELEASE, /* Unlock an object (in a sequence) */ H5FP_REQ_RELEASE_END, /* Last unlock request in unlock sequence */ - H5FP_REQ_CHANGE, /* Change an object */ - H5FP_REQ_SYNC, /* Syncronize changes in file */ + H5FP_REQ_WRITE, /* Writing a piece of metadata */ + H5FP_REQ_READ, /* Reading a piece of metadata */ H5FP_REQ_CLOSE, /* Close a file (or eventually an object) */ H5FP_REQ_STOP /* Stop SAP */ -}; +} H5FP_req_t; -/* Actions to take when performing a change */ -enum sap_action { - H5FP_ACT_CREATE, - H5FP_ACT_EXTEND, - H5FP_ACT_DELETE, - H5FP_ACT_UPDATE -}; +/*===----------------------------------------------------------------------=== + * Lock Types + *===----------------------------------------------------------------------=== + * + * A ``read'' lock indicates that the process is busy reading the + * metadata of that object. It's non-exclusive, so any number of + * processes can have any number of locks on a given object. However, you + * cannot have a write and a read lock on an object. + * + * A ``write'' lock indicates that the process is busy writing to the + * metadata of that object. It's exclusive, so only one process can have + * a write lock on an object at any one time. However, that object can + * have any number of write locks on that object. + * + * It's up to the program to release all of the locks it has on a given + * object. + */ +typedef enum { + H5FP_LOCK_READ, + H5FP_LOCK_WRITE +} H5FP_lock_t; -/* Types of objects we can change */ -enum sap_obj_type { +/*===----------------------------------------------------------------------=== + * Object Types + *===----------------------------------------------------------------------=== + * + * The various types of objects we're able to get a lock on or which we + * want to modify/read. + */ +typedef enum { H5FP_OBJ_FILE, H5FP_OBJ_GROUP, H5FP_OBJ_DATASET, H5FP_OBJ_DATATYPE, H5FP_OBJ_ATTRIBUTE, H5FP_OBJ_MEMORY -}; +} H5FP_obj_t; -/* Types of locks we can get */ -enum sap_lock_type { - H5FP_LOCK_READ, - H5FP_LOCK_WRITE -}; - -/* The structure sent to the SAP which holds all of the requested action */ -struct SAP_request { - enum sap_request req_type; /* Request type */ - unsigned int req_id; /* ID for request set by sending process */ - unsigned int proc_rank; /* Rank of sending process */ - unsigned int sap_file_id; /* SAP's file ID for the specific file */ - enum sap_obj_type obj_type; /* Type of object */ - enum sap_action action; /* Action to do to object (H5FP_REQ_CHANGE only) */ - enum sap_lock_type rw_lock; /* Indicates read or write lock */ - H5FD_mem_t mem_type; /* Type of memory updated, if req'd */ - unsigned long size; /* Size of memory updated, if req'd */ - int md_len; /* Length of the metadata sent in next msg */ - unsigned char oid[H5R_OBJ_REF_BUF_SIZE]; /* Buffer to store OID of object referenced */ +/*===----------------------------------------------------------------------=== + * MPI Message Tags + *===----------------------------------------------------------------------=== + * + * Special tag numbers for requests, replies, and string passing + * messages. + * + * Certain actions (Open, Change, and Close) require a pathname to the + * object. This pathname is sent in a separate message and the SAP will + * search for it after getting the appropriate request. + */ +enum { + H5FP_TAG_REQUEST, + H5FP_TAG_REPLY, + H5FP_TAG_READ, + H5FP_TAG_METADATA, + H5FP_TAG_FILE_ID }; -extern MPI_Datatype SAP_request_t; /* MPI datatype for the SAP_request obj */ - -/* The status of the SAP */ -enum sap_status { +/*===----------------------------------------------------------------------=== + * Status + *===----------------------------------------------------------------------=== + * + * The status returned by the SAP. If the process receives an + * H5FP_STATUS_CATASTROPHIC status, then something *REALLY* bad happened + * on the set-aside process. The state of the program is then + * indeterminant and the only real course of action is for the program to + * abort operation. + */ +typedef enum sap_status { H5FP_STATUS_OK, /* For locking */ @@ -106,6 +133,9 @@ enum sap_status { H5FP_STATUS_FILE_CLOSING, H5FP_STATUS_NO_LOCK, + /* For read requests */ + H5FP_STATUS_MDATA_NOT_CACHED, + /* Out of memory error */ H5FP_STATUS_OOM, @@ -114,47 +144,53 @@ enum sap_status { /* Reserved for completely disasterous failures which require an abort */ H5FP_STATUS_CATASTROPHIC -}; +} H5FP_status_t; -/* Reply from the SAP on an SAP_request send */ -struct SAP_reply { - unsigned int req_id; /* Request ID copied from the SAP_request */ - unsigned int sap_file_id; /* File ID assigned to an open file */ - enum sap_status status; /* Status of the 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 */ + 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 */ + H5FP_lock_t rw_lock; /* Indicates read or write lock */ + H5AC_subid_t type_id; /* Type of metadata */ + int md_size; /* Size of the metadata sent in next msg */ + haddr_t addr; /* Address of the metadata */ + unsigned char oid[H5R_OBJ_REF_BUF_SIZE]; /* Buffer to store OID of object */ +} H5FP_request; + +extern MPI_Datatype H5FP_request_t; /* MPI datatype for the H5FP_request obj*/ -extern MPI_Datatype SAP_reply_t; /* MPI datatype for the SAP_reply obj */ - -/* The sync message from the SAP on an SAP_request H5FP_REQ_SYNC send */ -struct SAP_sync { - unsigned int req_id; /* Request ID copied from the SAP_request */ - unsigned int sync_id; /* Sync ID to order the sync messages */ - unsigned int sap_file_id; /* SAP's file ID for the specific file */ - unsigned int last_msg; /* Indicates this is the last sync msg sent */ - enum sap_obj_type obj_type; /* Type of object */ - enum sap_action action; /* Action done on the object */ - enum sap_status status; /* Status of the request */ - int md_len; /* Length of the metadata sent in next msg */ - H5FD_mem_t mem_type; /* Type of memory updated, if req'd */ - hsize_t size; /* Size of memory updated, if req'd */ -}; +/* + * Reply from the SAP on an H5FP_request send + */ +typedef struct { + unsigned req_id; /* Request ID copied from the SAP_request */ + unsigned file_id; /* File ID assigned to an open file */ + H5FP_status_t status; /* Status of the request */ + unsigned md_size; /* Size of the metadata sent in next msg */ +} H5FP_reply; -extern MPI_Datatype SAP_sync_t; /* MPI datatype for the SAP_sync obj */ +extern MPI_Datatype H5FP_reply_t; /* MPI datatype for the H5FP_reply obj */ /* - * Special tag numbers for requests, replies, and string passing messages. - * - * Certain actions (Open, Change, and Close) require a pathname to the - * object. This pathname is sent in a separate message and the SAP will - * search for it after getting the appropriate request. + * The reply message from the SAP on an H5FP_request H5FP_REQ_READ send */ -enum { - H5FP_TAG_REQUEST, - H5FP_TAG_REPLY, - H5FP_TAG_SYNC, - H5FP_TAG_METADATA, - H5FP_TAG_FILE_ID -}; +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 */ + H5AC_subid_t type_id; /* Type of metadata */ + int md_size; /* Size of the metadata sent in next msg */ + haddr_t addr; /* Address of the metadata */ + hsize_t size; /* Size of memory updated, if req'd */ +} H5FP_read; + +extern MPI_Datatype H5FP_read_t; /* MPI datatype for the H5FP_read obj */ /* Handy #define for copying OIDs */ #define H5FP_COPY_OID(dst, src) HDmemcpy((dst), (src), H5R_OBJ_REF_BUF_SIZE) @@ -179,29 +215,24 @@ extern herr_t H5FP_send_metadata(const char *mdata, int len, int rank); 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, enum sap_obj_type obj_type, +extern herr_t H5FP_request_open(const char *mdata, int md_len, H5FP_obj_t obj_type, unsigned *file_id, unsigned *req_id); -extern herr_t H5FP_request_lock(unsigned int sap_file_id, unsigned char *mdata, - enum sap_lock_type rw_lock, int last, unsigned *req_id, - enum sap_status *status); -extern herr_t H5FP_request_release_lock(unsigned int sap_file_id, unsigned char *mdata, +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, - enum sap_status *status); -extern herr_t H5FP_request_change(unsigned int sap_file_id, unsigned char *obj_oid, - enum sap_obj_type obj_type, enum sap_action action, - int mdata_len, const char *mdata, unsigned *req_id, - enum sap_status *status); -extern herr_t H5FP_request_sync(unsigned int sap_file_id, hid_t hdf_file_id, - unsigned *req_id, enum sap_status *status); + H5FP_status_t *status); +extern herr_t H5FP_request_write_metadata(unsigned sap_file_id, unsigned char *obj_oid, + H5FP_obj_t obj_type, H5AC_subid_t type_id, + haddr_t addr, int mdata_len, const char *mdata, + unsigned *req_id, H5FP_status_t *status); +extern herr_t H5FP_request_read_metadata(unsigned sap_file_id, H5FP_obj_t obj_type, + H5AC_subid_t type_id, haddr_t addr, + size_t size, uint8_t **buf, unsigned *req_id, + H5FP_status_t *status); extern herr_t H5FP_request_close(unsigned sap_file_id, unsigned *req_id); -/* Helper functions */ -extern void H5FP_fill_fphdf5_struct(H5O_fphdf5_t *fphdf5, uint8_t *oid, haddr_t header, - struct H5S_simple_t *sdim, H5T_t *dtype, - time_t *mtime, H5O_layout_t *layout, - H5O_name_t *group, H5O_name_t *dataset, - struct H5P_genplist_t *plist); - #ifdef __cplusplus } #endif /* __cplusplus */ |