Skip to content

DiskFileSystem: run write effects on a spawned task#94140

Open
sokra wants to merge 1 commit into
canaryfrom
sokra/parallel-write
Open

DiskFileSystem: run write effects on a spawned task#94140
sokra wants to merge 1 commit into
canaryfrom
sokra/parallel-write

Conversation

@sokra
Copy link
Copy Markdown
Member

@sokra sokra commented May 27, 2026

What?

Make DiskFileSystem write and symlink effects run on their own spawned tasks, so multiple pending writes can execute in parallel rather than serially on the caller's future.

Why?

Effects emitted by DiskFileSystem::write and write_link were previously applied inline within the caller's future. That meant the work for each effect ran sequentially in the awaiting task — writes did not overlap even though each one is largely I/O bound (path validation, lock acquisition, file write, fsync).

How?

  • WriteEffect and WriteLinkEffect now derive Clone and own their data so they can be moved into a spawned task. full_path becomes Arc<PathBuf> to keep cloning cheap.
  • apply_inner takes self by value instead of &self.
  • apply() now calls spawn(self.clone().apply_inner()) so the effect body runs on a dedicated turbo-tasks task. Multiple effects awaited concurrently will execute in parallel.

Closes NEXT-
Fixes #

Spawn the write/symlink effect bodies so they run on a dedicated task
rather than inline in the caller's future. The effect struct now owns
its data (Clone + Arc<PathBuf>) and apply_inner takes self by value,
allowing the work to be moved into the spawned task.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

Tests Passed

Commit: 56a95a6

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

Stats skipped

Commit: 56a95a6
View workflow run

@sokra sokra marked this pull request as ready for review May 27, 2026 01:12
@sokra sokra requested a review from mischnic May 27, 2026 01:12
@mischnic mischnic requested a review from bgw May 27, 2026 05:53
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