diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7e12ff111d0..06d13ebffdd 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -131,6 +131,10 @@ (H5F_SUPERBLOCK_FIXED_SIZE + \ H5F_SUPERBLOCK_VARLEN_SIZE((s)->super_vers, (s)->sizeof_addr, (s)->sizeof_size)) +/* Optimistic read size for superblock */ +/* Size of a v2+ superblock, w/8-byte addresses & lengths */ +#define H5F_SUPERBLOCK_SPEC_READ_SIZE (H5F_SUPERBLOCK_FIXED_SIZE + H5F_SUPERBLOCK_VARLEN_SIZE(2, 8, 8)) + /* For superblock version 0 & 1: Offset to the file consistency flags (status_flags) in the superblock (excluding H5F_SUPERBLOCK_FIXED_SIZE) */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index a4940d8b85b..5a32fc0ce68 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -416,8 +416,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, bool initial_read) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "can't get property list"); /* Make certain we can read the fixed-size portion of the superblock */ - if (H5F__set_eoa(f, H5FD_MEM_SUPER, - (haddr_t)(H5F_SUPERBLOCK_FIXED_SIZE + H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE)) < 0) + if (H5F__set_eoa(f, H5FD_MEM_SUPER, (haddr_t)H5F_SUPERBLOCK_SPEC_READ_SIZE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "set end of space allocation request failed"); /* Set up the user data for cache callbacks */ diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 9c475ab26a2..2a425099b47 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -306,8 +306,7 @@ H5F__cache_superblock_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t assert(image_len); /* Set the initial image length size */ - *image_len = H5F_SUPERBLOCK_FIXED_SIZE + /* Fixed size of superblock */ - H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE; + *image_len = H5F_SUPERBLOCK_SPEC_READ_SIZE; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5F__cache_superblock_get_initial_load_size() */