From 492df7a33ca592cfd24a4ec31cda12b887df3241 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 6 Mar 2007 13:54:24 -0500 Subject: [svn-r13470] Description: Avoid storing the phase change values for attribute storage, unless they are non-default values. Tested on: Mac OS X/32 10.4.8 (amazon) --- src/H5O.c | 2 ++ src/H5Ocache.c | 18 +++++++++++++----- src/H5Opkg.h | 16 +++++++++++++--- src/H5Opublic.h | 3 ++- src/H5Pocpl.c | 2 -- tools/testfiles/h5mkgrp_nested_latest.ls | 4 ++-- tools/testfiles/h5mkgrp_nested_mult_latest.ls | 8 ++++---- tools/testfiles/h5mkgrp_several_latest.ls | 4 ++-- tools/testfiles/h5mkgrp_single_latest.ls | 2 +- 9 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/H5O.c b/src/H5O.c index 52610cf..48ee26e 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -686,6 +686,8 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id, oh->corder_bt2_addr = HADDR_UNDEF; /* Check for non-default attribute storage phase change values */ + if(oh->max_compact != H5O_CRT_ATTR_MAX_COMPACT_DEF || oh->min_dense != H5O_CRT_ATTR_MIN_DENSE_DEF) + oh->flags |= H5O_HDR_ATTR_STORE_PHASE_CHANGE; } /* end if */ else { /* Flags */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 7d096d5..c4430e6 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -49,7 +49,7 @@ #define H5O_SPEC_READ_SIZE 512 /* All the object header status flags that this version of the library knows about */ -#define H5O_HDR_ALL_FLAGS (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_STORE_TIMES) +#define H5O_HDR_ALL_FLAGS (H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | H5O_HDR_ATTR_STORE_PHASE_CHANGE | H5O_HDR_STORE_TIMES) /******************/ @@ -314,8 +314,14 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, oh->atime = oh->mtime = oh->ctime = oh->btime = 0; /* Attribute fields */ - UINT16DECODE(p, oh->max_compact); - UINT16DECODE(p, oh->min_dense); + if(oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) { + UINT16DECODE(p, oh->max_compact); + UINT16DECODE(p, oh->min_dense); + } /* end if */ + else { + oh->max_compact = H5O_CRT_ATTR_MAX_COMPACT_DEF; + oh->min_dense = H5O_CRT_ATTR_MIN_DENSE_DEF; + } /* end else */ H5F_DECODE_LENGTH(f, p, oh->nattrs); H5F_addr_decode(f, &p, &(oh->attr_fheap_addr)); H5F_addr_decode(f, &p, &(oh->name_bt2_addr)); @@ -661,8 +667,10 @@ H5O_assert(oh); } /* end if */ /* Attribute fields */ - UINT16ENCODE(p, oh->max_compact); - UINT16ENCODE(p, oh->min_dense); + if(oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) { + UINT16ENCODE(p, oh->max_compact); + UINT16ENCODE(p, oh->min_dense); + } /* end if */ H5F_ENCODE_LENGTH(f, p, oh->nattrs); H5F_addr_encode(f, &p, oh->attr_fheap_addr); H5F_addr_encode(f, &p, oh->name_bt2_addr); diff --git a/src/H5Opkg.h b/src/H5Opkg.h index d8a6fd2..e3626fe 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -78,7 +78,15 @@ /* Size of checksum (on disk) */ #define H5O_SIZEOF_CHKSUM 4 -/* Default value for object header status flags */ +/* ========= Object Creation properties ============ */ +/* Default values for some of the object creation properties */ +/* NOTE: The H5O_CRT_ATTR_MAX_COMPACT_DEF & H5O_CRT_ATTR_MIN_DENSE_DEF values + * are "built into" the file format, make certain existing files with + * default attribute phase change storage are handled correctly if they + * are changed. + */ +#define H5O_CRT_ATTR_MAX_COMPACT_DEF 8 +#define H5O_CRT_ATTR_MIN_DENSE_DEF 6 #define H5O_CRT_OHDR_FLAGS_DEF H5O_HDR_STORE_TIMES /* @@ -104,8 +112,10 @@ 4 + /*change time */ \ 4 /*birth time */ \ ) : 0) + \ - 2 + /*max compact attributes */ \ - 2 + /*min dense attributes */ \ + (((O)->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) ? ( \ + 2 + /*max compact attributes */ \ + 2 /*min dense attributes */ \ + ) : 0) + \ (O)->sizeof_size + /*# of attributes */ \ (O)->sizeof_addr + /*addr of attribute heap */ \ (O)->sizeof_addr + /*addr of attribute name index */ \ diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 0e64a93..73c4581 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -63,7 +63,8 @@ /* Object header status flag definitions */ #define H5O_HDR_ATTR_CRT_ORDER_TRACKED 0x01 /* Attribute creation order is tracked */ #define H5O_HDR_ATTR_CRT_ORDER_INDEXED 0x02 /* Attribute creation order has index */ -#define H5O_HDR_STORE_TIMES 0x04 /* Store access, modification, change & birth times for object */ +#define H5O_HDR_ATTR_STORE_PHASE_CHANGE 0x04 /* Non-default attribute storage phase change values stored */ +#define H5O_HDR_STORE_TIMES 0x08 /* Store access, modification, change & birth times for object */ /* Maximum shared message values. Number of indexes is 8 to allow room to add * new types of messages. diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 974a6a0..726e41d 100755 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -48,10 +48,8 @@ /* ========= Object Creation properties ============ */ /* Definitions for the max. # of attributes to store compactly */ #define H5O_CRT_ATTR_MAX_COMPACT_SIZE sizeof(unsigned) -#define H5O_CRT_ATTR_MAX_COMPACT_DEF 8 /* Definitions for the min. # of attributes to store densely */ #define H5O_CRT_ATTR_MIN_DENSE_SIZE sizeof(unsigned) -#define H5O_CRT_ATTR_MIN_DENSE_DEF 6 /* Definitions for object header flags */ #define H5O_CRT_OHDR_FLAGS_SIZE sizeof(uint8_t) diff --git a/tools/testfiles/h5mkgrp_nested_latest.ls b/tools/testfiles/h5mkgrp_nested_latest.ls index 60343a6..4764a8d 100644 --- a/tools/testfiles/h5mkgrp_nested_latest.ls +++ b/tools/testfiles/h5mkgrp_nested_latest.ls @@ -3,10 +3,10 @@ Expected output for 'h5ls ../testfiles/h5mkgrp_nested_latest.h5' ############################# Opened "../testfiles/h5mkgrp_nested_latest.h5" with sec2 driver. /one Group - Location: 1:564 + Location: 1:556 Links: 1 Modified: XXXX-XX-XX XX:XX:XX XXX /one/two Group - Location: 1:306 + Location: 1:302 Links: 1 Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_nested_mult_latest.ls b/tools/testfiles/h5mkgrp_nested_mult_latest.ls index 2844afa..ad3f640 100644 --- a/tools/testfiles/h5mkgrp_nested_mult_latest.ls +++ b/tools/testfiles/h5mkgrp_nested_mult_latest.ls @@ -3,18 +3,18 @@ Expected output for 'h5ls ../testfiles/h5mkgrp_nested_mult_latest.h5' ############################# Opened "../testfiles/h5mkgrp_nested_mult_latest.h5" with sec2 driver. /one Group - Location: 1:564 + Location: 1:556 Links: 1 Modified: XXXX-XX-XX XX:XX:XX XXX /one/two Group - Location: 1:306 + Location: 1:302 Links: 1 Modified: XXXX-XX-XX XX:XX:XX XXX /three Group - Location: 1:1080 + Location: 1:1064 Links: 1 Modified: XXXX-XX-XX XX:XX:XX XXX /three/four Group - Location: 1:822 + Location: 1:810 Links: 1 Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_several_latest.ls b/tools/testfiles/h5mkgrp_several_latest.ls index 6d0b3cc..13f945c 100644 --- a/tools/testfiles/h5mkgrp_several_latest.ls +++ b/tools/testfiles/h5mkgrp_several_latest.ls @@ -3,10 +3,10 @@ Expected output for 'h5ls ../testfiles/h5mkgrp_several_latest.h5' ############################# Opened "../testfiles/h5mkgrp_several_latest.h5" with sec2 driver. /one Group - Location: 1:306 + Location: 1:302 Links: 1 Modified: XXXX-XX-XX XX:XX:XX XXX /two Group - Location: 1:564 + Location: 1:556 Links: 1 Modified: XXXX-XX-XX XX:XX:XX XXX diff --git a/tools/testfiles/h5mkgrp_single_latest.ls b/tools/testfiles/h5mkgrp_single_latest.ls index 27d5686..cad8052 100644 --- a/tools/testfiles/h5mkgrp_single_latest.ls +++ b/tools/testfiles/h5mkgrp_single_latest.ls @@ -3,6 +3,6 @@ Expected output for 'h5ls ../testfiles/h5mkgrp_single_latest.h5' ############################# Opened "../testfiles/h5mkgrp_single_latest.h5" with sec2 driver. /latest Group - Location: 1:306 + Location: 1:302 Links: 1 Modified: XXXX-XX-XX XX:XX:XX XXX -- cgit v0.12