mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 21:38:43 +00:00
I/O Manager fixes. Patch by Filip Navara.
svn path=/trunk/; revision=10506
This commit is contained in:
parent
78f66ec97c
commit
28ad49e6f7
3 changed files with 52 additions and 29 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: buildirp.c,v 1.42 2004/08/10 06:26:42 ion Exp $
|
/* $Id: buildirp.c,v 1.43 2004/08/12 16:43:11 ion Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -160,8 +160,6 @@ IoBuildAsynchronousFsdRequest(ULONG MajorFunction,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->UserIosb = IoStatusBlock;
|
|
||||||
|
|
||||||
return(Irp);
|
return(Irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: device.c,v 1.71 2004/06/23 21:42:49 ion Exp $
|
/* $Id: device.c,v 1.72 2004/08/12 16:43:12 ion Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -647,7 +647,8 @@ IoCreateDevice(
|
||||||
CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM ||
|
CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM ||
|
||||||
CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE)
|
CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE)
|
||||||
{
|
{
|
||||||
IoAttachVpb(CreatedDeviceObject);
|
IoAttachVpb(CreatedDeviceObject);
|
||||||
|
CreatedDeviceObject->SectorSize = 512; /* FIXME */
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceObjectExtension =
|
DeviceObjectExtension =
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: irp.c,v 1.63 2004/08/10 06:26:42 ion Exp $
|
/* $Id: irp.c,v 1.64 2004/08/12 16:43:12 ion Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -129,20 +129,24 @@ IoMakeAssociatedIrp(PIRP Irp,
|
||||||
* RETURNS: The irp allocated
|
* RETURNS: The irp allocated
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PIRP AssocIrp;
|
PIRP AssocIrp;
|
||||||
|
|
||||||
/* Allocate the IRP */
|
/* Allocate the IRP */
|
||||||
AssocIrp = IoAllocateIrp(StackSize,FALSE);
|
AssocIrp = IoAllocateIrp(StackSize,FALSE);
|
||||||
|
if (AssocIrp == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
/* Set the Flags */
|
/* Set the Flags */
|
||||||
AssocIrp->Flags |= IRP_ASSOCIATED_IRP;
|
AssocIrp->Flags |= IRP_ASSOCIATED_IRP;
|
||||||
|
|
||||||
/* Set the Thread */
|
/* Set the Thread */
|
||||||
AssocIrp->Tail.Overlay.Thread = Irp->Tail.Overlay.Thread;
|
AssocIrp->Tail.Overlay.Thread = Irp->Tail.Overlay.Thread;
|
||||||
|
|
||||||
/* Associate them */
|
/* Associate them */
|
||||||
AssocIrp->AssociatedIrp.MasterIrp = Irp;
|
AssocIrp->AssociatedIrp.MasterIrp = Irp;
|
||||||
return AssocIrp;
|
InterlockedIncrement(&Irp->AssociatedIrp.IrpCount);
|
||||||
|
|
||||||
|
return AssocIrp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -292,8 +296,8 @@ IofCompleteRequest(PIRP Irp,
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PDEVICE_OBJECT DeviceObject;
|
|
||||||
PFILE_OBJECT OriginalFileObject;
|
PFILE_OBJECT OriginalFileObject;
|
||||||
|
PDEVICE_OBJECT DeviceObject;
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
PMDL Mdl;
|
PMDL Mdl;
|
||||||
|
|
||||||
|
@ -309,6 +313,10 @@ IofCompleteRequest(PIRP Irp,
|
||||||
Irp->PendingReturned = TRUE;
|
Irp->PendingReturned = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Run the completion routines.
|
||||||
|
*/
|
||||||
|
|
||||||
for (i=Irp->CurrentLocation;i<(ULONG)Irp->StackCount;i++)
|
for (i=Irp->CurrentLocation;i<(ULONG)Irp->StackCount;i++)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -350,6 +358,27 @@ IofCompleteRequest(PIRP Irp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Windows NT File System Internals, page 165 */
|
||||||
|
if (Irp->Flags & IRP_ASSOCIATED_IRP)
|
||||||
|
{
|
||||||
|
ULONG MasterIrpCount;
|
||||||
|
PIRP MasterIrp = Irp->AssociatedIrp.MasterIrp;
|
||||||
|
|
||||||
|
MasterIrpCount = InterlockedDecrement(&MasterIrp->AssociatedIrp.IrpCount);
|
||||||
|
while ((Mdl = Irp->MdlAddress))
|
||||||
|
{
|
||||||
|
Irp->MdlAddress = Mdl->Next;
|
||||||
|
MmUnlockPages(Mdl);
|
||||||
|
IoFreeMdl(Mdl);
|
||||||
|
}
|
||||||
|
IoFreeIrp(Irp);
|
||||||
|
if (MasterIrpCount == 0)
|
||||||
|
{
|
||||||
|
IofCompleteRequest(MasterIrp, IO_NO_INCREMENT);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Were done calling completion routines. Now do any cleanup that can be
|
* Were done calling completion routines. Now do any cleanup that can be
|
||||||
* done in an arbitrarily context.
|
* done in an arbitrarily context.
|
||||||
|
@ -409,17 +438,14 @@ IofCompleteRequest(PIRP Irp,
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//Windows NT File System Internals, page 166/167
|
|
||||||
if (!(Irp->Flags & IRP_ASSOCIATED_IRP))
|
for (Mdl = Irp->MdlAddress; Mdl; Mdl = Mdl->Next)
|
||||||
{
|
{
|
||||||
for (Mdl = Irp->MdlAddress; Mdl; Mdl = Mdl->Next)
|
/*
|
||||||
{
|
* Undo the MmProbeAndLockPages. If MmGetSystemAddressForMdl was called
|
||||||
/*
|
* on this mdl, this mapping (if any) is also undone by MmUnlockPages.
|
||||||
* Undo the MmProbeAndLockPages. If MmGetSystemAddressForMdl was called
|
*/
|
||||||
* on this mdl, this mapping (if any) is also undone by MmUnlockPages.
|
MmUnlockPages(Mdl);
|
||||||
*/
|
|
||||||
MmUnlockPages(Irp->MdlAddress);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Windows NT File System Internals, page 154
|
//Windows NT File System Internals, page 154
|
||||||
|
@ -459,8 +485,6 @@ IofCompleteRequest(PIRP Irp,
|
||||||
KeLowerIrql(oldIrql);
|
KeLowerIrql(oldIrql);
|
||||||
DPRINT("Finished completition routine\n");
|
DPRINT("Finished completition routine\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue