summaryrefslogtreecommitdiffstats
path: root/src/H5Ocache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-03-11 23:15:03 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-03-11 23:15:03 (GMT)
commite6b818134e24b1d4d99a612218e0a50ffa08bd28 (patch)
tree1f1e5b6b3bd58d92e395762ccfec6ffde5eaee0a /src/H5Ocache.c
parent0b3cccd0cb2521ef77077d677581d2d3342cdc6f (diff)
downloadhdf5-e6b818134e24b1d4d99a612218e0a50ffa08bd28.zip
hdf5-e6b818134e24b1d4d99a612218e0a50ffa08bd28.tar.gz
hdf5-e6b818134e24b1d4d99a612218e0a50ffa08bd28.tar.bz2
[svn-r13497] Description:
Move ref. count of # of links to an object out of the object header's prefix and make it a header message instead (since it's a "rare" occurence), eliminating some more space for each object in the file. Inserting this "ref. count" message exposed a flaw in the library's mechanism for locating a message to promote to another chunk and replace with a continuation message, which required some additional work to fix. It's still not completely robust, but it's working for more cases now and detects failures robustly. Reduced the minimum size of an object header chunk to just enough to contain a header message prefix and continuation message. Tested on: FreeBSD/32 6.2 (duty)
Diffstat (limited to 'src/H5Ocache.c')
-rw-r--r--src/H5Ocache.c61
1 files changed, 36 insertions, 25 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 142d23f..2a76526 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -44,8 +44,8 @@
/* Set the object header size to speculatively read in */
/* (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) */
+ * should be larger than the largest object type's default object header
+ * size to save the extra I/O operations) */
#define H5O_SPEC_READ_SIZE 512
@@ -283,28 +283,10 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
/* Number of messages (to allocate initially) */
nmesgs = 1;
- } /* end if */
- else {
- /* Version */
- oh->version = *p++;
- 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++;
-
- /* Number of messages */
- UINT16DECODE(p, nmesgs);
- } /* end else */
- /* Link count */
- UINT32DECODE(p, oh->nlink);
+ /* Number of links to object (unless overridden by refcount message) */
+ oh->nlink = 1;
- /* Version-specific fields */
- if(oh->version > H5O_VERSION_1) {
/* Time fields */
if(oh->flags & H5O_HDR_STORE_TIMES) {
UINT32DECODE(p, oh->atime);
@@ -348,6 +330,23 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
} /* end switch */
} /* end if */
else {
+ /* Version */
+ oh->version = *p++;
+ 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++;
+
+ /* Number of messages */
+ UINT16DECODE(p, nmesgs);
+
+ /* Link count */
+ UINT32DECODE(p, oh->nlink);
+
/* Reset unused time fields */
oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
@@ -592,6 +591,21 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
chunk_addr = cont->addr;
chunk_size = cont->size;
} /* end if */
+ /* Check if next message to examine is a ref. count message */
+ else if(H5O_REFCOUNT_ID == oh->mesg[curmesg].type->id) {
+ H5O_refcount_t *refcount;
+
+ /* Decode ref. count message */
+ HDassert(oh->version > H5O_VERSION_1);
+ refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(f, dxpl_id, 0, oh->mesg[curmesg].raw);
+
+ /* Save 'native' form of ref. count message */
+ oh->mesg[curmesg].native = refcount;
+
+ /* Set object header values */
+ oh->has_refcount_msg = TRUE;
+ oh->nlink = *refcount;
+ } /* end if */
} /* end for */
} /* end while */
@@ -681,9 +695,6 @@ H5O_assert(oh);
/* Flags */
*p++ = oh->flags;
- /* Link count */
- UINT32ENCODE(p, oh->nlink);
-
/* Time fields */
if(oh->flags & H5O_HDR_STORE_TIMES) {
UINT32ENCODE(p, oh->atime);