From - Tue Sep 16 08:02:35 1997 Path: news.mitre.org!blanket.mitre.org!agate!newsgate.duke.edu!nntprelay.mathworks.com!newsfeed.internetmci.com!207.126.101.73!Supernews73!supernews.com!Supernews69!not-for-mail From: Andy Neville Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode Subject: NT I/O Throttling Date: Mon, 15 Sep 1997 17:09:35 -0700 Organization: All USENET -- http://www.Supernews.com Lines: 48 Message-ID: <341DCE3F.550FD9FB@europa.com> Reply-To: andyn@europacom. NNTP-Posting-Host: 22956@206.103.54.61 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.03 [en] (WinNT; U) I've got a device driver that redirects file I/O intended for a virtual drive (e.g., Z:) to a file (e.g., C:\Test.dat). Originally when using ZwWriteFile to write data to the file, if I copied a huge block of data NT would write a little bit then hang. In a previous posting, Jonathan Goldick described this situation as NT I/O throttling - when the write cache gets full, NT prevents "normal" writes from occurring so that the memory manager can write out its cache - the problem being that it blocks my writes, therefore deadlocking the file system. Instead of using ZwWriteFile, I tried creating my own IRP and setting the IRP_NOCACHE flag, but that didn't work any differently than ZwWriteFile. I noticed that the IRPs my driver gets also have the IRP_PAGING_IO and IRP_SYNCHRONOUS_PAGING_IO flags set, and when I set all three in the IRP I send, everything appears to work, but the data never really gets written out. Can anyone give me a hint about what I'm doing wrong? I'm using ObReferenceObjectByHandle() after ZwCreateFile to get the FileObject, IoGetRelatedDeviceObject() to get the FSD DeviceObject, and setting pIrp->UserBuffer equal to my 64k NonPagedPool buffer. I even copy the flags and control members from my stack to the new one. The rest is: pIrp->MdlAddress=NULL; pIrp->AssociatedIrp.SystemBuffer=NULL; pIrp->UserEvent=&event; pIrp->UserIosb=&IoStatusBlock; pIrp->Tail.Overlay.Thread=PsGetCurrentThread(); pIrp->Tail.Overlay.OriginalFileObject=pfoDeviceFile; pIrp->RequestorMode=KernelMode; pIrp->Flags=IRP_NOCACHE | IRP_PAGING_IO | IRP_SYNCHRONOUS_PAGING_IO; pioStackLocation=IoGetNextIrpStackLocation(pWriteIrp); pioStackLocation->MajorFunction=IRP_MJ_WRITE; pioStackLocation->MinorFunction=0; pioStackLocation->Flags=pIrpSp->Flags; pioStackLocation->Control=pIrpSp->Control; pioStackLocation->DeviceObject=pFsdDevice; pioStackLocation->FileObject=pfoDeviceFile; ioStackLocation->Parameters.Write.Length=pIrpSp->Parameters.Write.Length; ioStackLocation->Parameters.Write.ByteOffset=pIrpSp->Parameters.Write.ByteOffset; IoSetCompletionRoutine(pIrp, DoCompletion, 0, TRUE, TRUE, TRUE); Thanks for any help you might be able to spare! Andy Neville andyn@europacom. (please move the dot before the "com" when replying)