From 3dce0d77f039dc0dcf465636392efc086c30bcc0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 15 May 2024 11:53:55 -0500 Subject: [PATCH 1/2] 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. Signed-off-by: Quincey Koziol --- src/H5Fpkg.h | 5 +++++ src/H5Fsuper.c | 3 +-- src/H5Fsuper_cache.c | 3 +-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7e12ff111d0..1a9ace0ceaf 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -131,6 +131,11 @@ (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 6eb465ed9d1..f58bb153f34 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() */ From de64d91001760847c2e99f0a366806e5735989eb Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 15 May 2024 16:57:26 +0000 Subject: [PATCH 2/2] Committing clang-format changes --- src/H5Fpkg.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 1a9ace0ceaf..06d13ebffdd 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -133,8 +133,7 @@ /* 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)) +#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)