Improve spec. reading superblock into cache (a little) by using v2 size (#4491)

* Improve spec. reading superblock into cache (a little) by using v2 size

Instead of reading the absolute minimal possible, use the likely value of
a v2+ superblock w/8-byte addresses & lengths.
This commit is contained in:
Quincey Koziol
2024-05-17 08:30:30 -05:00
committed by GitHub
parent 510b728ebd
commit 74c7cdb2b7
3 changed files with 6 additions and 4 deletions
+4
View File
@@ -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)
*/
+1 -2
View File
@@ -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 */
+1 -2
View File
@@ -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() */