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

Sparse files #9616

Open
essen opened this issue Mar 20, 2025 · 2 comments
Open

Sparse files #9616

essen opened this issue Mar 20, 2025 · 2 comments
Assignees
Labels
enhancement stalled waiting for input by the Erlang/OTP team team:VM Assigned to OTP team VM

Comments

@essen
Copy link
Contributor

essen commented Mar 20, 2025

Hello! I am looking into implementing more functionality out of fallocate, starting with the ability to punch holes (FALLOC_FL_PUNCH_HOLE) to deallocate space in the middle of files.

This is possible on Linux via fallocate, macOS via fcntl and Windows (NTFS) via DeviceIoControl. Not sure about others but I think it's a good enough start.

I could see inserting holes in files (FALLOC_FL_INSERT_RANGE) or collapsing files (FALLOC_FL_COLLAPSE_RANGE) as being potentially useful for RabbitMQ.

I am looking for pointers on what the interface should look like, as much of the work to implement this deals with file, prim_file and raw_file_* modules. Should I add a file:allocate/4 with an option list, or make a new function dedicated to creating/collapsing holes?

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Mar 21, 2025
@jhogberg jhogberg self-assigned this Mar 31, 2025
@jhogberg jhogberg added the stalled waiting for input by the Erlang/OTP team label Mar 31, 2025
@jhogberg
Copy link
Contributor

Thanks for raising this issue!

This is rather platform-specific, and the file module's convention of trying to be maximally compatible makes it difficult to support this in a nice way. I'm hoping to get around to refactoring file access in general some time in the future, with platform-specific things in platform-specific modules rather than trying to shoehorn it all into the same kind-of-sort-of portable module. I don't think we'd like to add this before then however.

@essen
Copy link
Contributor Author

essen commented Mar 31, 2025

Fair enough. I'll put this back to the bottom of the list for now then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement stalled waiting for input by the Erlang/OTP team team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

3 participants