00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00002 * Copyright by The HDF Group. * 00003 * Copyright by the Board of Trustees of the University of Illinois. * 00004 * All rights reserved. * 00005 * * 00006 * This file is part of HDF5. The full HDF5 copyright notice, including * 00007 * terms governing use, modification, and redistribution, is contained in * 00008 * the files COPYING and Copyright.html. COPYING can be found at the root * 00009 * of the source code distribution tree; Copyright.html can be found at the * 00010 * root level of an installed copy of the electronic HDF5 document set and * 00011 * is linked from the top-level documents page. It can also be found at * 00012 * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * 00013 * access to either file, you may request a copy from help@hdfgroup.org. * 00014 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00015 00016 /* 00017 * Programmer: Quincey Koziol <koziol@hdfgroup.org> 00018 * Tuesday, January 8, 2008 00019 * 00020 * Purpose: This file contains declarations which are visible only within 00021 * the H5MF package. Source files outside the H5MF package should 00022 * include H5MFprivate.h instead. 00023 */ 00024 #ifndef H5MF_PACKAGE 00025 #error "Do not include this file outside the H5MF package!" 00026 #endif 00027 00028 #ifndef _H5MFpkg_H 00029 #define _H5MFpkg_H 00030 00031 /* Get package's private header */ 00032 #include "H5MFprivate.h" 00033 00034 /* Other private headers needed by this file */ 00035 #include "H5FSprivate.h" /* File free space */ 00036 00037 00038 /**************************/ 00039 /* Package Private Macros */ 00040 /**************************/ 00041 00042 /* Define this to display information about file allocations */ 00043 /* #define H5MF_ALLOC_DEBUG */ 00044 00045 /* Define this to display more information about file allocations */ 00046 /* #define H5MF_ALLOC_DEBUG_MORE */ 00047 00048 /* Define this to display more information about block aggregator actions */ 00049 /* #define H5MF_AGGR_DEBUG */ 00050 00051 /* Define this to dump free space tracker contents after they've been modified */ 00052 /* #define H5MF_ALLOC_DEBUG_DUMP */ 00053 00054 /* Free space section types for file */ 00055 /* (values stored in free space data structures in file) */ 00056 #define H5MF_FSPACE_SECT_SIMPLE 0 /* Section is a range of actual bytes in file */ 00057 00058 00059 /****************************/ 00060 /* Package Private Typedefs */ 00061 /****************************/ 00062 00063 /* File free space section info */ 00064 typedef struct H5MF_free_section_t { 00065 H5FS_section_info_t sect_info; /* Free space section information (must be first in struct) */ 00066 #ifdef NOT_YET 00067 union { 00068 struct { 00069 H5HF_indirect_t *parent; /* Indirect block parent for free section's direct block */ 00070 unsigned par_entry; /* Entry of free section's direct block in parent indirect block */ 00071 } single; 00072 struct { 00073 struct H5HF_free_section_t *under; /* Pointer to indirect block underlying row section */ 00074 unsigned row; /* Row for range of blocks */ 00075 unsigned col; /* Column for range of blocks */ 00076 unsigned num_entries; /* Number of entries covered */ 00077 00078 /* Fields that aren't stored */ 00079 hbool_t checked_out; /* Flag to indicate that a row section is temporarily out of the free space manager */ 00080 } row; 00081 struct { 00082 /* Holds either a pointer to an indirect block (if its "live") or 00083 * the block offset of it's indirect block (if its "serialized") 00084 * (This allows the indirect block that the section is within to 00085 * be compared with other sections, whether it's serialized 00086 * or not) 00087 */ 00088 union { 00089 H5HF_indirect_t *iblock; /* Indirect block for free section */ 00090 hsize_t iblock_off; /* Indirect block offset in "heap space" */ 00091 } u; 00092 unsigned row; /* Row for range of blocks */ 00093 unsigned col; /* Column for range of blocks */ 00094 unsigned num_entries; /* Number of entries covered */ 00095 00096 /* Fields that aren't stored */ 00097 struct H5HF_free_section_t *parent; /* Pointer to "parent" indirect section */ 00098 unsigned par_entry; /* Entry within parent indirect section */ 00099 hsize_t span_size; /* Size of space tracked, in "heap space" */ 00100 unsigned iblock_entries; /* Number of entries in indirect block where section is located */ 00101 unsigned rc; /* Reference count of outstanding row & child indirect sections */ 00102 unsigned dir_nrows; /* Number of direct rows in section */ 00103 struct H5HF_free_section_t **dir_rows; /* Array of pointers to outstanding row sections */ 00104 unsigned indir_nents; /* Number of indirect entries in section */ 00105 struct H5HF_free_section_t **indir_ents; /* Array of pointers to outstanding child indirect sections */ 00106 } indirect; 00107 } u; 00108 #endif /* NOT_YET */ 00109 } H5MF_free_section_t; 00110 00111 /* Type of "container shrink" operation to perform */ 00112 typedef enum { 00113 H5MF_SHRINK_EOA, /* Section should shrink the EOA value */ 00114 H5MF_SHRINK_AGGR_ABSORB_SECT, /* Section should merge into the aggregator block */ 00115 H5MF_SHRINK_SECT_ABSORB_AGGR /* Aggregator block should merge into the section */ 00116 } H5MF_shrink_type_t; 00117 00118 /* User data for free space manager section callbacks */ 00119 typedef struct H5MF_sect_ud_t { 00120 /* Down */ 00121 H5F_t *f; /* Pointer to file to operate on */ 00122 hid_t dxpl_id; /* DXPL for VFD operations */ 00123 H5FD_mem_t alloc_type; /* Type of memory being allocated */ 00124 hbool_t allow_sect_absorb; /* Whether sections are allowed to absorb a block aggregator */ 00125 00126 /* Up */ 00127 H5MF_shrink_type_t shrink; /* Type of shrink operation to perform */ 00128 H5F_blk_aggr_t *aggr; /* Aggregator block to operate on */ 00129 } H5MF_sect_ud_t; 00130 00131 00132 /*****************************/ 00133 /* Package Private Variables */ 00134 /*****************************/ 00135 00136 /* H5MF single section inherits serializable properties from H5FS_section_class_t */ 00137 H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1]; 00138 00139 00140 /******************************/ 00141 /* Package Private Prototypes */ 00142 /******************************/ 00143 00144 /* Allocator routines */ 00145 H5_DLL herr_t H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); 00146 H5_DLL herr_t H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); 00147 H5_DLL herr_t H5MF_sects_dump(H5F_t *f, hid_t dxpl_id, FILE *stream); 00148 00149 /* 'simple' section routines */ 00150 H5_DLL H5MF_free_section_t *H5MF_sect_simple_new(haddr_t sect_off, 00151 hsize_t sect_size); 00152 H5_DLL htri_t H5MF_sect_simple_can_shrink(const H5FS_section_info_t *_sect, 00153 void *udata); 00154 H5_DLL herr_t H5MF_sect_simple_shrink(H5FS_section_info_t **_sect, 00155 void *udata); 00156 H5_DLL herr_t H5MF_sect_simple_free(H5FS_section_info_t *sect); 00157 00158 /* Block aggregator routines */ 00159 H5_DLL haddr_t H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr, 00160 H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size); 00161 H5_DLL htri_t H5MF_aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, 00162 H5FD_mem_t type, haddr_t abs_blk_end, hsize_t extra_requested); 00163 H5_DLL htri_t H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, 00164 const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink); 00165 H5_DLL herr_t H5MF_aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, 00166 H5MF_free_section_t *sect, hbool_t allow_sect_absorb); 00167 H5_DLL herr_t H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, 00168 haddr_t *addr, hsize_t *size); 00169 00170 /* Testing routines */ 00171 #ifdef H5MF_TESTING 00172 #endif /* H5MF_TESTING */ 00173 00174 #endif /* _H5MFpkg_H */ 00175