How does the defragmentation API work? Is there anything special that a filter driver must do to handle it correctly?
The defragmentation API is a mechanism that was introduced in Windows NT 4.0 to allow application programs to defragment files on the local disks. Perhaps the best source of information about how defragmentation works in Windows 2000 is the Platform SDK, which describes the use of FSCTL_GET_VOLUME_BITMAP, FSCTL_GET_RETRIEVAL_POINTERS, and FSCTL_MOVE_FILE. These three operations are used to defragment a given file. In addition, the IFS Kit includes the FAT file system source code and its implementation of defragmentation. A file system filter driver will typically not be concerned about the defragmentation API because it is implemented internally within the file system. Under certain circumstances a filter may need to be aware the that physical location of a file has changed, such as might be the case for a SAN file system filter driver that uses these APIs to track the logical storage locations for one (or more) files.