[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] XenDisk: Report Discard support by issuing an Inquiry



On 24/02/2026 16:10, Owen Smith wrote:
>> From: Owen Smith <owen.smith@xxxxxxxxx>
>>
>> When XenDisk starts, issue an inquiry to determine the status of discard
>> support in the backend. If the backend exposes discard support, allow
>> XenDisk to respond to the appropriate property requests, and forward the
>> trim requests to XenVbd.
>>
>> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> 
> I might have missed something, but isn't this already done in xenvbd's
> TargetUnmap, and so xendisk shouldn't need to probe this by itself?
> 
> Also, at this point I wonder which other feature could we remove from
> xendisk and fold into xenvbd instead.
> 
> 
> 
> IIRC, storport didnt expose discard support correctly, and we needed
> xendisk to intercept discard requests and build the SRBs which pass
> through storport.
> This patch allows xendisk to query xenvbd's (and the backend's) support
> for discard, and skips parsing discard requests for a backend that doesnt
> support them.
> 
> Owen

I think this has already been fixed in Server 2012 [1]? xenvbd should be 
able to process IOCTLs directly via SRB_FUNCTION_IO_CONTROL instead of 
needing a filter driver. I don't know if it needs to implement 
IOCTL_STORAGE_QUERY_PROPERTY on top of reporting the right SCSI VPD 
page, but the storahci example doesn't seem to need it to support 
SCSIOP_UNMAP.

This patch also seems to have broken TRIM reporting since TargetUnmap is 
no longer reached, and `fsutil fsinfo sectorInfo` now reports "Trim Not 
Supported".
I think it's because if the initial TRIM probe fails, xendisk 
unconditionally forwards the StorageDeviceTrimProperty IRP down to 
xenvbd which doesn't know how to handle it, and then classpnp falls back 
to detecting LBProvisioningData.LBPU (which is also not supported) instead.
So xendisk still has to lie about StorageDeviceTrimProperty (as with the 
previous behavior) in order to keep the previous behavior of silently 
swallowing unsupported operations.
This is also important to keep advertising the disk as SSD and avoid 
automatic defragmentation (as Windows will assume the drive to be HDD 
and defrag anyway if TRIM is not supported)

[1] 
https://learn.microsoft.com/en-us/windows/compatibility/new-api-allows-apps-to-send-trim-and-unmap-hints



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.