DiskFileSystem: run write effects on a spawned task#94140
Open
sokra wants to merge 1 commit into
Open
Conversation
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.
Contributor
Tests PassedCommit: 56a95a6 |
Contributor
Stats skippedCommit: 56a95a6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Make
DiskFileSystemwrite 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::writeandwrite_linkwere 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?
WriteEffectandWriteLinkEffectnow deriveCloneand own their data so they can be moved into a spawned task.full_pathbecomesArc<PathBuf>to keep cloning cheap.apply_innertakesselfby value instead of&self.apply()now callsspawn(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 #