HDF5  1.12.0
H5MFpkg.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group. *
3  * Copyright by the Board of Trustees of the University of Illinois. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF5. The full HDF5 copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the COPYING file, which can be found at the root of the source code *
9  * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
10  * If you do not have access to either file, you may request a copy from *
11  * help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14 /*
15  * Programmer: Quincey Koziol <koziol@hdfgroup.org>
16  * Tuesday, January 8, 2008
17  *
18  * Purpose: This file contains declarations which are visible only within
19  * the H5MF package. Source files outside the H5MF package should
20  * include H5MFprivate.h instead.
21  */
22 #if !(defined H5MF_FRIEND || defined H5MF_MODULE)
23 #error "Do not include this file outside the H5MF package!"
24 #endif
25 
26 #ifndef _H5MFpkg_H
27 #define _H5MFpkg_H
28 
29 /* Get package's private header */
30 #include "H5MFprivate.h"
31 
32 /* Other private headers needed by this file */
33 #include "H5FSprivate.h" /* File free space */
34 
35 
36 /**************************/
37 /* Package Private Macros */
38 /**************************/
39 
40 /* Define this to display information about file allocations */
41 /* #define H5MF_ALLOC_DEBUG */
42 
43 /* Define this to display more information about file allocations */
44 /* #define H5MF_ALLOC_DEBUG_MORE */
45 
46 /* Define this to display more information about block aggregator actions */
47 /* #define H5MF_AGGR_DEBUG */
48 
49 /* Define this to dump free space tracker contents after they've been modified */
50 /* #define H5MF_ALLOC_DEBUG_DUMP */
51 
52 /* Free-space section types for file */
53 /* (values stored in free space data structures in file) */
54 #define H5MF_FSPACE_SECT_SIMPLE 0 /* For non-paged aggregation: section is a range of actual bytes in file */
55 #define H5MF_FSPACE_SECT_SMALL 1 /* For paged aggregation: "small" meta/raw data section which is < fsp_size) */
56 #define H5MF_FSPACE_SECT_LARGE 2 /* For paged aggregation: "large" Section which is >= fsp_size) */
57 
58 /* Get section class type based on size */
59 #define H5MF_SECT_CLASS_TYPE(F, S) \
60  ((H5F_PAGED_AGGR(F)) ? \
61  ((S >= (F)->shared->fs_page_size) ? H5MF_FSPACE_SECT_LARGE : H5MF_FSPACE_SECT_SMALL) : H5MF_FSPACE_SECT_SIMPLE)
62 
63 /* Get section class cls */
64 #define H5MF_SECT_CLS_TYPE(F, S) \
65  ((H5F_PAGED_AGGR(F)) ? \
66  ((S >= (F)->shared->fs_page_size) ? \
67  H5MF_FSPACE_SECT_CLS_LARGE : H5MF_FSPACE_SECT_CLS_SMALL) : H5MF_FSPACE_SECT_CLS_SIMPLE)
68 
69 /* Calculate the mis-aligned fragment */
70 #define H5MF_EOA_MISALIGN(F, E, A, FR) \
71 { \
72  hsize_t m; \
73  \
74  if(H5F_addr_gt((E), 0) && ((m) = ((E) + H5F_BASE_ADDR(F)) % (A))) \
75  (FR) = (A) - m; \
76  else \
77  (FR) = 0; \
78 }
79 
80 
81 /****************************/
82 /* Package Private Typedefs */
83 /****************************/
84 
85 /* File free space section info */
86 typedef struct H5MF_free_section_t {
87  H5FS_section_info_t sect_info; /* Free space section information (must be first in struct) */
88 #ifdef NOT_YET
89  union {
90  struct {
91  H5HF_indirect_t *parent; /* Indirect block parent for free section's direct block */
92  unsigned par_entry; /* Entry of free section's direct block in parent indirect block */
93  } single;
94  struct {
95  struct H5HF_free_section_t *under; /* Pointer to indirect block underlying row section */
96  unsigned row; /* Row for range of blocks */
97  unsigned col; /* Column for range of blocks */
98  unsigned num_entries; /* Number of entries covered */
99 
100  /* Fields that aren't stored */
101  hbool_t checked_out; /* Flag to indicate that a row section is temporarily out of the free space manager */
102  } row;
103  struct {
104  /* Holds either a pointer to an indirect block (if its "live") or
105  * the block offset of it's indirect block (if its "serialized")
106  * (This allows the indirect block that the section is within to
107  * be compared with other sections, whether it's serialized
108  * or not)
109  */
110  union {
111  H5HF_indirect_t *iblock; /* Indirect block for free section */
112  hsize_t iblock_off; /* Indirect block offset in "heap space" */
113  } u;
114  unsigned row; /* Row for range of blocks */
115  unsigned col; /* Column for range of blocks */
116  unsigned num_entries; /* Number of entries covered */
117 
118  /* Fields that aren't stored */
119  struct H5HF_free_section_t *parent; /* Pointer to "parent" indirect section */
120  unsigned par_entry; /* Entry within parent indirect section */
121  hsize_t span_size; /* Size of space tracked, in "heap space" */
122  unsigned iblock_entries; /* Number of entries in indirect block where section is located */
123  unsigned rc; /* Reference count of outstanding row & child indirect sections */
124  unsigned dir_nrows; /* Number of direct rows in section */
125  struct H5HF_free_section_t **dir_rows; /* Array of pointers to outstanding row sections */
126  unsigned indir_nents; /* Number of indirect entries in section */
127  struct H5HF_free_section_t **indir_ents; /* Array of pointers to outstanding child indirect sections */
128  } indirect;
129  } u;
130 #endif /* NOT_YET */
132 
133 /* Type of "container shrink" operation to perform */
134 typedef enum {
135  H5MF_SHRINK_EOA, /* Section should shrink the EOA value */
136  H5MF_SHRINK_AGGR_ABSORB_SECT, /* Section should merge into the aggregator block */
137  H5MF_SHRINK_SECT_ABSORB_AGGR /* Aggregator block should merge into the section */
139 
140 /* User data for free space manager section callbacks */
141 typedef struct H5MF_sect_ud_t {
142  /* Down */
143  H5F_t *f; /* Pointer to file to operate on */
144  H5FD_mem_t alloc_type; /* Type of memory being allocated */
145  hbool_t allow_sect_absorb; /* Whether sections are allowed to absorb a block aggregator */
146  hbool_t allow_eoa_shrink_only; /* Whether shrinking eoa is allowed only for the section */
147 
148  /* Up */
149  H5MF_shrink_type_t shrink; /* Type of shrink operation to perform */
150  H5F_blk_aggr_t *aggr; /* Aggregator block to operate on */
152 
153 /* Information about the current free-space manager to use */
154 typedef struct H5MF_fs_t {
158  hsize_t align_thres; /* Threshold for alignment */
159  hsize_t alignment; /* Alignment */
161 
162 
163 /*****************************/
164 /* Package Private Variables */
165 /*****************************/
166 
167 /* H5MF single section inherits serializable properties from H5FS_section_class_t */
171 
172 
173 /******************************/
174 /* Package Private Prototypes */
175 /******************************/
176 
177 /* Allocator routines */
180 H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr);
183  hsize_t size, H5F_mem_page_t *fs_type);
184 
185 /* 'simple/small/large' section routines */
186 H5_DLL H5MF_free_section_t *H5MF__sect_new(unsigned ctype, haddr_t sect_off,
187  hsize_t sect_size);
189 
190 
191 /* Block aggregator routines */
193  H5FD_mem_t type, haddr_t abs_blk_end, hsize_t extra_requested);
195  const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink);
197  H5MF_free_section_t *sect, hbool_t allow_sect_absorb);
198 H5_DLL herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr,
199  haddr_t *addr, hsize_t *size);
200 
201 /* Debugging routines */
202 #ifdef H5MF_ALLOC_DEBUG_DUMP
203 H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream);
204 #endif /* H5MF_ALLOC_DEBUG_DUMP */
205 
206 /* Testing routines */
207 #ifdef H5MF_TESTING
208 #endif /* H5MF_TESTING */
209 
210 #endif /* _H5MFpkg_H */
211 
u
hsize_t u
Definition: H5EA.c:1007
H5MF_shrink_type_t
H5MF_shrink_type_t
Definition: H5MFpkg.h:134
H5MF__add_sect
H5_DLL herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node)
Definition: H5MF.c:642
size
iblock size
Definition: H5EAcache.c:787
H5HF_free_section_t::indir_ents
struct H5HF_free_section_t ** indir_ents
Definition: H5HFpkg.h:287
f
hdr f
Definition: H5EA.c:755
H5HF_free_section_t::under
struct H5HF_free_section_t * under
Definition: H5HFpkg.h:255
H5FS_t
Definition: H5FSpkg.h:150
H5MF_fs_t::fs_state
H5F_fs_state_t * fs_state
Definition: H5MFpkg.h:155
H5MF__find_sect
H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr)
Definition: H5MF.c:701
H5MF_sect_ud_t::shrink
H5MF_shrink_type_t shrink
Definition: H5MFpkg.h:149
H5MF_SHRINK_AGGR_ABSORB_SECT
@ H5MF_SHRINK_AGGR_ABSORB_SECT
Definition: H5MFpkg.h:136
H5HF_free_section_t::dir_rows
struct H5HF_free_section_t ** dir_rows
Definition: H5HFpkg.h:285
H5MF_fs_t
struct H5MF_fs_t H5MF_fs_t
H5MF__sect_new
H5_DLL H5MF_free_section_t * H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size)
Definition: H5MFsection.c:208
iblock
iblock
Definition: H5EAiblock.c:509
H5MF_sect_ud_t::f
H5F_t * f
Definition: H5MFpkg.h:143
haddr_t
CATCH haddr_t
Definition: H5EAdblock.c:162
H5MF_free_section_t::sect_info
H5FS_section_info_t sect_info
Definition: H5MFpkg.h:87
H5MF_fs_t::fs_addr
haddr_t * fs_addr
Definition: H5MFpkg.h:156
H5MF_sect_ud_t::allow_sect_absorb
hbool_t allow_sect_absorb
Definition: H5MFpkg.h:145
H5MFprivate.h
H5FS_section_info_t
Definition: H5FSprivate.h:96
H5F_blk_aggr_t
Definition: H5Fpkg.h:181
H5FS_section_class_t
Definition: H5FSprivate.h:64
H5_DLLVAR
#define H5_DLLVAR
Definition: H5api_adpt.h:235
H5MF__aggr_can_absorb
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)
Definition: H5MFaggr.c:506
H5HF_free_section_t::rc
unsigned rc
Definition: H5HFpkg.h:283
H5MF_SHRINK_SECT_ABSORB_AGGR
@ H5MF_SHRINK_SECT_ABSORB_AGGR
Definition: H5MFpkg.h:137
htri_t
int htri_t
Definition: H5public.h:160
H5F_mem_page_t
H5F_mem_page_t
Definition: H5Fprivate.h:689
H5F_shared_t
Definition: H5Fpkg.h:242
H5MF_fs_t
Definition: H5MFpkg.h:154
H5MF_fs_t::alignment
hsize_t alignment
Definition: H5MFpkg.h:159
FILE
Invalid arguments to routine Resource unavailable Internal File accessibility Low level I O Function entry exit Object atom Object cache Links B Tree node Symbol table Heap Object header Datatype Dataspace Dataset Data storage Property lists Attribute Data filters External file list References Virtual File Layer Virtual Object Layer Ternary Search Trees Reference Counted Strings Error API Skip Lists Free Space Manager Shared Object Header Messages Extensible Array Fixed Array Plugin for dynamically loaded library Page Buffering API Context Map No error Argument errors Resource errors File accessibility errors FILE
Definition: H5err.txt:88
H5MF_FSPACE_SECT_CLS_SMALL
H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1]
Definition: H5MFpkg.h:169
H5HF_indirect_t
Definition: H5HFpkg.h:377
H5MF_sect_ud_t::aggr
H5F_blk_aggr_t * aggr
Definition: H5MFpkg.h:150
H5HF_free_section_t::col
unsigned col
Definition: H5HFpkg.h:257
H5MF_fs_t::fs_man
H5FS_t ** fs_man
Definition: H5MFpkg.h:157
H5MF_fs_t::align_thres
hsize_t align_thres
Definition: H5MFpkg.h:158
H5F_fs_state_t
H5F_fs_state_t
Definition: H5Fprivate.h:681
H5FSprivate.h
H5FD_mem_t
enum H5F_mem_t H5FD_mem_t
Definition: H5FDpublic.h:28
H5HF_free_section_t
Definition: H5HFpkg.h:247
H5HF_free_section_t::iblock_entries
unsigned iblock_entries
Definition: H5HFpkg.h:282
H5_DLL
#define H5_DLL
Definition: H5api_adpt.h:234
H5MF_FSPACE_SECT_CLS_LARGE
H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1]
Definition: H5MFpkg.h:170
H5MF__alloc_to_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)
Definition: H5MF.c:261
H5HF_free_section_t::checked_out
hbool_t checked_out
Definition: H5HFpkg.h:261
H5MF__start_fstype
H5_DLL herr_t H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type)
Definition: H5MF.c:475
H5MF_free_section_t
Definition: H5MFpkg.h:86
H5HF_free_section_t::dir_nrows
unsigned dir_nrows
Definition: H5HFpkg.h:284
H5MF__aggr_absorb
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)
H5HF_free_section_t::indir_nents
unsigned indir_nents
Definition: H5HFpkg.h:286
H5HF_free_section_t::row
unsigned row
Definition: H5HFpkg.h:256
H5MF_FSPACE_SECT_CLS_SIMPLE
H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1]
Definition: H5MFpkg.h:168
H5MF_sect_ud_t
struct H5MF_sect_ud_t H5MF_sect_ud_t
H5F_t
Definition: H5Fpkg.h:374
H5HF_free_section_t::indirect
struct H5HF_free_section_t::@17::@20 indirect
H5HF_free_section_t::num_entries
unsigned num_entries
Definition: H5HFpkg.h:258
H5MF__open_fstype
H5_DLL herr_t H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type)
Definition: H5MF.c:309
herr_t
int herr_t
Definition: H5public.h:128
H5MF__sect_free
H5_DLL herr_t H5MF__sect_free(H5FS_section_info_t *sect)
Definition: H5MFsection.c:252
H5MF__aggr_query
H5_DLL herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, hsize_t *size)
Definition: H5MFaggr.c:645
hbool_t
bool hbool_t
Definition: H5public.h:159
H5MF_free_section_t
struct H5MF_free_section_t H5MF_free_section_t
hsize_t
hsize_t
Definition: H5overflow.txt:44
H5MF_SHRINK_EOA
@ H5MF_SHRINK_EOA
Definition: H5MFpkg.h:135
H5MF_sect_ud_t::allow_eoa_shrink_only
hbool_t allow_eoa_shrink_only
Definition: H5MFpkg.h:146
H5MF_sect_ud_t
Definition: H5MFpkg.h:141
H5HF_free_section_t::parent
H5HF_indirect_t * parent
Definition: H5HFpkg.h:251
H5MF_sect_ud_t::alloc_type
H5FD_mem_t alloc_type
Definition: H5MFpkg.h:144
H5MF__aggr_try_extend
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)
Definition: H5MFaggr.c:408
H5HF_free_section_t::span_size
hsize_t span_size
Definition: H5HFpkg.h:281
H5HF_free_section_t::par_entry
unsigned par_entry
Definition: H5HFpkg.h:252