none
how to write data into disk with filter driver RRS feed

  • Question

  •  Hi everyone,

         I'm developing a wdm filter driver. This driver keeps write request IRP data in my buffer. If my buffer full, driver send asynchronously write IRP to write disk.

    I hope this mechanism can save write time when host writing data into disk. But, I find a serious problem with this method, write throughput becomes very low and CPU utility very high.

    I think the reason is that CPU has to participate every sending asynchronously write IRP. Maybe I can use DMA mechanism to write disk directly, but I'm not sure this idea is good.

    Anyone can give me some advise?
    Thanks a lot! 

    Friday, March 24, 2017 9:29 AM

Answers

  • I am EXTREMELY skeptical that Fancy cache will provide any benefit whatsoever on a Windows system. The Windows cache manager is very sophisticated and should provide substantially better performance. A virtual block cache, such as implemented by Windows, does take more memory than a logical block cache, but memory is cheap and virtual block caches beat logical block caches because virtual block caches have the ability to read ahead that logical block caches do not. Also, the Windows cache manager cannot be disabled, so that means that the same data would reside in Windows' cache and your logical block cache at the same time, wasting memory.

    Attempting a project like this requires an extreme amount of knowledge and experience with Windows file system drivers, which you clearly do not have. I suggest you educate yourself on how the Windows I/O subsystem, file system, storage stack, and cache manager operate by reading the Windows Internals books, and then the relevant portions of the WDK documentation, followed by writing some disk and file system filters. I suspect it would take you several years of sustained effort to learn what you need to tackle a project such as this.

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Tuesday, March 28, 2017 3:53 AM
    Moderator
  • As Brian notes, these types of caches just don't do much.  I was approached 20 years ago to be the CTO of a software disk caching firm, that had done well with Windows 95, but found they needed a new product with Windows NT, they admitted though the claimed great performance boosts, their benchmarks were limited and contrived.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Tuesday, March 28, 2017 11:22 AM

All replies

  • First why in the world are you developing a WDM filter driver?   You should be using KMDF, since you will need to deal with PnP and Power in your filter and getting this right in WDM is very hard and just adds code that has to be maintained. 

    Your filter driver has to be above the storage controller or the disk driver, so you write to the disk by sending IRP's down to the disk driver.  You can't directly go to the disk hardware, because there is a driver (one of the above) that already owns the hardware.   Also, every disk is different so you would need to support many hardware configurations.

    What is the purpose of your proposed filter driver, if we know more we can better guide you.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Friday, March 24, 2017 10:56 AM
  • Yes,  my filter is above storage controller, I send IRP_MJ_WRITE IRP with IoBuildAsynchronousFsdRequest to lower driver.

    This driver purpose is saving write into disk time by keeping write into disk data with allocated buffer when host send write requests continuously, however, if this allocated buffer full, filter driver create new IRP_MJ_WRITE IRP to disk driver.

    About the KMDF module, I will study it, thank you for your advice. I think the low write throughput situation will also take place when I use KMDF module.
    Monday, March 27, 2017 2:37 AM
  • I found a  DMA example from Microsoft driver examples, Is this DMA mechanism can replace IoBuildAsynchronousFsdRequest send data to disk driver? I would appreciate any help.

    Tuesday, March 28, 2017 2:05 AM
  • You do not own the device, so no you cannot go writing to the device directly, you have to send requests to its driver.   All your idea's like DMA will just crash the system.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Tuesday, March 28, 2017 2:07 AM
  •  This link is what I want to do. Thank you~
    Tuesday, March 28, 2017 2:37 AM
  • I am EXTREMELY skeptical that Fancy cache will provide any benefit whatsoever on a Windows system. The Windows cache manager is very sophisticated and should provide substantially better performance. A virtual block cache, such as implemented by Windows, does take more memory than a logical block cache, but memory is cheap and virtual block caches beat logical block caches because virtual block caches have the ability to read ahead that logical block caches do not. Also, the Windows cache manager cannot be disabled, so that means that the same data would reside in Windows' cache and your logical block cache at the same time, wasting memory.

    Attempting a project like this requires an extreme amount of knowledge and experience with Windows file system drivers, which you clearly do not have. I suggest you educate yourself on how the Windows I/O subsystem, file system, storage stack, and cache manager operate by reading the Windows Internals books, and then the relevant portions of the WDK documentation, followed by writing some disk and file system filters. I suspect it would take you several years of sustained effort to learn what you need to tackle a project such as this.

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Tuesday, March 28, 2017 3:53 AM
    Moderator
  • As Brian notes, these types of caches just don't do much.  I was approached 20 years ago to be the CTO of a software disk caching firm, that had done well with Windows 95, but found they needed a new product with Windows NT, they admitted though the claimed great performance boosts, their benchmarks were limited and contrived.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Tuesday, March 28, 2017 11:22 AM
  • OK, Thanks a lot !
    Thursday, March 30, 2017 3:48 AM