-
Notifications
You must be signed in to change notification settings - Fork 220
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
Incorrect size when doing preallocation #597
Comments
Python's not very useful here, as you have to dig deep to know what it's actually doing. It'd be better for there to be a C or C++ program using ntdll calls (not kernel32).
Do we know which size |
Python seems to use A simple
It should show 117 here with the test program. Rclone is a good tool to test this too, it always preallocates files with multiple of the volumes cluster size: But when it writes less than that it errors later because it expects the created file to be the size of actually written data after close. |
Is there a userspace API to get all 3 sizes? I'd like to get all 3 in my test and compare them to NTFS & ReFS. Edit: seems like there is no userspace way to get the valid data length, see https://stackoverflow.com/questions/35572871/how-to-get-valid-data-length-of-a-file |
As a side comment, just wanted to mention it, the set_validdatalength() function: https://github.com/maharmstone/btrfs/blob/master/src/fileinfo.c#L3754 Then I noticed: |
FYI the test I added in openzfsonwindows/openzfs#284 also works on other filesystems, I tested on NTFS, ReFS, FAT32, ZFS and SMB. It doesn't have dependencies other than Python. You can just call it with |
I encountered an issue with OpenZFS on Windows which also seems to exist here. When doing a preallocation (
SetFileInformationByHandle
withFileAllocationInfo
) the file always shows the preallocated size. On NTFS, ReFS and a Samba share the file shows 0 bytes after preallocation, 0 bytes after the write and the written size after file close.See openzfsonwindows/openzfs#281
There is also a Python test program for this issue, it just needs 2 files.
The text was updated successfully, but these errors were encountered: