summaryrefslogtreecommitdiffstats
path: root/src/H5FDprivate.h
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-02-26 22:24:42 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-02-26 22:24:42 (GMT)
commit4b70e13e14a9fa13696fbcf2d8a9bb329db90c57 (patch)
treebf8ee8734ff070738e66757a69ca8f5a4026bc37 /src/H5FDprivate.h
parentd859bc4ba7ff2336a5ef33d94a2ef617a202613b (diff)
downloadhdf5-4b70e13e14a9fa13696fbcf2d8a9bb329db90c57.zip
hdf5-4b70e13e14a9fa13696fbcf2d8a9bb329db90c57.tar.gz
hdf5-4b70e13e14a9fa13696fbcf2d8a9bb329db90c57.tar.bz2
Where n is the number of page-table/shadow-index entries, avoid spending O(n^2)
time in H5PB_dest(). While we're in H5PB_dest(), mark deleted shadow-index entries as "garbage" and skip the O(n) shadow index-entries copy. Rename shadow index-entry member `moved_to_hdf5_file` to `moved_to_lower_file` while I'm in here---NFCI.
Diffstat (limited to 'src/H5FDprivate.h')
-rw-r--r--src/H5FDprivate.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index d35ce3d..df49682 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -169,7 +169,8 @@ typedef struct H5FD_vfd_swmr_idx_entry_t {
hbool_t clean;
uint64_t tick_of_last_flush;
uint64_t delayed_flush;
- hbool_t moved_to_hdf5_file;
+ bool moved_to_lower_file;
+ bool garbage;
} H5FD_vfd_swmr_idx_entry_t;
/*
@@ -204,7 +205,7 @@ typedef struct H5FD_vfd_swmr_md_header {
static inline H5FD_vfd_swmr_idx_entry_t *
vfd_swmr_pageno_to_mdf_idx_entry(H5FD_vfd_swmr_idx_entry_t *idx,
- uint32_t nindices, uint64_t target_page)
+ uint32_t nindices, uint64_t target_page, bool reuse_garbage)
{
uint32_t top;
uint32_t bottom;
@@ -223,8 +224,8 @@ vfd_swmr_pageno_to_mdf_idx_entry(H5FD_vfd_swmr_idx_entry_t *idx,
bottom = probe + 1;
else if (idx[probe].hdf5_page_offset > target_page)
top = probe;
- else
- return &idx[probe]; /* found it */
+ else /* found it */
+ return (reuse_garbage || !idx[probe].garbage) ? &idx[probe] : NULL;
} while (bottom < top);
/* Previous interval was [top - 1, top] or [bottom, bottom + 1].
* The new interval is [top, top] or [bottom, bottom], respectively.