diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-11-18 00:05:45 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-11-18 00:05:45 (GMT) |
commit | a28e8407cf5a526a20ad682382f0faed58aace76 (patch) | |
tree | be0dc3b77a701265e64d7914bd480f7f797cde86 /src | |
parent | 4a219c18b65436d9abce2b6554e0dc153745b3b5 (diff) | |
download | hdf5-a28e8407cf5a526a20ad682382f0faed58aace76.zip hdf5-a28e8407cf5a526a20ad682382f0faed58aace76.tar.gz hdf5-a28e8407cf5a526a20ad682382f0faed58aace76.tar.bz2 |
[svn-r16093] Description:
Initial changes to allow data blocks to be paged in, instead of loaded
completely.
Also, refactored test code to be smaller and more maintainable.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src')
-rw-r--r-- | src/H5EAcache.c | 14 | ||||
-rw-r--r-- | src/H5EAdbg.c | 6 | ||||
-rw-r--r-- | src/H5EAhdr.c | 10 | ||||
-rw-r--r-- | src/H5EApkg.h | 18 | ||||
-rw-r--r-- | src/H5EAprivate.h | 1 | ||||
-rw-r--r-- | src/H5EAtest.c | 5 |
6 files changed, 42 insertions, 12 deletions
diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 0f454bc..b8b5786 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -235,14 +235,17 @@ H5EA__cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_cls, hdr->cparam.idx_blk_elmts = *p++; /* # of elements to store in index block */ hdr->cparam.data_blk_min_elmts = *p++; /* Min. # of elements per data block */ hdr->cparam.sup_blk_min_data_ptrs = *p++; /* Min. # of data block pointers for a super block */ + hdr->cparam.max_dblk_page_nelmts_bits = *p++; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ - /* Internal information */ - H5F_addr_decode(f, &p, &hdr->idx_blk_addr); /* Address of index block */ + /* Array statistics */ H5F_DECODE_LENGTH(f, p, hdr->stats.max_idx_set); /* Max. index set (+1) */ H5F_DECODE_LENGTH(f, p, hdr->stats.nsuper_blks); /* Number of super blocks created */ H5F_DECODE_LENGTH(f, p, hdr->stats.ndata_blks); /* Number of data blocks created */ H5F_DECODE_LENGTH(f, p, hdr->stats.nelmts); /* Number of elements 'realized' */ + /* Internal information */ + H5F_addr_decode(f, &p, &hdr->idx_blk_addr); /* Address of index block */ + /* Sanity check */ /* (allow for checksum not decoded yet) */ HDassert((size_t)(p - buf) == (size - H5EA_SIZEOF_CHKSUM)); @@ -343,14 +346,17 @@ H5EA__cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, *p++ = hdr->cparam.idx_blk_elmts; /* # of elements to store in index block */ *p++ = hdr->cparam.data_blk_min_elmts; /* Min. # of elements per data block */ *p++ = hdr->cparam.sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ + *p++ = hdr->cparam.max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ - /* Internal information */ - H5F_addr_encode(f, &p, hdr->idx_blk_addr); /* Address of index block */ + /* Array statistics */ H5F_ENCODE_LENGTH(f, p, hdr->stats.max_idx_set); /* Max. index set (+1) */ H5F_ENCODE_LENGTH(f, p, hdr->stats.nsuper_blks); /* Number of super blocks created */ H5F_ENCODE_LENGTH(f, p, hdr->stats.ndata_blks); /* Number of data blocks created */ H5F_ENCODE_LENGTH(f, p, hdr->stats.nelmts); /* Number of elements 'realized' */ + /* Internal information */ + H5F_addr_encode(f, &p, hdr->idx_blk_addr); /* Address of index block */ + /* Compute metadata checksum */ metadata_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index 47fcbd0..0cafe3d 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -131,6 +131,9 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Log2(Max. # of elements in array):", + (unsigned)hdr->cparam.max_nelmts_bits); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "# of elements in index block:", (unsigned)hdr->cparam.idx_blk_elmts); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, @@ -139,6 +142,9 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Min. # of data block pointers for a super block:", (unsigned)hdr->cparam.sup_blk_min_data_ptrs); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Log2(Max. # of elements in data block page):", + (unsigned)hdr->cparam.max_dblk_page_nelmts_bits); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Highest element index stored (+1):", hdr->stats.max_idx_set); diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 3e98263..e0e97e8 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -374,15 +374,17 @@ HDfprintf(stderr, "%s: Called\n", FUNC); if(cparam->raw_elmt_size == 0) H5E_THROW(H5E_BADVALUE, "element size must be greater than zero") if(cparam->max_nelmts_bits == 0) - H5E_THROW(H5E_BADVALUE, "max. # of nelmts bitsmust be greater than zero") + H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be greater than zero") if(cparam->max_nelmts_bits > H5EA_MAX_NELMTS_IDX_MAX) - H5E_THROW(H5E_BADVALUE, "element size must be <= %u", (unsigned)H5EA_MAX_NELMTS_IDX_MAX) + H5E_THROW(H5E_BADVALUE, "max. # of elements bits must be <= %u", (unsigned)H5EA_MAX_NELMTS_IDX_MAX) if(cparam->sup_blk_min_data_ptrs < 2) H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be >= two") if(!POWER_OF_TWO(cparam->sup_blk_min_data_ptrs)) - H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block not power of two") + H5E_THROW(H5E_BADVALUE, "min # of data block pointers in super block must be power of two") if(!POWER_OF_TWO(cparam->data_blk_min_elmts)) - H5E_THROW(H5E_BADVALUE, "min # of elements per data block not power of two") + H5E_THROW(H5E_BADVALUE, "min # of elements per data block must be power of two") + if(cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits) + H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be <= max. # of elements bits") #endif /* NDEBUG */ /* Allocate space for the shared information */ diff --git a/src/H5EApkg.h b/src/H5EApkg.h index 9fded70..a1f578f 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -354,7 +354,6 @@ func_init_failed: \ #define H5EA_METADATA_PREFIX_SIZE(c) ( \ H5_SIZEOF_MAGIC /* Signature */ \ + 1 /* Version */ \ - + 1 /* Array type */ \ + ((c) ? H5EA_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \ ) @@ -364,11 +363,13 @@ func_init_failed: \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ /* General heap information */ \ + + 1 /* Array type */ \ + 1 /* Element Size */ \ + 1 /* Max. # of elements bits */ \ + 1 /* # of elements to store in index block */ \ + 1 /* Min. # elements per data block */ \ + 1 /* Min. # of data block pointers for a super block */ \ + + 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \ \ /* Extensible Array Header statistics fields */ \ + (h)->sizeof_size /* Max. index set */ \ @@ -385,8 +386,11 @@ func_init_failed: \ /* General metadata fields */ \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ - /* Extensible Array Index Block specific fields */ \ + /* Sanity-checking fields */ \ + + 1 /* Array type */ \ + (i)->hdr->sizeof_addr /* File address of array owning the block */ \ + \ + /* Extensible Array Index Block specific fields */ \ + ((size_t)(i)->hdr->cparam.idx_blk_elmts * (size_t)(i)->hdr->cparam.raw_elmt_size) /* Elements in index block */ \ + ((i)->ndblk_addrs * (i)->hdr->sizeof_addr) /* Data block addresses in index block */ \ + ((i)->nsblk_addrs * (i)->hdr->sizeof_addr) /* Super block addresses in index block */ \ @@ -397,9 +401,12 @@ func_init_failed: \ /* General metadata fields */ \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ - /* Extensible Array Super Block specific fields */ \ + /* Sanity-checking fields */ \ + + 1 /* Array type */ \ + (s)->hdr->sizeof_addr /* File address of array owning the block */ \ + (s)->hdr->arr_off_size /* Offset of the block in the array */ \ + \ + /* Extensible Array Super Block specific fields */ \ + ((s)->ndblks * (s)->hdr->sizeof_addr) /* Data block addresses in super block */ \ ) @@ -408,9 +415,12 @@ func_init_failed: \ /* General metadata fields */ \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ - /* Extensible Array Data Block specific fields */ \ + /* Sanity-checking fields */ \ + + 1 /* Array type */ \ + (d)->hdr->sizeof_addr /* File address of array owning the block */ \ + (d)->hdr->arr_off_size /* Offset of the block in the array */ \ + \ + /* Extensible Array Data Block specific fields */ \ + ((d)->nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) /* Elements in index block */ \ ) diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index f70a734..a1f3221 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -76,6 +76,7 @@ typedef struct H5EA_create_t { uint8_t idx_blk_elmts; /* # of elements to store in index block */ uint8_t data_blk_min_elmts; /* Min. # of elements per data block */ uint8_t sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ + uint8_t max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ } H5EA_create_t; /* Extensible array metadata statistics info */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 25b33dd..eea69ea 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -267,6 +267,7 @@ H5EA_get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam)) cparam->idx_blk_elmts = ea->hdr->cparam.idx_blk_elmts; cparam->sup_blk_min_data_ptrs = ea->hdr->cparam.sup_blk_min_data_ptrs; cparam->data_blk_min_elmts = ea->hdr->cparam.data_blk_min_elmts; + cparam->max_dblk_page_nelmts_bits = ea->hdr->cparam.max_dblk_page_nelmts_bits; END_FUNC(PRIV) /* end H5EA_get_cparam_test() */ @@ -313,6 +314,10 @@ H5EA_cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2) H5_LEAVE(-1) else if(cparam1->data_blk_min_elmts > cparam2->data_blk_min_elmts) H5_LEAVE(1) + if(cparam1->max_dblk_page_nelmts_bits < cparam2->max_dblk_page_nelmts_bits) + H5_LEAVE(-1) + else if(cparam1->max_dblk_page_nelmts_bits > cparam2->max_dblk_page_nelmts_bits) + H5_LEAVE(1) CATCH |