diff options
Diffstat (limited to 'src/H5MFpkg.h')
-rw-r--r-- | src/H5MFpkg.h | 141 |
1 files changed, 68 insertions, 73 deletions
diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index ef03f48..306ae93 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -30,8 +30,7 @@ #include "H5MFprivate.h" /* Other private headers needed by this file */ -#include "H5FSprivate.h" /* File free space */ - +#include "H5FSprivate.h" /* File free space */ /**************************/ /* Package Private Macros */ @@ -52,34 +51,34 @@ /* Free-space section types for file */ /* (values stored in free space data structures in file) */ /* For non-paged aggregation: section is a range of actual bytes in file */ -#define H5MF_FSPACE_SECT_SIMPLE 0 +#define H5MF_FSPACE_SECT_SIMPLE 0 /* For paged aggregation: "small" meta/raw data section which is < fsp_size) */ -#define H5MF_FSPACE_SECT_SMALL 1 +#define H5MF_FSPACE_SECT_SMALL 1 /* For paged aggregation: "large" Section which is >= fsp_size) */ -#define H5MF_FSPACE_SECT_LARGE 2 +#define H5MF_FSPACE_SECT_LARGE 2 /* Get section class type based on size */ -#define H5MF_SECT_CLASS_TYPE(F, S) \ - ((H5F_PAGED_AGGR(F)) ? \ - ((S >= (F)->shared->fs_page_size) ? H5MF_FSPACE_SECT_LARGE : H5MF_FSPACE_SECT_SMALL) : H5MF_FSPACE_SECT_SIMPLE) +#define H5MF_SECT_CLASS_TYPE(F, S) \ + ((H5F_PAGED_AGGR(F)) \ + ? ((S >= (F)->shared->fs_page_size) ? H5MF_FSPACE_SECT_LARGE : H5MF_FSPACE_SECT_SMALL) \ + : H5MF_FSPACE_SECT_SIMPLE) /* Get section class cls */ -#define H5MF_SECT_CLS_TYPE(F, S) \ - ((H5F_PAGED_AGGR(F)) ? \ - ((S >= (F)->shared->fs_page_size) ? \ - H5MF_FSPACE_SECT_CLS_LARGE : H5MF_FSPACE_SECT_CLS_SMALL) : H5MF_FSPACE_SECT_CLS_SIMPLE) +#define H5MF_SECT_CLS_TYPE(F, S) \ + ((H5F_PAGED_AGGR(F)) \ + ? ((S >= (F)->shared->fs_page_size) ? H5MF_FSPACE_SECT_CLS_LARGE : H5MF_FSPACE_SECT_CLS_SMALL) \ + : H5MF_FSPACE_SECT_CLS_SIMPLE) /* Calculate the mis-aligned fragment */ -#define H5MF_EOA_MISALIGN(F, E, A, FR) \ -{ \ - hsize_t m; \ - \ - if(H5F_addr_gt((E), 0) && ((m) = ((E) + H5F_BASE_ADDR(F)) % (A))) \ - (FR) = (A) - m; \ - else \ - (FR) = 0; \ -} - +#define H5MF_EOA_MISALIGN(F, E, A, FR) \ + { \ + hsize_t m; \ + \ + if (H5F_addr_gt((E), 0) && ((m) = ((E) + H5F_BASE_ADDR(F)) % (A))) \ + (FR) = (A)-m; \ + else \ + (FR) = 0; \ + } /****************************/ /* Package Private Typedefs */ @@ -87,21 +86,22 @@ /* File free space section info */ typedef struct H5MF_free_section_t { - H5FS_section_info_t sect_info; /* Free space section information (must be first in struct) */ + H5FS_section_info_t sect_info; /* Free space section information (must be first in struct) */ #ifdef NOT_YET union { struct { - H5HF_indirect_t *parent; /* Indirect block parent for free section's direct block */ - unsigned par_entry; /* Entry of free section's direct block in parent indirect block */ + H5HF_indirect_t *parent; /* Indirect block parent for free section's direct block */ + unsigned par_entry; /* Entry of free section's direct block in parent indirect block */ } single; struct { - struct H5HF_free_section_t *under; /* Pointer to indirect block underlying row section */ - unsigned row; /* Row for range of blocks */ - unsigned col; /* Column for range of blocks */ - unsigned num_entries; /* Number of entries covered */ + struct H5HF_free_section_t *under; /* Pointer to indirect block underlying row section */ + unsigned row; /* Row for range of blocks */ + unsigned col; /* Column for range of blocks */ + unsigned num_entries; /* Number of entries covered */ /* Fields that aren't stored */ - hbool_t checked_out; /* Flag to indicate that a row section is temporarily out of the free space manager */ + hbool_t checked_out; /* Flag to indicate that a row section is temporarily out of the free space + manager */ } row; struct { /* Holds either a pointer to an indirect block (if its "live") or @@ -111,23 +111,24 @@ typedef struct H5MF_free_section_t { * or not) */ union { - H5HF_indirect_t *iblock; /* Indirect block for free section */ - hsize_t iblock_off; /* Indirect block offset in "heap space" */ + H5HF_indirect_t *iblock; /* Indirect block for free section */ + hsize_t iblock_off; /* Indirect block offset in "heap space" */ } u; - unsigned row; /* Row for range of blocks */ - unsigned col; /* Column for range of blocks */ - unsigned num_entries; /* Number of entries covered */ + unsigned row; /* Row for range of blocks */ + unsigned col; /* Column for range of blocks */ + unsigned num_entries; /* Number of entries covered */ /* Fields that aren't stored */ - struct H5HF_free_section_t *parent; /* Pointer to "parent" indirect section */ - unsigned par_entry; /* Entry within parent indirect section */ - hsize_t span_size; /* Size of space tracked, in "heap space" */ - unsigned iblock_entries; /* Number of entries in indirect block where section is located */ - unsigned rc; /* Reference count of outstanding row & child indirect sections */ - unsigned dir_nrows; /* Number of direct rows in section */ - struct H5HF_free_section_t **dir_rows; /* Array of pointers to outstanding row sections */ - unsigned indir_nents; /* Number of indirect entries in section */ - struct H5HF_free_section_t **indir_ents; /* Array of pointers to outstanding child indirect sections */ + struct H5HF_free_section_t *parent; /* Pointer to "parent" indirect section */ + unsigned par_entry; /* Entry within parent indirect section */ + hsize_t span_size; /* Size of space tracked, in "heap space" */ + unsigned iblock_entries; /* Number of entries in indirect block where section is located */ + unsigned rc; /* Reference count of outstanding row & child indirect sections */ + unsigned dir_nrows; /* Number of direct rows in section */ + struct H5HF_free_section_t **dir_rows; /* Array of pointers to outstanding row sections */ + unsigned indir_nents; /* Number of indirect entries in section */ + struct H5HF_free_section_t * + *indir_ents; /* Array of pointers to outstanding child indirect sections */ } indirect; } u; #endif /* NOT_YET */ @@ -135,34 +136,33 @@ typedef struct H5MF_free_section_t { /* Type of "container shrink" operation to perform */ typedef enum { - H5MF_SHRINK_EOA, /* Section should shrink the EOA value */ - H5MF_SHRINK_AGGR_ABSORB_SECT, /* Section should merge into the aggregator block */ - H5MF_SHRINK_SECT_ABSORB_AGGR /* Aggregator block should merge into the section */ + H5MF_SHRINK_EOA, /* Section should shrink the EOA value */ + H5MF_SHRINK_AGGR_ABSORB_SECT, /* Section should merge into the aggregator block */ + H5MF_SHRINK_SECT_ABSORB_AGGR /* Aggregator block should merge into the section */ } H5MF_shrink_type_t; /* User data for free space manager section callbacks */ typedef struct H5MF_sect_ud_t { /* Down */ - H5F_t *f; /* Pointer to file to operate on */ - H5FD_mem_t alloc_type; /* Type of memory being allocated */ - hbool_t allow_sect_absorb; /* Whether sections are allowed to absorb a block aggregator */ - hbool_t allow_eoa_shrink_only; /* Whether shrinking eoa is allowed only for the section */ + H5F_t * f; /* Pointer to file to operate on */ + H5FD_mem_t alloc_type; /* Type of memory being allocated */ + hbool_t allow_sect_absorb; /* Whether sections are allowed to absorb a block aggregator */ + hbool_t allow_eoa_shrink_only; /* Whether shrinking eoa is allowed only for the section */ /* Up */ - H5MF_shrink_type_t shrink; /* Type of shrink operation to perform */ - H5F_blk_aggr_t *aggr; /* Aggregator block to operate on */ + H5MF_shrink_type_t shrink; /* Type of shrink operation to perform */ + H5F_blk_aggr_t * aggr; /* Aggregator block to operate on */ } H5MF_sect_ud_t; /* Information about the current free-space manager to use */ typedef struct H5MF_fs_t { H5F_fs_state_t *fs_state; - haddr_t *fs_addr; - H5FS_t **fs_man; - hsize_t align_thres; /* Threshold for alignment */ - hsize_t alignment; /* Alignment */ + haddr_t * fs_addr; + H5FS_t ** fs_man; + hsize_t align_thres; /* Threshold for alignment */ + hsize_t alignment; /* Alignment */ } H5MF_fs_t; - /*****************************/ /* Package Private Variables */ /*****************************/ @@ -172,7 +172,6 @@ H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1]; H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1]; H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1]; - /******************************/ /* Package Private Prototypes */ /******************************/ @@ -182,25 +181,22 @@ H5_DLL herr_t H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL herr_t H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr); H5_DLL herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node); -H5_DLL void H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, - hsize_t size, H5F_mem_page_t *fs_type); +H5_DLL void H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, + H5F_mem_page_t *fs_type); /* 'simple/small/large' section routines */ -H5_DLL H5MF_free_section_t *H5MF__sect_new(unsigned ctype, haddr_t sect_off, - hsize_t sect_size); -H5_DLL herr_t H5MF__sect_free(H5FS_section_info_t *sect); - +H5_DLL H5MF_free_section_t *H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size); +H5_DLL herr_t H5MF__sect_free(H5FS_section_info_t *sect); /* Block aggregator routines */ -H5_DLL htri_t H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, - H5FD_mem_t type, haddr_t abs_blk_end, hsize_t extra_requested); +H5_DLL htri_t H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, haddr_t abs_blk_end, + hsize_t extra_requested); H5_DLL htri_t H5MF__aggrs_try_shrink_eoa(H5F_t *f); H5_DLL htri_t H5MF__aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, - const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink); -H5_DLL herr_t H5MF__aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, - H5MF_free_section_t *sect, hbool_t allow_sect_absorb); -H5_DLL herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, - haddr_t *addr, hsize_t *size); + const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink); +H5_DLL herr_t H5MF__aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect, + hbool_t allow_sect_absorb); +H5_DLL herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, hsize_t *size); /* Debugging routines */ #ifdef H5MF_ALLOC_DEBUG_DUMP @@ -212,4 +208,3 @@ H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream); #endif /* H5MF_TESTING */ #endif /* _H5MFpkg_H */ - |