Is there any other method to write to disk in uper level driver?

I wonder that :

  1. is there any other method to write to disk except than send IRP_MJ_WRITE to
    disk class driver?

  2. did file system driver send SRB directly to disk driver in some special
    situatin?

> I wonder that :

  1. is there any other method to write to disk except than send
    IRP_MJ_WRITE to
    disk class driver?

  2. did file system driver send SRB directly to disk driver in some special
    situatin?

I suspect this would not make sense, because a file system driver has no
concept of the concept of “disk”. It could be an SSD with large block
sizes, or a disk with 4K sectors, or a flash drive, or… so it would be
excessively dangerous for a fie system to make any presumption about the
underlying media.
joe


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars 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

Acutally, I was writing a disk filter driver which attached to Disk.sys

when my filter driver intercept a IRP_MJ_READ?it call IoAllocateIrp() to create a new IRP_MJ_READ irp which was assigned with the same Byteoffset,Length, and newIrp->Flag=0x43,

after it synchronouly tranfers the two Irp (the raw one and the new one alloced by me), compare the data buffer. I found that somtimes it was not identital. but most time it was.

I thought that may be some associated irp was not correctly connnetc with my new irp. how to explain that ?

See IOCTL_SCSI_PASS_THROUGH and IOCTL_SCSI_PASS_THROUGH_DIRECT … yes, applications can write directly to the disk and bypass filter drivers.

Also, there are other IOCTLs which modify the on disk contents, such as IOCTL_RESET_SNAPSHOT_INFO which modifies the partition table. (this is an example, there are a number of other IOCTLs that modify on disk data as well).

And ofcourse with Windows 8+ you also have to deal with copy offload which instructs the storage device to copy data from location a to location b where location does not necessarily imply within the same disk or volume or even storage array.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, December 18, 2013 3:50 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Is there any other method to write to disk in uper level driver?

Acutally, I was writing a disk filter driver which attached to Disk.sys

when my filter driver intercept a IRP_MJ_READ?it call IoAllocateIrp() to create a new IRP_MJ_READ irp which was assigned with the same Byteoffset,Length, and newIrp->Flag=0x43,

after it synchronouly tranfers the two Irp (the raw one and the new one alloced by me), compare the data buffer. I found that somtimes it was not identital. but most time it was.

I thought that may be some associated irp was not correctly connnetc with my new irp. how to explain that ?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars 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

Assuming all your code is correct, this is happening because windows uses dummy pages which are shared across multiple IOs. No body cares about this data and are there for IO optimization. If you want to do data comparison, allocate your own local buffer for both the Irps (yours as well as the one originally received from higher layers), and then do the data comparison. But before completing the original Irp copy the data from your local buffer to the original irp.

>IOCTL_RESET_SNAPSHOT_INFO which modifies the partition table. (this is an example, there are

a number of other IOCTLs that modify on disk data as well).

Except COPY_DATA and the VolSnap’s pre-copy-on-write (which only modifies the VolSnap’s data files) - what else?


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

Are you blocking all writes in between the two read operations you send?

-p

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, December 18, 2013 12:50 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Is there any other method to write to disk in uper level driver?

Acutally, I was writing a disk filter driver which attached to Disk.sys

when my filter driver intercept a IRP_MJ_READ?it call IoAllocateIrp() to create a new IRP_MJ_READ irp which was assigned with the same Byteoffset,Length, and newIrp->Flag=0x43,

after it synchronouly tranfers the two Irp (the raw one and the new one alloced by me), compare the data buffer. I found that somtimes it was not identital. but most time it was.

I thought that may be some associated irp was not correctly connnetc with my new irp. how to explain that ?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars 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

Maxim, any IOCTL that modifies the partition table. See IOCTL_DISK_DELETE_DRIVE_LAYOUT, IOCTL_DISK_SET*, IOCTL_DISK_GROW_PARTITION, etc. As a block filter attaching to disk class, these need to be accounted for. The OP did not specify the LBA range being read/written. I’ve also previously listed IOCTL_SCSI_PASS_THROUGH*.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Wednesday, December 18, 2013 1:21 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] RE:Is there any other method to write to disk in uper level driver?

IOCTL_RESET_SNAPSHOT_INFO which modifies the partition table. (this is
an example, there are a number of other IOCTLs that modify on disk data as well).

Except COPY_DATA and the VolSnap’s pre-copy-on-write (which only modifies the VolSnap’s data files) - what else?


Maxim S. Shatskih
Microsoft MVP on File System And Storage xxxxx@storagecraft.com http://www.storagecraft.com


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars 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

[quote]
If you want to do data comparison, allocate your
own local buffer for both the Irps (yours as well as the one originally received
from higher layers), and then do the data comparison. But before completing the
original Irp copy the data from your local buffer to the original irp.

[quote]

my DispatchReadWrite will intercept IRP_MJ_READ/WRITE, and insert them into a cancel-safe irp queue before pending return.

It will pop a IRP_MJ_Read/Write in a worker thread . Every read/write irp will be completed synchronously in the worker thread. As soon as IRP_MJ_READ complete routine returning, it allocate a new IRP_MJ_READ to do the some reading.
so all writes will be blocked between the two read operations. There will be others modify the original read buffers in the interval?

Just like 'PraDeep" said, I allocate a new buffer , and build a new Mdl to relapce the one for the Original Read IRP. After the originate IRP synchronously complete, I send my allocated read irp. This time , the read content are always identical.

can anybody teach me what is dummy page?

Google “mdl dummy page”

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Thursday, December 19, 2013 3:07 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Is there any other method to write to disk in uper level driver?

Just like 'PraDeep" said, I allocate a new buffer , and build a new Mdl to relapce the one for the Original Read IRP. After the originate IRP synchronously complete, I send my allocated read irp. This time , the read content are always identical.

can anybody teach me what is dummy page?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars 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

Sorry for double post, but my previous response was a bit terse.

First google mdl dummy page then ask for clarification with more specific questions.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Speer, Kenny
Sent: Thursday, December 19, 2013 8:47 AM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Is there any other method to write to disk in uper level driver?

Google “mdl dummy page”

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Thursday, December 19, 2013 3:07 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Is there any other method to write to disk in uper level driver?

Just like 'PraDeep" said, I allocate a new buffer , and build a new Mdl to relapce the one for the Original Read IRP. After the originate IRP synchronously complete, I send my allocated read irp. This time , the read content are always identical.

can anybody teach me what is dummy page?


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars 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


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars 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