Re: [ntfsd] About win7 background defragmentation
Hi, im not sure we use almost right solution, we also returning ACCESS_DENIED on all MJ_CREATE IRP
s pointed to our file as soon as our driver loaded,
but when system runs our thread in lsass.exe (that is existing all the time while system working) we (from userspace) temprory unlock our-special-defrag-protected file, opening it and sending to it DeviceIoControl FSCTL_MARK_HANDLE with MARK_HANDLE_PROTECT_CLUSTERS option.
MarkInfo.UsnSourceInfo = USN_SOURCE_AUXILIARY_DATA;
MarkInfo.VolumeHandle = hVolume;
MarkInfo.HandleInfo = MARK_HANDLE_PROTECT_CLUSTERS;
rez = DeviceIoControl(hFile,FSCTL_MARK_HANDLE,&MarkInfo,sizeof(MarkInfo),0,0,&dwRet,0);
http://msdn.microsoft.com/en-us/library/aa364576(VS.85).aspx
So “The file is marked as undefragmentable until the handle is closed.”, and of cource we forget to close this handle and someway forget about it. (Our process is lsass, so cleanup of unclosed handles never happens while working), and after that we continue blocking all IRPs at driver level.
Im not sure it
s the perfect solution, but for us it`s working and at least for half year testing no problems with moving our file happen.
|
|
Hi guys. I have several files which should not be defragmented by windows. I simply deny all IRP_MJ_CREATE to these files because AFAIK file must be opened before it is defragmented, but sometimes their sector position on disk still changes in Win7.
Can this be caused by win7 background defragmentation? How can I prevent windows and other programs from moving my files?
Regards
Haibo
—
NTFSD is sponsored by OSR
For our schedule of debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
|