summaryrefslogtreecommitdiffstats
path: root/src/H5Ocache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-03-04 04:28:09 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-03-04 04:28:09 (GMT)
commit44f312b183305cf37295595bfd3f5df40fc637be (patch)
tree4d2fe91e2e756fc157d99047a10ea2ce2e755b2f /src/H5Ocache.c
parentcaa6d5dabc47494efd9930c2c1f043e357347328 (diff)
downloadhdf5-44f312b183305cf37295595bfd3f5df40fc637be.zip
hdf5-44f312b183305cf37295595bfd3f5df40fc637be.tar.gz
hdf5-44f312b183305cf37295595bfd3f5df40fc637be.tar.bz2
[svn-r13449] Description:
Add object creation property (H5P[s|g]et_obj_track_times) to disable storing timestamps on objects, which makes the object's header size smaller. Also, added object header status flags to H5O_info_t struct (for H5Oget_info/H5Oget_info_by_idx) and cleaned up other field names in the struct as well. Tested on: FreeBSD/32 6.2 (duty) Mac OS X/32 10.4.8 (amazon)
Diffstat (limited to 'src/H5Ocache.c')
-rw-r--r--src/H5Ocache.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 194ebf4..48e3a6d 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -43,7 +43,9 @@
/****************/
/* Set the object header size to speculatively read in */
-/* (needs to be more than the default dataset header size) */
+/* (needs to be more than the object header prefix size to work at all and
+ * should be larger than the default dataset object header to save the
+ * extra I/O operations) */
#define H5O_SPEC_READ_SIZE 512
@@ -281,6 +283,9 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
if(H5O_VERSION_1 != oh->version)
HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "bad object header version number")
+ /* Flags */
+ oh->flags = H5O_CRT_OHDR_FLAGS_DEF;
+
/* Reserved */
p++;
} /* end else */
@@ -294,10 +299,14 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
/* Version-specific fields */
if(oh->version > H5O_VERSION_1) {
/* Time fields */
- UINT32DECODE(p, oh->atime);
- UINT32DECODE(p, oh->mtime);
- UINT32DECODE(p, oh->ctime);
- UINT32DECODE(p, oh->btime);
+ if(oh->flags & H5O_HDR_STORE_TIMES) {
+ UINT32DECODE(p, oh->atime);
+ UINT32DECODE(p, oh->mtime);
+ UINT32DECODE(p, oh->ctime);
+ UINT32DECODE(p, oh->btime);
+ } /* end if */
+ else
+ oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
/* Attribute fields */
UINT16DECODE(p, oh->max_compact);
@@ -331,6 +340,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
/* Determine object header prefix length */
prefix_size = (size_t)(p - read_buf);
+ HDassert((size_t)prefix_size == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
/* Compute first chunk address */
chunk_addr = addr + (hsize_t)prefix_size;
@@ -385,6 +395,10 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
HDmemcpy(oh->chunk[0].image, read_buf, prefix_size);
/* Read the chunk raw data */
+ /* (probably re-reads some data we already retrieved, but since
+ * we have to do the I/O operation anyway, we might as
+ * well avoid memcpy()ing the data in our buffer already)
+ */
if(H5F_block_read(f, H5FD_MEM_OHDR, chunk_addr, (oh->chunk[0].size - prefix_size),
dxpl_id, (oh->chunk[0].image + prefix_size)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header data")
@@ -634,10 +648,12 @@ H5O_assert(oh);
UINT32ENCODE(p, oh->nlink);
/* Time fields */
- UINT32ENCODE(p, oh->atime);
- UINT32ENCODE(p, oh->mtime);
- UINT32ENCODE(p, oh->ctime);
- UINT32ENCODE(p, oh->btime);
+ if(oh->flags & H5O_HDR_STORE_TIMES) {
+ UINT32ENCODE(p, oh->atime);
+ UINT32ENCODE(p, oh->mtime);
+ UINT32ENCODE(p, oh->ctime);
+ UINT32ENCODE(p, oh->btime);
+ } /* end if */
/* Attribute fields */
UINT16ENCODE(p, oh->max_compact);