I develop Virtual Volume Manager on Windows Server 2008 R2.
I implemented IRP_MJ_READ major function like this :
MyCompletion (pDeviceObject, irp, context) {
if (irp->MdlAddress != NULL) {
…
IoFreeMdl();
irp->MdlAddress = NULL;
}
FreeIrp();
free(context);
IoCompleteRequest(irp);
return STATUS_MORE_PROCESSING_REQUIRED;
}
DispatchRead (pDeviceObjext, irp) {
malloc(context);
pBuffer = MmGetSystemAddressForMdlSafe(irp->MdlAddress, );
newIrp = IoAllocateIrp(target_dev->StackSize, );
newIrp->MdlAddress = IoAllocateMdl(pBuffer, Size, …);
MmBuildMdlForNonPagedPool(newIrp->MdlAddress);
next_stack = IoGetNextIrpStackLocation(newIrp);
next_stack->MajorFunction = …;
next_stack->Parameters.Read.Length = …;
next_stack->Parameters.Read.ByteOffset = …;
IoSetCompletionRoutine(newIrp, MyCompletion, context, TRUE, TRUE, TRUE);
status = IoCallDriver(target_dev, newIrp);
return STATUS_PENDING;
}
I think the location of this driver is between File system driver and Storage driver.
I tested driver performance using perfmon.
When read file of 8g using 1m buffer without my driver, IO bandwidth is about 170MB/s.
but, with my driver, it’s about 120MB/s.
using a 512k buffer, IO bandwidth is about 150 MB/s without my driver.
120MB/s with my driver.
using a 4k buffer, It’s about 120 MB/s without my driver,
120MB/s with my driver.
I don’t know exactly why when the buffer size becomes larger, It shows better performance and my driver can’t show same perfomance.
I think dispatch routine has not problems about performance issue.
Are any factors required for accelerating performance?