Skip to content

device: let online resize delegate shrink to kernel#650

Closed
Komzpa wants to merge 1 commit into
koverstreet:testingfrom
Komzpa:komzpa/online-shrink-kernel-delegation
Closed

device: let online resize delegate shrink to kernel#650
Komzpa wants to merge 1 commit into
koverstreet:testingfrom
Komzpa:komzpa/online-shrink-kernel-delegation

Conversation

@Komzpa

@Komzpa Komzpa commented Jun 28, 2026

Copy link
Copy Markdown

This removes the tools-side online shrink precheck from bcachefs device resize so mounted filesystems can delegate smaller target sizes to the kernel resize ioctl.

That keeps current kernels honest: if shrink is unsupported, the ioctl still fails, now with shrink-specific context from the CLI.
The offline path still rejects shrinking because the bundled userspace/libbcachefs implementation has not gained the shrink machinery yet.

This is an independent tools-side delegation patch that matches the CLI boundary discussed around koverstreet/bcachefs#1070; it does not import or flatten the older shrink implementation branch. The full tools-targeted shrink stack is carried separately in #742 with original Jul Lang / Codex commits preserved where practical and Komzpa tools adaptations split at the tail.

Related to #268, koverstreet/bcachefs#781, koverstreet/bcachefs#1070, and koverstreet/bcachefs#1073.
Does not claim full filesystem shrinking support by itself.

Validation:

  • BINDGEN=/home/kom/.cargo/bin/bindgen make -j32
  • BINDGEN=/home/kom/.cargo/bin/bindgen cargo check -q
  • git diff --check
  • ./target/release/bcachefs device resize --help
  • GitHub CI is passing for head 81ee809c6d8922a04c0e5d2cebbb19f7950ad47e

@koverstreet

Copy link
Copy Markdown
Owner

Cherry-picked to the testing branch as device: let online resize delegate shrink to kernel (2263343), authorship preserved. Thanks — right layering: the kernel is the authority on whether shrink is supported, so the online path should delegate rather than hardcode a userspace precheck. That also fixes the older-tool/newer-kernel case, where the hardcoded gate would wrongly block a shrink the loaded module supports, and uses the kernel's authoritative bucket count instead of the tool's cached usage. Verified the offline path keeps its own independent shrink guard (resize_offline still bails), and the kernel rejects online shrink before any mutation ('Cannot shrink yet'), so there's no data risk in the interim. Merging via cherry-pick rather than the merge button, so closing manually.

@koverstreet koverstreet closed this Jul 2, 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