Skip to content

feat(fuse): add max_readahead_kb config; fix clippy::field_reassign_with_default - #927

Closed
bigbigxu with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-failing-github-actions-job
Closed

feat(fuse): add max_readahead_kb config; fix clippy::field_reassign_with_default#927
bigbigxu with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-failing-github-actions-job

Conversation

Copilot AI commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

The CI "build" job was failing at the clippy step because newly introduced tests used post-construction field assignment on a Default::default() instance, triggering clippy::field_reassign_with_default (denied as warning).

Root cause

// Before — clippy error
let mut conf = FuseConf::default();
conf.max_readahead_kb = Some(0);  // error: field assignment outside of initializer
// After — correct form
let mut conf = FuseConf { max_readahead_kb: Some(0), ..Default::default() };

Changes

curvine-common/src/conf/fuse_conf.rs

  • Add max_readahead_kb: Option<u32> field with doc comment (sysfs path corrected to read_ahead_kb)
  • Reject Some(0) in init() — value must be positive when set
  • Fix test initialization to use struct literal syntax

curvine-fuse/src/session/bdi.rs (new)

  • Linux-only helper that resolves the FUSE mount's BDI device via /proc/self/mountinfo and writes kb to /sys/class/bdi/<maj>:<min>/read_ahead_kb
  • Retries up to BDI_RETRY_COUNT × BDI_RETRY_DELAY_MS ms for the sysfs entry to appear post-mount; all failures are best-effort (log + continue)
  • No-op stub for non-Linux targets

curvine-fuse/src/fs/curvine_file_system.rs

  • During FUSE init, raise max_readahead to max(negotiated, max_readahead_kb * 1024) so the kernel cap doesn't silently shrink reads

curvine-fuse/src/session/fuse_session.rs

  • After mount setup, call bdi::apply_max_readahead_kb for each mount point when the option is set

etc/curvine-cluster.toml

  • Document the new # max_readahead_kb = 1024 option under [fuse]

Copilot AI added 2 commits June 23, 2026 02:06
…th_default

Add fuse.max_readahead_kb config option that:
- Writes the Linux BDI sysfs read_ahead_kb entry after mount
- Raises the FUSE init max_readahead to match

Fix clippy::field_reassign_with_default errors in tests by using
struct literal initialization syntax instead of post-construction
field assignment.
- Fix doc: sysfs path is read_ahead_kb not max_readahead_kb
- Extract BDI_RETRY_COUNT/BDI_RETRY_DELAY_MS constants
- Add edge-case tests: not-found, empty, malformed lines, multiple entries
Copilot AI changed the title [WIP] Fix failing GitHub Actions job build feat(fuse): add max_readahead_kb config; fix clippy::field_reassign_with_default Jun 23, 2026
Copilot AI requested a review from bigbigxu June 23, 2026 02:11
@lzjqsdd

lzjqsdd commented Jun 23, 2026

Copy link
Copy Markdown
Member

@copilot fix merge conflicts

@lzjqsdd lzjqsdd closed this Jun 23, 2026
Copilot AI requested a review from lzjqsdd June 23, 2026 02:21
Copilot stopped work on behalf of lzjqsdd due to an error June 23, 2026 02:21
@lzjqsdd
lzjqsdd deleted the copilot/fix-failing-github-actions-job branch June 24, 2026 02:40
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.

3 participants