Repository navigation
kernels: every block move moves the dirty and syncing counters by its phase change - #155
Merged
Merged
Conversation
… phase change (Verus); the WAL tail replay no longer leaves the syncing counter high Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… with the old counter bookkeeping) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P.volume.glidefs-block-counters-equal-the-block-phases is proven by
recountat the open only. After the open the counters moved by hand-written fetch_add/fetch_sub at eight sites; a detach reads them to decide drained (detach_kernel::drained_spec), andflush_kernel::thm_a_reported_detach_leaves_a_volume_that_reads_what_was_writtentakescounts_matchas a premise.block_counters::move_delta(from, to): each counter moves by the change in "is in that phase" (Verus ensures), andlemma_a_block_move_keeps_the_counters_equal: from counters equal to the numbers of DIRTY and SYNCING blocks, the moved counters equal the numbers after the move, any block count.CacheInner::count_move(from, to)calls it; the seven CAS sites in inner.rs and the WAL tail replay in flush.rs now call it instead of their own fetch_add/fetch_sub.replay_wal_tail(flush.rs) added 1 to the dirty counter for a block it moved SYNCING -> DIRTY and never took 1 off syncing, so the syncing counter stayed above the phases and a detach could never read drained.mut_move_forgets_syncing: Verus red atblock_counters::move_deltaensures (kernels/src/block_counters.rs:214, 134 verified, 1 error); default build 135 verified, 0 errors.every_move_of_a_block_keeps_the_counters_equal_the_phases(write, claim, write over a claimed block, requeue, covered eviction, refused eviction against a scan of the state map) passes; the restart count tests still pass.Not tested: the replay_wal_tail SYNCING arm has no dedicated test (it needs a successor reading a WAL tail over a claimed block); it is covered by the kernel's ensures.
🤖 Generated with Claude Code