FSTrim

Do we have FSTrim equivalent in Windows ? or a way to enforce it ?
I am working on driver for PCIe based SSD for windows server 2K12 R2.

Thanks

Trim is sent by the file system as blocks are deleted. A big Trim is also sent by the format utility after you newly format a volume.

I’m not aware of any way to do this. The Windows abstraction is specifically prohibited from user mode.

https://msdn.microsoft.com/en-us/library/windows/desktop/ee907416(v=vs.85).aspx

-scott
OSR
@OSRDrivers

Thanks Scott

You can force TRIM by using IOCTL_ATA_PASS_THROUGH_DIRECT :

https://www.osronline.com/showthread.cfm?link=242343
http://stackoverflow.com/questions/5070987/sending-ata-commands-directly-to-device-in-windows

Arshak

Oh, and it’s not a direct substitute for FStrim, as it will just unmap all blocks that you specify in your call, no matter if they are used by the file system or not.

Arshak

From the command line you can query TRIM on delete with:

c:\>fsutil behavior query DisableDeleteNotify

Zero indicates TRIM on delete is enabled. One indicates that it is not.

To enable:

fsutil behavior set DisableDeleteNotify 0

To disable:

fsutil behavior set DisableDeleteNotify 1

On Sat, Apr 30, 2016 at 1:05 PM wrote:

> Oh, and it’s not a direct substitute for FStrim, as it will just unmap all
> blocks that you specify in your call, no matter if they are used by the
> file system or not.
>
> Arshak
>
> —
> NTFSD is sponsored by OSR
>
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:>