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

Proposal: Add Temporary and Sparse and to FileOptions #65155

Closed
msedi opened this issue Feb 10, 2022 Discussed in #65067 · 7 comments
Closed

Proposal: Add Temporary and Sparse and to FileOptions #65155

msedi opened this issue Feb 10, 2022 Discussed in #65067 · 7 comments
Labels
area-System.IO needs-author-action An issue or pull request that requires more info or actions from the author. no-recent-activity

Comments

@msedi
Copy link

msedi commented Feb 10, 2022

Discussed in #65067

Originally posted by msedi February 9, 2022
From the WinAPI (https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea) I can see that there is a FILE_ATTRIBUTE_TEMPORARY flag when creating a file which seems to be very useful in my case.

The question in general is, does FILE_ATTRIBUTE_TEMPORARY have an effect? I assume some other flags its only a hint to the file manager. I can also understand that this is not available on other platforms, but if it can be seen as a hint only (windows), it could also be seen as such in other platforms.

Additionally the sparsity of a file could tremendously help to improve performance for large files. Currently there are two possibilities SetFileValidData or DeviceIoControl that allow to create sparse files.

Another solution might be

try
{                    
  File.SetAttributes(fileName, File.GetAttributes(fileName) | FileAttributes.Temporary);
}
catch
{
}

but this looks a bit clumsy.

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.IO untriaged New issue has not been triaged by the area owner labels Feb 10, 2022
@ghost
Copy link

ghost commented Feb 10, 2022

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

Issue Details

Discussed in #65067

Originally posted by msedi February 9, 2022
From the WinAPI (https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea) I can see that there is a FILE_ATTRIBUTE_TEMPORARY flag when creating a file which seems to be very useful in my case.

The question in general is, does FILE_ATTRIBUTE_TEMPORARY have an effect? I assume some other flags its only a hint to the file manager. I can also understand that this is not available on other platforms, but if it can be seen as a hint only (windows), it could also be seen as such in other platforms. Additoinally the sparsity of a file could tremendously help to improve performance for large files. Currently there are two possibilities SetFileValidData or DeviceIoControl that allow to create sparse files.

Another solution might be

try
{                    
  File.SetAttributes(fileName, File.GetAttributes(fileName) | FileAttributes.Temporary);
}
catch
{
}

but this looks a bit clumsy.

Author: msedi
Assignees: -
Labels:

area-System.IO, untriaged

Milestone: -

@danmoseley
Copy link
Member

@msedi we have a particular format for API proposals like this one. Could you please update your top post to match the API proposal format, per this template
https://github.com/dotnet/runtime/issues/new?assignees=&labels=api-suggestion&template=02_api_proposal.yml&title=%5BAPI+Proposal%5D%3A+

Or simply close this and use that template to open a new one.

@adamsitnik
Copy link
Member

@msedi it would be great if you could also provide some more information about why you need these features: example scenario that is impossible to implement as of today and some benchmark numbers for spare files

@adamsitnik adamsitnik added needs-author-action An issue or pull request that requires more info or actions from the author. and removed untriaged New issue has not been triaged by the area owner labels Feb 11, 2022
@ghost
Copy link

ghost commented Feb 11, 2022

This issue has been marked needs-author-action since it may be missing important information. Please refer to our contribution guidelines for tips on how to report issues effectively.

@adamsitnik
Copy link
Member

@ghost ghost added the no-recent-activity label Feb 25, 2022
@ghost
Copy link

ghost commented Feb 25, 2022

This issue has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

@ghost
Copy link

ghost commented Mar 11, 2022

This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

@ghost ghost closed this as completed Mar 11, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 10, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.IO needs-author-action An issue or pull request that requires more info or actions from the author. no-recent-activity
Projects
None yet
Development

No branches or pull requests

3 participants