summaryrefslogtreecommitdiffstats
path: root/src/H5Ofsinfo.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2017-03-14 04:30:37 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2017-03-14 04:30:37 (GMT)
commit0313cbb91d974b153dbe8747d193ac3c619eea3b (patch)
treeaf6c4a631d5753685ee0033a6a8415a25fc97672 /src/H5Ofsinfo.c
parent847d675f2743ec420ef6c9efdd6e52ae93b4fe44 (diff)
downloadhdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.zip
hdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.tar.gz
hdf5-0313cbb91d974b153dbe8747d193ac3c619eea3b.tar.bz2
Final merge of page buffering branch to develop
Diffstat (limited to 'src/H5Ofsinfo.c')
-rw-r--r--src/H5Ofsinfo.c190
1 files changed, 144 insertions, 46 deletions
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
index 938d319..37ec627 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -23,12 +23,13 @@
*
*-------------------------------------------------------------------------
*/
-
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "H5Omodule.h" /* This source code file is part of the H5O module */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
#include "H5FLprivate.h" /* Free lists */
#include "H5Opkg.h" /* Object headers */
@@ -66,7 +67,8 @@ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{
}};
/* Current version of free-space manager info information */
-#define H5O_FSINFO_VERSION 0
+#define H5O_FSINFO_VERSION_0 0
+#define H5O_FSINFO_VERSION_1 1
/* Declare a free list to manage the H5O_fsinfo_t struct */
H5FL_DEFINE_STATIC(H5O_fsinfo_t);
@@ -85,12 +87,13 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t);
*-------------------------------------------------------------------------
*/
static void *
-H5O_fsinfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
+H5O_fsinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
{
- H5O_fsinfo_t *fsinfo = NULL; /* free-space manager info */
- H5FD_mem_t type; /* Memory type for iteration */
- void *ret_value = NULL; /* Return value */
+ H5O_fsinfo_t *fsinfo = NULL; /* File space info message */
+ H5F_mem_page_t ptype; /* Memory type for iteration */
+ unsigned vers; /* message version */
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -98,26 +101,83 @@ H5O_fsinfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *
HDassert(f);
HDassert(p);
- /* Version of message */
- if(*p++ != H5O_FSINFO_VERSION)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
-
/* Allocate space for message */
if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- fsinfo->strategy = (H5F_file_space_type_t)*p++; /* file space strategy */
- H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* free space section size threshold */
+ for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ fsinfo->fs_addr[ptype - 1] = HADDR_UNDEF;
- /* Addresses of free space managers: only exist for H5F_FILE_SPACE_ALL_PERSIST */
- if(fsinfo->strategy == H5F_FILE_SPACE_ALL_PERSIST) {
- for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
- H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type-1]));
- } /* end if */
- else {
- for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
- fsinfo->fs_addr[type-1] = HADDR_UNDEF;
- } /* end else */
+ /* Version of message */
+ vers = *p++;
+
+ if(vers == H5O_FSINFO_VERSION_0) {
+ H5F_file_space_type_t strategy; /* Strategy */
+ hsize_t threshold; /* Threshold */
+ H5FD_mem_t type; /* Memory type for iteration */
+
+ fsinfo->persist = H5F_FREE_SPACE_PERSIST_DEF;
+ fsinfo->threshold = H5F_FREE_SPACE_THRESHOLD_DEF;
+ fsinfo->page_size = H5F_FILE_SPACE_PAGE_SIZE_DEF;
+ fsinfo->pgend_meta_thres = H5F_FILE_SPACE_PGEND_META_THRES;
+ fsinfo->eoa_pre_fsm_fsalloc = HADDR_UNDEF;
+
+ strategy = (H5F_file_space_type_t)*p++; /* File space strategy */
+ H5F_DECODE_LENGTH(f, p, threshold); /* Free-space section threshold */
+
+ /* Map version 0 (deprecated) to version 1 message */
+ switch(strategy) {
+
+ case H5F_FILE_SPACE_ALL_PERSIST:
+ fsinfo->strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
+ fsinfo->persist = TRUE;
+ fsinfo->threshold = threshold;
+ if(HADDR_UNDEF == (fsinfo->eoa_pre_fsm_fsalloc = H5F_get_eoa(f, H5FD_MEM_DEFAULT)) )
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file size")
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
+ H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type-1]));
+ break;
+
+ case H5F_FILE_SPACE_ALL:
+ fsinfo->strategy = H5F_FSPACE_STRATEGY_FSM_AGGR;
+ fsinfo->threshold = threshold;
+ break;
+
+ case H5F_FILE_SPACE_AGGR_VFD:
+ fsinfo->strategy = H5F_FSPACE_STRATEGY_AGGR;
+ break;
+
+ case H5F_FILE_SPACE_VFD:
+ fsinfo->strategy = H5F_FSPACE_STRATEGY_NONE;
+ break;
+
+ case H5F_FILE_SPACE_NTYPES:
+ case H5F_FILE_SPACE_DEFAULT:
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file space strategy")
+ } /* end switch */
+
+ fsinfo->mapped = TRUE;
+
+ } else {
+ HDassert(vers == H5O_FSINFO_VERSION_1);
+
+ fsinfo->strategy = (H5F_fspace_strategy_t)*p++; /* File space strategy */
+ fsinfo->persist = *p++; /* Free-space persist or not */
+ H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section threshold */
+
+ H5F_DECODE_LENGTH(f, p, fsinfo->page_size); /* File space page size */
+ UINT16DECODE(p, fsinfo->pgend_meta_thres); /* Page end metdata threshold */
+ H5F_addr_decode(f, &p, &(fsinfo->eoa_pre_fsm_fsalloc)); /* EOA before free-space header and section info */
+
+ /* Decode addresses of free space managers, if persisting */
+ if(fsinfo->persist) {
+ for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ H5F_addr_decode(f, &p, &(fsinfo->fs_addr[ptype - 1]));
+ } /* end if */
+
+ fsinfo->mapped = FALSE;
+ }
/* Set return value */
ret_value = fsinfo;
@@ -145,7 +205,7 @@ static herr_t
H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg;
- H5FD_mem_t type; /* Memory type for iteration */
+ H5F_mem_page_t ptype; /* Memory type for iteration */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -154,14 +214,20 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c
HDassert(p);
HDassert(fsinfo);
- *p++ = H5O_FSINFO_VERSION; /* message version */
- *p++ = fsinfo->strategy; /* file space strategy */
- H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* free-space section size threshold */
+ *p++ = H5O_FSINFO_VERSION_1; /* message version */
+ *p++ = fsinfo->strategy; /* File space strategy */
+ *p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */
+ H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */
+
+ H5F_ENCODE_LENGTH(f, p, fsinfo->page_size); /* File space page size */
+ UINT16ENCODE(p, fsinfo->pgend_meta_thres); /* Page end metadata threshold */
+ H5F_addr_encode(f, &p, fsinfo->eoa_pre_fsm_fsalloc); /* EOA before free-space header and section info */
- /* Addresses of free space managers: only exist for H5F_FILE_SPACE_ALL_PERSIST */
- if(fsinfo->strategy == H5F_FILE_SPACE_ALL_PERSIST) {
- for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
- H5F_addr_encode(f, &p, fsinfo->fs_addr[type-1]);
+ /* Store addresses of free-space managers, if persisting */
+ if(fsinfo->persist) {
+ /* Addresses of free-space managers */
+ for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ H5F_addr_encode(f, &p, fsinfo->fs_addr[ptype - 1]);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -224,19 +290,19 @@ static size_t
H5O_fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void *_mesg)
{
const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *)_mesg;
- size_t fs_addr_size = 0;
size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Addresses of free-space managers exist only for H5F_FILE_SPACE_ALL_PERSIST type */
- if(H5F_FILE_SPACE_ALL_PERSIST == fsinfo->strategy)
- fs_addr_size = (H5FD_MEM_NTYPES - 1) * (size_t)H5F_SIZEOF_ADDR(f);
-
- ret_value = 2 /* Version & strategy */
- + (size_t)H5F_SIZEOF_SIZE(f) /* Threshold */
- + fs_addr_size; /* Addresses of free-space managers */
+ ret_value = 3 /* Version, strategy & persist */
+ + (size_t)H5F_SIZEOF_SIZE(f) /* Free-space section threshold */
+ + (size_t)H5F_SIZEOF_SIZE(f) /* File space page size */
+ + 2 /* Page end meta threshold */
+ + (size_t)H5F_SIZEOF_ADDR(f);
+
+ /* Free-space manager addresses */
+ if(fsinfo->persist)
+ ret_value += (H5F_MEM_PAGE_NTYPES - 1) * (size_t)H5F_SIZEOF_ADDR(f);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_fsinfo_size() */
@@ -282,7 +348,7 @@ H5O_fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const vo
int indent, int fwidth)
{
const H5O_fsinfo_t *fsinfo = (const H5O_fsinfo_t *) _mesg;
- H5FD_mem_t type; /* Memory type for iteration */
+ H5F_mem_page_t ptype; /* Free-space types for iteration */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -293,16 +359,48 @@ H5O_fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const vo
HDassert(indent >= 0);
HDassert(fwidth >= 0);
- HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
- "File space strategy:", fsinfo->strategy);
+ HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "File space strategy:");
+ switch(fsinfo->strategy) {
+ case H5F_FSPACE_STRATEGY_FSM_AGGR:
+ HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_FSM_AGGR");
+ break;
+
+ case H5F_FSPACE_STRATEGY_PAGE:
+ HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_PAGE");
+ break;
+
+ case H5F_FSPACE_STRATEGY_AGGR:
+ HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_AGGR");
+ break;
+
+ case H5F_FSPACE_STRATEGY_NONE:
+ HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_NONE");
+ break;
+
+ case H5F_FSPACE_STRATEGY_NTYPES:
+ default:
+ HDfprintf(stream, "%s\n", "unknown");
+ } /* end switch */
+
+ HDfprintf(stream, "%*s%-*s %t\n", indent, "", fwidth,
+ "Free-space persist:", fsinfo->persist);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
- "Free space section threshold:", fsinfo->threshold);
+ "Free-space section threshold:", fsinfo->threshold);
+
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth,
+ "File space page size:", fsinfo->page_size);
+
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Page end metadata threshold:", fsinfo->pgend_meta_thres);
+
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc);
- if(fsinfo->strategy == H5F_FILE_SPACE_ALL_PERSIST) {
- for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type))
- HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
- "Free space manager address:", fsinfo->fs_addr[type-1]);
+ if(fsinfo->persist) {
+ for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype))
+ HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
+ "Free space manager address:", fsinfo->fs_addr[ptype-1]);
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)