I have a virtual disk device that sits on top of a block device.
Is there any way I can employ cached I/o (CcCopyRead, CcCopyWrite,…)
to do R/W from the block device?
I try CcInitializeCacheMap on a FILE_OBJECT returned from
IoGetDeviceObjectPointer but it always throws an exception with error code
0xc0000005. I look at file object and most of its fields are NULL.
Do I need to somehow populate these fields or
am I taking a wrong approach here. Please help. Thanks
try
{
CcInitializeCacheMap(pFileObj, // File obj
&FileSizes, // file sizes are set to size of the
block device
TRUE, // use PinAccess
&(MyGlobalData.CacheMgrCallBacks), // CM callbacks
pMyContext); // context used by callbacks
}
except(EXCEPTION_EXECUTE_HANDLER)
{
status = GetExceptionCode(); // 0xc0000005
}
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of ChuBun
Sent: Wednesday, January 28, 2004 9:57 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Block device and cached I/O question
Hello,
I have a virtual disk device that sits on top of a block device.
Is there any way I can employ cached I/o (CcCopyRead, CcCopyWrite,…)
to do R/W from the block device?
I try CcInitializeCacheMap on a FILE_OBJECT returned from
IoGetDeviceObjectPointer but it always throws an exception with error code
0xc0000005. I look at file object and most of its fields are NULL.
Do I need to somehow populate these fields or
am I taking a wrong approach here. Please help. Thanks
try
{
CcInitializeCacheMap(pFileObj, // File obj
&FileSizes, // file sizes are set to size of the
block device
TRUE, // use PinAccess
&(MyGlobalData.CacheMgrCallBacks), // CM callbacks
pMyContext); // context used by callbacks
}
except(EXCEPTION_EXECUTE_HANDLER)
{
status = GetExceptionCode(); // 0xc0000005
}
No, Cache Manager is a library provided for filesystems, and only the
filesystems can use it.
If you’re planning to run the usual NT filesystems on your disk - then you
do not need any disk level caching at all. Otherwise, write your own
filesystem, which will use Cc services.
----- Original Message -----
From: “ChuBun” Newsgroups: ntdev To: “Windows System Software Devs Interest List” Sent: Wednesday, January 28, 2004 8:57 PM Subject: [ntdev] Block device and cached I/O question
> Hello, > > I have a virtual disk device that sits on top of a block device. > Is there any way I can employ cached I/o (CcCopyRead, CcCopyWrite,…) > to do R/W from the block device? > > I try CcInitializeCacheMap on a FILE_OBJECT returned from > IoGetDeviceObjectPointer but it always throws an exception with error code > 0xc0000005. I look at file object and most of its fields are NULL. > Do I need to somehow populate these fields or > am I taking a wrong approach here. Please help. Thanks > > Chu Bun > > ///// > status = IoGetDeviceObjectPointer(&blockDevice /* > \Device\Hardisk1\Partition0 */, > FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES, > &(pFileObj), > &(pDevObj)); > > try > { > CcInitializeCacheMap(pFileObj, // File obj > &FileSizes, // file sizes are set to size of the > block device > TRUE, // use PinAccess > &(MyGlobalData.CacheMgrCallBacks), // CM callbacks > pMyContext); // context used by callbacks > } > except(EXCEPTION_EXECUTE_HANDLER) > { > status = GetExceptionCode(); // 0xc0000005 > } > > ///// > > > > — > Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com > To unsubscribe send a blank email to xxxxx@lists.osr.com
I monitor the Dispatch R/W routines of my driver and don’t see any activity
that seems to relate to caching I/Os. So I thought maybe this is something
that I need to handle.