Skip to content

kernels: every block move moves the dirty and syncing counters by its phase change - #155

Merged
jaredLunde merged 2 commits into
mainfrom
bd/counter-deltas
Nov 29, 2026
Merged

jaredLunde merged 2 commits into
mainfrom
bd/counter-deltas

Conversation

@jaredLunde

Copy link
Copy Markdown
Contributor

P.volume.glidefs-block-counters-equal-the-block-phases is proven by recount at 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), and flush_kernel::thm_a_reported_detach_leaves_a_volume_that_reads_what_was_written takes counts_match as a premise.

  • block_counters::move_delta(from, to): each counter moves by the change in "is in that phase" (Verus ensures), and lemma_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.
  • Finding fixed: 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.
  • Mutant mut_move_forgets_syncing: Verus red at block_counters::move_delta ensures (kernels/src/block_counters.rs:214, 134 verified, 1 error); default build 135 verified, 0 errors.
  • Test 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

jaredLunde and others added 2 commits November 29, 2026 09:09
… 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>
@jaredLunde
jaredLunde merged commit cc5305c into main Nov 29, 2026
26 checks passed
@jaredLunde
jaredLunde deleted the bd/counter-deltas branch November 29, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant