Skip to content

Commit

Permalink
Improve spec. reading superblock into cache (a little) by using v2 size
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
qkoziol committed May 15, 2024
1 parent 6203a44 commit 3dce0d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/H5Fpkg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand Down
3 changes: 1 addition & 2 deletions src/H5Fsuper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
3 changes: 1 addition & 2 deletions src/H5Fsuper_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() */
Expand Down

0 comments on commit 3dce0d7

Please sign in to comment.