Repository navigation
Fix Storage Spaces detection - #19
Conversation
The member serial was read from a fixed offset (0xBFC), but disk information strings are packed, NUL-terminated UTF-16 text whose positions depend on the lengths of the strings before them. On a pool with SATA members the serial is at 0xBD4, so no member was matched. Serials are now located through the offset table in the response: 0xA44 (trimmed serial, reported for NVMe) is tried first, then 0xA3C (serial). Serials are no longer limited to 16 characters.
SpIoctlGetSpaceInfo returns one 0x90-byte extent record per slab, so a large space does not fit in the 64 KB buffer (a 20 TB space needs about 17.8 MB). The driver fails with ERROR_MORE_DATA and the space was discarded, along with its repair progress. The fixed fields are complete in the truncated response, so they are now parsed and the space is kept. Its extent list is left unavailable (ExtentInformationAvailable is false) rather than reporting a partial one.
With two or three of four disks removed from a two-way mirror pool, both status DWORDs read 1 while Windows reports the pool as Unhealthy / Read-only. This pair was reported as Unknown.
Pool health does not reflect a degraded space: after a lost disk returns, the pool reads Healthy while its spaces stay Degraded until the repair runs. The space information header carries the space's own state: health at 0xA34 (3 Healthy, 2 Warning, 1 Unhealthy) and, from 0xA38, a zero-terminated array of operational status codes in the same order as WMI's OperationalStatus (7 OK, 5 InService, 4 Incomplete, 3 Degraded, 1 Detached). Checked against WMI across healthy, degraded, suspended repair, repairing and detached states.
|
Thanks, I will review and test as soon as possible (perhaps later today). Could you please state the exact version of spaceport driver on your system aswell ? Edit: feel free to add your follow-up aswell so I don't have to test twice. |
|
Tested on two different spaceport.sys builds:
Note that the version string resource in both files still says 10.0.26100.5074, so Explorer and The response layouts were identical on both (pool info 0xB10, disk info 0xC30, space info 0xBD8). One more thing I noticed while testing: The pool information response has a variable-length tail after the fixed 0xB10-byte structure. 0xA54 holds the offset of a list of disk GUIDs (0xB10), and 0xA50 is the number of GUIDs in that list. A security descriptor follows, with its length at 0xA5C and its offset at 0xA60.
My best guess is that these are the disks holding a copy of the pool metadata, which Storage Spaces caps on larger pools, but I haven't found a way to confirm that. Either way, the "number of configured members" is only right on small pools. In case it's useful: the list keeps a disk's GUID while that disk is disconnected, even though 0xE70404 drops it. Querying that GUID with 0xE70408 still succeeds, with a short response in which the disk number at 0x28 is 0xFFFFFFFF. That's a way to tell a lost member, at least for disks that are in the list. I'll add the space health follow-up to this PR as well. |
|
I've only updated the doc comments to say "pool or space". It's probably better if we renamed it to a neutral name like |
FootprintOnPoolBytes (0xA78) is the sum of the space's data extents. Windows' FootprintOnPool also counts the write-back cache and journal, so it is higher by a fixed amount per space: 512 MiB for a two-way mirror without a write-back cache, 2,560 MiB for a single-parity space with a 1 GiB write-back cache. The pool's allocated bytes match Windows exactly.
|
I've just tested it with my small test setup and it looks good so far.
I will simply remove this property then. Also have a few more changes. I'll push them after merging. |
|
See 39a9d5e |
Follow-up to as discussed on LibreHardwareMonitor#2541.
On a 7-disk pool (20 TB thin two-way mirror, created in 2013),
GetStoragePoolsfound the pool but matched no members and returned no spaces. Three fixes:Fix Storage Spaces member serial lookup. Disk information strings are packed, NUL-terminated UTF-16, so the serial's position depends on the length of the strings before it. With SATA members (vendor "ATA") the serial is at 0xBD4, not 0xBFC. The response has an offset table (0xA30 vendor, 0xA34 product, 0xA38 firmware, 0xA3C serial, 0xA40 raw serial, 0xA44 trimmed serial on NVMe, 0xA7C location, 0xA80 PnP ID), so serials are now read through it: 0xA44 first, then 0xA3C. Serials are no longer capped at 16 characters.
Keep large Storage Spaces when space information does not fit. SpIoctlGetSpaceInfo returns one 0x90-byte extent record per slab, so a 20 TB space needs about 17.8 MB and the 64 KB buffer fails with
ERROR_MORE_DATA. The fixed fields are complete in the truncated response, so the space is now kept withExtentInformationAvailable = false, rather than being dropped or reading ~18 MB on every call.Map Storage Spaces pool status 1/1 to Unhealthy. With two or three of four disks removed from a two-way mirror, both status DWORDs read 1 while Windows reports the pool as Unhealthy / Read-only.
Testing
I have a follow-up ready that adds space health and operational status (read from the space information header, verified against WMI), since a space can stay Degraded while the pool reports Healthy. I'll open that separately once this is in.