Comments (5)
Python seems to use GetFileInformationByHandle
to get a BY_HANDLE_FILE_INFORMATION
and uses its nFileSizeLow
and nFileSizeHigh
.
A simple dir
command will also show the incorrect size:
(.venv) H:\dev\openzfs>dir d:
Volume in drive D has no label.
Volume Serial Number is 609A-6821
Directory of D:\
08/10/2023 06:57 512 testfile.bin
1 File(s) 512 bytes
0 Dir(s) 10,717,904,896 bytes free
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.
from btrfs.
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
from btrfs.
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).
the file always shows the preallocated size
Do we know which size os.path.getsize
returns? There's three on Windows: allocation size, end of file, and valid data length.
from btrfs.
As a side comment, just wanted to mention it, the set_validdatalength() function:
https://github.com/maharmstone/btrfs/blob/master/src/fileinfo.c#L3754
The "<=" in
if (fvdli->ValidDataLength.QuadPart <= fcb->Header.ValidDataLength.QuadPart ...
and I could never get the call to succeed, even with your test.exe
and ifstest.exe
. Always fails.
Then I noticed:
https://github.com/microsoft/Windows-driver-samples/blob/main/filesys/fastfat/fileinfo.c#L4847
has a simple "<" instead. With that, the code will occasionally trigger the valid path with test.exe
and ifstest.exe
.
from btrfs.
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 --path <path to btrfs dir> --no_pool
so it doesn't try to create a zpool and uses the path as a test directory instead.
from btrfs.
Related Issues (20)
- Issues with ejecting and formatting under win 11
- Add installer for winget HOT 4
- unable to format
- gog & winbtrfs HOT 2
- COM error E_UNEXPECTED HOT 3
- How to use raid with veracrypt encrypted storage? HOT 1
- Very high disk access time spikes under heavy usage HOT 1
- [Question] How auto-mount work and can I block-list my Linux root FS? HOT 3
- Balancing with Data, Metadata, and System enabled causes CRC HOT 1
- [Question] is rw filesystem with Block Group Tree (added Linux v6.1) supported? HOT 2
- BTRFS cannot mount to Linux after mounting to Windows HOT 11
- [Documentation] Using a GUI for win-btrfs? HOT 1
- Partition contains no filesystem HOT 1
- Windows 11. Quiet driver crash. btrfs partition crashes. There is no access to the partition, Explorer takes forever to load. I/O error HOT 4
- Question on document HOT 1
- doc clarification on mappings HOT 3
- Directory listings appear to be unsorted HOT 5
- Cannot safely eject usb drive and getting BSOD if i do it not safe HOT 1
- Status of transaction log support HOT 3
- Launching games on drive with a BTRFS partition on Steam results in a "Missing Executable" or "Disk Write Error". HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btrfs.