diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-11-11 23:30:37 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-11-11 23:30:37 (GMT) |
commit | 164a8426ea4d10ba2bca71d0a91dacec72cd79e9 (patch) | |
tree | 707ee57516158c4d821bb1f78e365c95069371a3 /src/H5EAcache.c | |
parent | 05e559c9ec89fc50e7b6b03b5109c22adeb2bfc9 (diff) | |
download | hdf5-164a8426ea4d10ba2bca71d0a91dacec72cd79e9.zip hdf5-164a8426ea4d10ba2bca71d0a91dacec72cd79e9.tar.gz hdf5-164a8426ea4d10ba2bca71d0a91dacec72cd79e9.tar.bz2 |
[svn-r16061] Description:
Store extra information about each block in the metadata for the block,
in the hope that a corrupted file will be easier to recover. (Similar to the
information stored for fractal heaps)
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/H5EAcache.c')
-rw-r--r-- | src/H5EAcache.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/H5EAcache.c b/src/H5EAcache.c index fe64d05..0f454bc 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -519,6 +519,7 @@ H5EA__cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const uint8_t *p; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + haddr_t arr_addr; /* Address of array header in the file */ /* Sanity check */ HDassert(f); @@ -559,6 +560,11 @@ H5EA__cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, if(*p++ != H5EA_IBLOCK_VERSION) H5E_THROW(H5E_VERSION, "wrong extensible array index block version") + /* Address of header for array that owns this block (just for file integrity checks) */ + H5F_addr_decode(f, &p, &arr_addr); + if(H5F_addr_ne(arr_addr, hdr->addr)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + /* Extensible array type */ if(*p++ != (uint8_t)hdr->cparam.cls->id) H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") @@ -681,6 +687,9 @@ H5EA__cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Version # */ *p++ = H5EA_IBLOCK_VERSION; + /* Address of array header for array which owns this block */ + H5F_addr_encode(f, &p, iblock->hdr->addr); + /* Extensible array type */ *p++ = iblock->hdr->cparam.cls->id; @@ -880,6 +889,7 @@ H5EA__cache_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const uint8_t *p; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + haddr_t arr_addr; /* Address of array header in the file */ /* Sanity check */ HDassert(f); @@ -921,6 +931,14 @@ H5EA__cache_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, if(*p++ != H5EA_SBLOCK_VERSION) H5E_THROW(H5E_VERSION, "wrong extensible array super block version") + /* Address of header for array that owns this block (just for file integrity checks) */ + H5F_addr_decode(f, &p, &arr_addr); + if(H5F_addr_ne(arr_addr, hdr->addr)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + + /* Offset of block within the array's address space */ + UINT64DECODE_VAR(p, sblock->block_off, hdr->arr_off_size); + /* Extensible array type */ if(*p++ != (uint8_t)hdr->cparam.cls->id) H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") @@ -1026,6 +1044,12 @@ H5EA__cache_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Version # */ *p++ = H5EA_SBLOCK_VERSION; + /* Address of array header for array which owns this block */ + H5F_addr_encode(f, &p, sblock->hdr->addr); + + /* Offset of block in array */ + UINT64ENCODE_VAR(p, sblock->block_off, sblock->hdr->arr_off_size); + /* Extensible array type */ *p++ = sblock->hdr->cparam.cls->id; @@ -1207,6 +1231,7 @@ H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const uint8_t *p; /* Pointer into raw data buffer */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ + haddr_t arr_addr; /* Address of array header in the file */ /* Sanity check */ HDassert(f); @@ -1248,6 +1273,14 @@ H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, if(*p++ != H5EA_DBLOCK_VERSION) H5E_THROW(H5E_VERSION, "wrong extensible array data block version") + /* Address of header for array that owns this block (just for file integrity checks) */ + H5F_addr_decode(f, &p, &arr_addr); + if(H5F_addr_ne(arr_addr, hdr->addr)) + H5E_THROW(H5E_BADVALUE, "wrong extensible array header address") + + /* Offset of block within the array's address space */ + UINT64DECODE_VAR(p, dblock->block_off, hdr->arr_off_size); + /* Extensible array type */ if(*p++ != (uint8_t)hdr->cparam.cls->id) H5E_THROW(H5E_BADTYPE, "incorrect extensible array class") @@ -1350,6 +1383,12 @@ H5EA__cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Version # */ *p++ = H5EA_DBLOCK_VERSION; + /* Address of array header for array which owns this block */ + H5F_addr_encode(f, &p, dblock->hdr->addr); + + /* Offset of block in array */ + UINT64ENCODE_VAR(p, dblock->block_off, dblock->hdr->arr_off_size); + /* Extensible array type */ *p++ = dblock->hdr->cparam.cls->id; |