summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Record the state of a log outlet on first use and reuse that state onDavid Young2020-02-122-5/+16
| | | | | | | subsequent hlog_fast() calls. While I'm here, add a typedef, hlog_outlet_t, for struct hlog_outlet, and use it.
* Whitespace repair. NFCI.David Young2020-02-121-2/+2
|
* Make a typedef for enum hlog_outlet_state, hlog_outlet_state_t, and use it.David Young2020-02-122-3/+4
| | | | NFCI.
* Don't declare a bunch of undefined log outlets.David Young2020-02-121-6/+0
|
* Call them log "outlets" not log "sinks".David Young2020-02-104-84/+84
|
* Rename loglib_ / LOGLIB_ to hlog_ / HLOG_, remove the syslog-basedDavid Young2020-02-105-292/+260
| | | | | | | implementation, rename hlog_log() to hlog(), hlog_vlog() to vhlog(), et cetera. Rename hlog_lazy() to hlog_fast(). Define some log sinks and use them in the page buffer and in VFD SWMR.
* Rename log.c to hlog.c, add hlog.[ch] to MANIFEST.David Young2020-02-071-0/+0
|
* Add my logging library in existing form. Abbreviate copyright notices in theDavid Young2020-02-062-0/+496
| | | | sources but put the full notices & license terms in COPYING.
* In a comment, mention that reclamation of shadow indices is postponed forDavid Young2020-02-061-1/+6
| | | | longer than it needs to be. NFCI.
* Extract a routine from shadow_image_defer_free(), shadow_range_defer_free(),David Young2020-02-062-11/+22
| | | | | that works in byte offsets rather than page offsets. Use shadow_range_defer_free() to defer shadow-index frees.
* Avoid going back and forth between signed and unsigned in the same expressionDavid Young2020-02-061-1/+1
| | | | | with some casts and an unsigned constant. This quiets GCC warnings, especially -Wconversion, IIRC.
* Fix a typo in a comment and delete whitespace at EOL.David Young2020-02-061-1/+1
|
* Use an early exit to lower a staircase.David Young2020-02-061-132/+130
|
* Reduce code duplication by using vfd_swmr_pageno_to_mdf_idx_entry() to look upDavid Young2020-02-061-98/+61
| | | | | | | | | | | | | shadow pages. Reduce casts by choosing correct format strings and compatible variable types. Poison writes to addr by making it const. Don't increase addr in the read(2) loop because it's never used afterward. Delete some more dead code. Rename read_ptr as p and declare it much closer to its use. Change its type to `char *` so that no casts are necessary to increase it.
* Delete unused code.David Young2020-02-061-36/+0
|
* Delete the hdf5_page_offset member of shadow_defree_t, it is initialized butDavid Young2020-02-062-2/+0
| | | | never read.
* Fix a typo in a diagnostic printf and, while I'm here, use the right formatDavid Young2020-02-061-6/+6
| | | | strings.
* Use proper format string.David Young2020-02-061-2/+4
|
* Make H5FD_vfd_swmr_dump_status() take an unsigned page number to be consistentDavid Young2020-02-062-3/+3
| | | | with other code.
* Rename the deferred-free queues. There are two of them, and the names I usedDavid Young2020-02-065-50/+51
| | | | | | | | | | | | | | for them did not help me keep track of what they were for. For brevity, I will call a deferred free record a "defree" in the code. The deferred_free_queue_t becomes a lower_defree_queue_t, and each record on the queue becomes a lower_defree_t. A lower_defree_t tracks one deferred free on the lower VFD---that is, the one under the SWMR VFD. The old_image_queue_t becomes a shadow_defree_queue_t, and a record therein is a shadow_defree_t. A shadow_defree_t tracks one deferred free on the shadow file.
* Move the bsdqueue.h #inclusion up with the other #inclusions.David Young2020-02-061-2/+3
|
* NFCI: exit(EXIT_FAILURE) instead of exit(1) for portability.David Young2020-02-031-2/+2
| | | | Delete a comment on a closing curly brace.
* It's not necessary to assert(p != NULL) if you're dereferencing p in the nextDavid Young2020-02-031-1/+0
| | | | assertion.
* Numerous changes supporting a floating shadow index:David Young2020-02-037-73/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | Add to the H5F_shared_t (!) a new member that tells the index in the shadow file where the index should be written. Allocate shadow filespace for the header and the index separately so that the index can float. Update tests to match the expected original location of the index. Introduce vfd_swmr_enlarge_shadow_index(), a routine that allocates space in the shadow file for a new index that has (up to) twice as many entries as the old index, allocates a new in-core index of the same size, and copies the old in-core index to the new. Call vfd_swmr_enlarge_shadow_index() in H5PB_vfd_swmr__update_index() when the in-core index has too few slots. In the comment at the top of H5FD__vfd_swmr_load_hdr_and_idx(), describe the protocol that it follows, now, when it reads the shadow header and index. Delete some dead code in the function and add a bit of diagnostic code. TBD quiet the diagnostic code. In H5F_vfd_swmr_init(), follow the protocol: write the index, first, then the header. Modify property-list checks and tests to reserve no fewer than two pages at the front of the shadow file for the header and index.
* Make the first argument to H5PB_vfd_swmr__update_index() and H5F_t instead ofDavid Young2020-02-033-3/+4
| | | | | an H5F_shared_t because the new routine that will relocate the index (which will be in a future commit) has to pass an H5F_t to the filespace allocator.
* Consolidate shadow-file allocation code in H5MV.c.David Young2020-01-307-198/+189
|
* Remove some dead code and out-of-date comments.David Young2020-01-301-18/+0
|
* Fix typo. NFCI.David Young2020-01-301-1/+1
|
* Use fewer gratuitous casts. Use struct assignment instead of member-by-memberDavid Young2020-01-281-5/+4
| | | | assignment to copy `struct timespec`. NFCI.
* Fix spelling. NFCI.David Young2020-01-271-1/+1
|
* Prepare the VFD SWMR reader for a "floating" shadow index by overhaulingDavid Young2020-01-242-220/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the way that the shadow header and shadow index are loaded. In H5FD__vfd_swmr_load_hdr_and_idx(), adopt a new protocol for reading the shadow file: 0 If the maximum number of retries have been attempted, then exit with an error. 1 Try to read the shadow file *header*. If successful, continue to 2. If there is a hard failure, then return an error. If there is a failure that may be transient, then sleep and retry at 0. 2 If the tick number in the header is less than the tick last read by the VFD, then return an error. 3 If the tick number in the header is equal to the last tick read by the VFD, then exit without doing anything. 4 Try to read the shadow file *index*. If successful, continue to 5. If there is a hard failure, then return an error. If there is a failure that may be transient, then sleep and retry at 0. 5 If a different tick number was read from the index than from the index, then continue at 0. 6 Try to *re-read* the shadow file *header*. If successful, continue to 7. If there is a hard failure, then return an error. If there is a failure that may be transient, then sleep and retry at 0. 7 Compare the header that was read previously with the new header. If the new header is different than the old, then we may not have read the index at the right shadow-file offset, or the index may have been read in an inconsistent state, so sleep and retry at 0. Otherwise, return success. Simplify H5FD__vfd_swmr_header_deserialize() and H5FD__vfd_swmr_index_deserialize(). Remove their retry loops. Make each return TRUE on success, FALSE on an error that may be transient, and FAIL on an irrecoverable error. In H5FD__vfd_swmr_header_deserialize(), do not check the size of the shadow file with fstat(2), since the read(2) will fail if the file is too small. This saves us a system call. Lightly consti-ify H5FD__vfd_swmr_index_deserialize() arguments. In H5FD__vfd_swmr_load_hdr_and_idx(): Consolidate all of the retry-looping. Increase the initial retry delay from 1ns to 1/10s. Delete the disused maximum-retry constants. Use #if 0 to disable some error-checking code that ought to be unnecessary under the new protocol. Don't memset() the header and index header, but make sure they're fully initialized with real content, instead.
* Change md_pages_reserved and pb_expansion_threshold parameters to uint32_t fromDavid Young2020-01-162-3/+3
| | | | int32_t.
* Prepare a bit to let the shadow index "float": drasticallyDavid Young2020-01-101-53/+83
| | | | | | | | | | | | | | simplify H5FD__vfd_swmr_index_deserialize(): reuse h5_retry_init()/h5_retry_next() for retry loops. Don't wait for the fstat(2) to read the correct size, because the read(2) will return short if the file isn't long enough. (This change should save at least one system call, always.) Leave a bunch of comments about the changes that I will have to make so that the shadow index will float. NFCI: do not cast H5MM_malloc() return values, this is not C++.
* Now that we're buffering the removed pages to process at once,David Young2020-01-101-23/+19
| | | | | | | it's not necessary to iterate over pass numbers any more, so just use two loops. While I'm in here, change a comment or formatting here and there.
* H5F_vfd_swmr_reader_end_of_tick(),David Young2020-01-101-133/+98
| | | | | | | | | | | | | | | | | compares both new and old shadow indices and calls H5PB_remove_entry() on each entry that was in the old index but is not in the new. Ever since H5PB_remove_entry() started removing shadow index entries, it has been possible for H5F_vfd_swmr_reader_end_of_tick() to walk past the end of the new shadow index or even to skip entries in the new index. Sometimes an assertion failed when that happened. I have restructured the code in H5F_vfd_swmr_reader_end_of_tick() so that it compares the old and new indices, gathering a list of removed pages, in one step. In the next step, it processes the list of removed pages, calling H5PB_remove_entry() on each page. In the step after that, it notifies the metadata cache of each removed page. This fixes the bug I described, above.
* Simplify nested logic in H5FD_vfd_swmr_get_tick_and_idx().David Young2020-01-101-9/+12
| | | | | assert() our expectation that either a NULL index was passed, or a pointer to the index length was passed in, too.
* Correct some irregular indentation, delete an unused line, split anDavid Young2020-01-101-12/+10
| | | | | | | `if ((p = allocate(...)) == NULL) { }` into two statements, `p = allocate(...); if (p == NULL) { }`, put a semicolon at the end of an HGOTO_ERROR(), remove comments /* end if */, /* end for */ after closing curly braces.
* Make H5FD__vfd_swmr_load_hdr_and_idx() simpler and faster: copy aDavid Young2020-01-101-56/+30
| | | | | | pointer to the metadata index instead of copying the index itself. Use struct assignment instead of copying individual struct members. Lower a staircase.
* After quick-sorting the index, go ahead and assert that there are notDavid Young2020-01-101-5/+2
| | | | | | duplicate entries for the same HDF5 page offset. There's an O(n) cost to that, but it should be no more than the O(n log n) cost of the quicksort.
* In H5F__vfd_swmr_writer__create_index(), use calloc(3) instead ofDavid Young2020-01-101-18/+1
| | | | malloc(3) and a for-loop that zeroes the index.
* In H5PB_remove_entry(), do not call vfd_swmr_mdf_idx_entry_remove(),David Young2020-01-101-29/+24
| | | | | because the H5PB__evict_entry() call should have already done that. Instead, just assert() that the index entry is not present.
* In vfd_swmr_mdf_idx_entry_remove(), give some local variables less wordyDavid Young2020-01-101-14/+12
| | | | | | names. While I am here, do not copy the last element of the index over the element that's being deleted, because in the very next step I'm shifting all elements over by one.
* Straggler from previous: provide uint64_decode().David Young2020-01-101-0/+14
|
* Clean up the code a bit: remove some unnecessary casts and such. NFCI.David Young2020-01-101-4/+4
|
* Change the blah_blah_blah_md_header `index_length` member fromDavid Young2020-01-103-3/+13
| | | | | | | | `uint64_t` to `size_t` because it describes the size of an in-core structure as well as an on-disk one, and `size_t` is wide enough to store the size of any in-core structure, while `uint64_t` may be much too wide. Check that `index_length` is no more than SIZE_MAX after we read it.
* Delete unused constants.David Young2020-01-101-2/+0
|
* Be brief, replace `(H5FS_section_info_t *)node` with `&node->sect_info`.David Young2020-01-101-7/+7
|
* Provide a convenience constant, H5_RETRY_ONE_SECOND.David Young2020-01-101-1/+2
|
* Don't cast a malloc(3), this is C. Put curly braces around a multiline `if`David Young2019-12-201-5/+5
| | | | statement. Delete an unnecessary backslash line continuation. NFCI.
* Assert that a shadow image is page-aligned since we assume that it is when weDavid Young2019-12-201-0/+2
| | | | compute its base address and free it.