summaryrefslogtreecommitdiffstats
path: root/src/H5Opkg.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-10-16 23:04:45 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-10-16 23:04:45 (GMT)
commitf7a8a14bfd9d2c103c5d9be8adb578bec4a1b015 (patch)
tree3b12aa39cdfee48069d551657e476b4d61a1b2b3 /src/H5Opkg.h
parenta504b0dcc3c3223331bde6b36ff3a04300788768 (diff)
downloadhdf5-f7a8a14bfd9d2c103c5d9be8adb578bec4a1b015.zip
hdf5-f7a8a14bfd9d2c103c5d9be8adb578bec4a1b015.tar.gz
hdf5-f7a8a14bfd9d2c103c5d9be8adb578bec4a1b015.tar.bz2
[svn-r12770] Description:
Overhaul usage of object header chunks to reduce I/O operations and memory allocations. The object header prefix is now stored in the first object header chunk's "image" in memory. Also, lots of formatting cleanups. Taught h5debug tool about new object header format (which isn't enabled just yet). Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Opkg.h')
-rw-r--r--src/H5Opkg.h67
1 files changed, 41 insertions, 26 deletions
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 49a0cf9..4886153 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -48,13 +48,9 @@
* object header chunks directly into memory and operate on them there, even
* on 64-bit architectures. This allows us to reduce the number of disk I/O
* requests with a minimum amount of mem-to-mem copies.
+ *
+ * Note: We no longer attempt to do this. - QAK, 10/16/06
*/
-/*
- * Note: We no longer attempt to do this.
- */
-#ifdef OLD_WAY
-#define H5O_ALIGN(X) (8 * (((X) + 7) / 8))
-#else /* OLD_WAY */
#define H5O_ALIGN_OLD(X) (8 * (((X) + 7) / 8))
#define H5O_ALIGN_VERS(V, X) \
(((V) == H5O_VERSION_1) ? \
@@ -66,19 +62,20 @@
H5O_ALIGN_VERS((O)->version, X)
#define H5O_ALIGN_F(F, X) \
H5O_ALIGN_VERS((H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), X)
-#endif /* OLD_WAY */
+
+/* Size of signature information (on disk) */
+#define H5O_SIZEOF_MAGIC 4
+
+/* Object header signatures */
+#define H5O_HDR_MAGIC "OHDR" /* Header */
+#define H5O_CHK_MAGIC "OCHK" /* Continuation chunk */
+
+/* Size of checksum (on disk) */
+#define H5O_SIZEOF_CHKSUM 4
/*
* Size of object header prefix.
*/
-#ifdef OLD_WAY
-#define H5O_SIZEOF_HDR(F) \
- H5O_ALIGN(1 + /*version number */ \
- 1 + /*reserved */ \
- 2 + /*number of messages */ \
- 4 + /*reference count */ \
- 4) /*header data size */
-#else /* OLD_WAY */
#define H5O_SIZEOF_HDR_VERS(V) \
(((V) == H5O_VERSION_1) ? \
H5O_ALIGN_OLD(1 + /*version number */ \
@@ -87,28 +84,21 @@
4 + /*reference count */ \
4) /*header data size */ \
: \
- (4 + /*magic number */ \
+ (H5O_SIZEOF_MAGIC + /*magic number */ \
1 + /*version number */ \
2 + /*number of messages */ \
4 + /*reference count */ \
- 4) /*header data size */ \
+ 4 + /*header data size */ \
+ H5O_SIZEOF_CHKSUM) /*checksum size */ \
)
#define H5O_SIZEOF_HDR_OH(O) \
H5O_SIZEOF_HDR_VERS((O)->version)
#define H5O_SIZEOF_HDR_F(F) \
H5O_SIZEOF_HDR_VERS(H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1)
-#endif /* OLD_WAY */
/*
* Size of object header message prefix
*/
-#ifdef OLD_WAY
-#define H5O_SIZEOF_MSGHDR(F) \
- H5O_ALIGN(2 + /*message type */ \
- 2 + /*sizeof message data */ \
- 1 + /*flags */ \
- 3) /*reserved */
-#else /* OLD_WAY */
#define H5O_SIZEOF_MSGHDR_VERS(V) \
(((V) == H5O_VERSION_1) ? \
H5O_ALIGN_OLD(2 + /*message type */ \
@@ -123,7 +113,32 @@
H5O_SIZEOF_MSGHDR_VERS((O)->version)
#define H5O_SIZEOF_MSGHDR_F(F) \
H5O_SIZEOF_MSGHDR_VERS(H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1)
-#endif /* OLD_WAY */
+
+/*
+ * Size of chunk "header" for each chunk
+ */
+#define H5O_SIZEOF_CHKHDR_VERS(V) \
+ (((V) == H5O_VERSION_1) ? \
+ 0 + /*no magic # */ \
+ 0 /*no checksum */ \
+ : \
+ H5O_SIZEOF_MAGIC + /*magic # */ \
+ H5O_SIZEOF_CHKSUM /*checksum */ \
+ )
+#define H5O_SIZEOF_CHKHDR_OH(O) \
+ H5O_SIZEOF_CHKHDR_VERS((O)->version)
+
+/*
+ * Size of checksum for each chunk
+ */
+#define H5O_SIZEOF_CHKSUM_VERS(V) \
+ (((V) == H5O_VERSION_1) ? \
+ 0 /*no checksum */ \
+ : \
+ H5O_SIZEOF_CHKSUM /*checksum */ \
+ )
+#define H5O_SIZEOF_CHKSUM_OH(O) \
+ H5O_SIZEOF_CHKSUM_VERS((O)->version)
struct H5O_msg_class_t {
unsigned id; /*message type ID on disk */