Skip to content

bcachefs: reconcile target placement tests#91

Closed
zorbathut wants to merge 1 commit into
koverstreet:masterfrom
zorbathut:fix/reconcileloop
Closed

bcachefs: reconcile target placement tests#91
zorbathut wants to merge 1 commit into
koverstreet:masterfrom
zorbathut:fix/reconcileloop

Conversation

@zorbathut

@zorbathut zorbathut commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Three tests for reconcile converging to best-possible placement on targets that can't satisfy the replication goal, parking the remainder on the pending list and going idle rather than rewriting forever:

  • reconcile_metadata_target_undersized: metadata_replicas=3 with metadata_target pointing at a single ssd is unsatisfiable by construction; ends with exactly one replica of every btree node on the ssd, the rest parked.
  • reconcile_data_target_undersized: the same shape at the data level (data_replicas=3, single-ssd background_target).
  • reconcile_data_target_overfull: a target too small for even one replica fills to the watermark and parks the rest; adding a second target device kicks the pending scan and every extent gets a replica on the new device.

Reconcile isn't yet woken when interior updates re-queue work asynchronously, so on a quiet fs 'bcachefs reconcile wait' can stall with actionable work queued; the tests instead drive reconcile with explicit wakeup kicks and poll the work accounting (reconcile_settle()).

Code to make tests work lives in koverstreet/bcachefs-tools#768.

Three tests for reconcile converging to best-possible placement on
targets that can't satisfy the replication goal, parking the remainder
on the pending list and going idle rather than rewriting forever:

- reconcile_metadata_target_undersized: metadata_replicas=3 with
  metadata_target pointing at a single ssd is unsatisfiable by
  construction; ends with exactly one replica of every btree node on
  the ssd, the rest parked.
- reconcile_data_target_undersized: the same shape at the data level
  (data_replicas=3, single-ssd background_target).
- reconcile_data_target_overfull: a target too small for even one
  replica fills to the watermark and parks the rest.

The overfull test's device-add coda (parked work resumes onto a fresh
target device) is disabled for now: the device-add pending scan races
freespace init on the new device, and nothing re-kicks the scan when a
device becomes allocatable. Re-enable once that kick exists.

Reconcile isn't yet woken when interior updates re-queue work
asynchronously, so on a quiet fs 'bcachefs reconcile wait' can stall
with actionable work queued; the tests instead drive reconcile with
explicit wakeup kicks and poll the work accounting (reconcile_settle(),
which dumps reconcile status and counters on timeout).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@zorbathut zorbathut force-pushed the fix/reconcileloop branch from 17cb4dc to 1137c69 Compare July 5, 2026 21:09
@koverstreet

Copy link
Copy Markdown
Owner

this is merged

@koverstreet koverstreet closed this Jul 6, 2026
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.

2 participants