Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow up on Scatter/Gather API changes #58447

Merged
merged 9 commits into from
Oct 14, 2021

Conversation

teo-tsirpanis
Copy link
Contributor

This PR addresses some feedback that was provided on #57424 after it was merged.

cc @stephentoub

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Aug 31, 2021
@ghost
Copy link

ghost commented Aug 31, 2021

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Issue Details

This PR addresses some feedback that was provided on #57424 after it was merged.

cc @stephentoub

Author: teo-tsirpanis
Assignees: -
Labels:

area-System.IO, community-contribution

Milestone: -

// Using segments with a length of twice the page size adheres to FILE_FLAG_NO_BUFFERING's
// requirements but not the scatter/gather APIs'. The RandomAccess implementation will
// see it and issue sequential read/write syscalls per segment, instead of one
// scatter/gather syscall. This test verifies that fallback behavior.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It verifies the fallback behavior when the length requirement isn't met but the others are, yes? What about when, say, the alignment requirement isn't met? Do we already have tests for that elsewhere?

@danmoseley danmoseley changed the title Address feedback of #57424 Follow up on Scatter/Gather API changes Sep 1, 2021
Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, but please add a test for a list of empty buffers.

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @teo-tsirpanis !

@teo-tsirpanis
Copy link
Contributor Author

@adamsitnik, @stephentoub, any additional feedback?

@adamsitnik adamsitnik merged commit 37d2514 into dotnet:main Oct 14, 2021
adamsitnik pushed a commit that referenced this pull request Oct 18, 2021
* Allocate an array of memory handles only if needed.

* Remove an unnecessary variable in the multiple-syscall write gather.

* Actually verify the content read by the read scatter operation.

* Delay allocating native memory.

* Verify that the whole file was read in the scatter/gather test.

* Test the case when the scatter/gather buffers are acceptable by the Windows API.

* Avoid null pointer dereferences when passing an empty segment array.

* Test performing scatter/gather I/O with an empty segment array.

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Anipik pushed a commit that referenced this pull request Oct 19, 2021
…s et. al. (#58423)

* Move checking and pinning Windows vectored I/O buffers to a dedicated method.

* Refactor the scatter/gather APIs to use the common checking method.

And use pinned GCHandles and IntPtrs instead of MemoryHandles when passing the segment array to the bottom-most method.

* Shorten the name of the buffer-checking method.

* Directly get the pinned array's address instead of calling GCHandle.AddrOfPinnedObject.

* Refactor the error handling logic in TryPrepareScatterGatherBuffers.

* Allocate the segment array from native memory and at TryPrepareScatterGatherBuffers.

* Cache the page size on a static readonly field and add a couple of TODOs.

* Make the memory handlers readonly structs.

* Add a test.

* Reorder some methods with PR feedback taken into consideration.

* Stop special-casing scatter/gather operations with zero or one buffer.

* Factor the cleaning-up of the segment buffers into a separate method.

* Follow up on Scatter/Gather API changes (#58447)

* Allocate an array of memory handles only if needed.

* Remove an unnecessary variable in the multiple-syscall write gather.

* Actually verify the content read by the read scatter operation.

* Delay allocating native memory.

* Verify that the whole file was read in the scatter/gather test.

* Test the case when the scatter/gather buffers are acceptable by the Windows API.

* Avoid null pointer dereferences when passing an empty segment array.

* Test performing scatter/gather I/O with an empty segment array.

Co-authored-by: Stephen Toub <stoub@microsoft.com>

Co-authored-by: Theodore Tsirpanis <teo.tsirpanis.718@gmail.com>
Co-authored-by: Theodore Tsirpanis <12659251+teo-tsirpanis@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
@ghost ghost locked as resolved and limited conversation to collaborators Nov 13, 2021
@teo-tsirpanis teo-tsirpanis deleted the pr-57424-feedback branch December 9, 2021 13:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants