One quick question

Hi,

We have an application which reads data from volume where it opens the
volume and does a cached/buffered read. Question is when we do cached read
on volume, data comes from cache or data is fetched from disk? Basically is
there a cache at volume/block level? or is the data always fetched from disk
for volume read irrespective of mode specified i.e. buffered or
not-buffered?

Thanks,
Sunil

From the FASTFAT source code (FatCommonRead):

//
// Save callers who try to do cached IO to the raw volume from themselves.
//

if (TypeOfOpen == UserVolumeOpen) {

NonCachedIo = TRUE;
}

I’d imagine that the other file systems perform a similar check.

-scott


Scott Noone
Consulting Associate and Chief System Problem Analyst
OSR Open Systems Resources, Inc.
http://www.osronline.com

“Sunil Patil” wrote in message news:xxxxx@ntdev…
Hi,

We have an application which reads data from volume where it opens the
volume and does a cached/buffered read. Question is when we do cached read
on volume, data comes from cache or data is fetched from disk? Basically is
there a cache at volume/block level? or is the data always fetched from disk
for volume read irrespective of mode specified i.e. buffered or
not-buffered?

Thanks,
Sunil

Cache is at the file level. If you open the entire volume as a file then you have caching at the volume level. Either the file system allows both at the same time and manages the cache collisions, or only allows file or volume access.

What’s your concern?

-p

On Sep 20, 2011, at 4:19 AM, “Sunil Patil” wrote:

> Hi,
>
> We have an application which reads data from volume where it opens the volume and does a cached/buffered read. Question is when we do cached read on volume, data comes from cache or data is fetched from disk? Basically is there a cache at volume/block level? or is the data always fetched from disk for volume read irrespective of mode specified i.e. buffered or not-buffered?
>
> Thanks,
> Sunil
> — NTDEV is sponsored by OSR 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

Now a side question: is it possible to create and map a memory-mapped file, using volume handle? Will it then have caching behavior same as regular file mapping?

Hi,

I want to understand how volume read/write works (as part of performance
tests).

Could you please suggest me a test whereby I can verify that volume reads
happen from cache. Do we need to set any property on volume/disk for cached
READ to happen. Is the behavior different for win2k8 and win2k3 or for
different FileSystems?

I did following tests on a NTFS mounted volume on win2k8 R2 (64 bit) server.

Issue READ on a particular offset of volume and read one 4K block. First
time it went through volume layer and data obtained from disk. This is
expected. Second time I issued same REDA operation again (at the same volume
offset for the same block). This operation also went through volume layer
and data obtained from disk. I expected this to come from cache. I observed
that all subsequent volume READs (at same offset/block) went through volume
layer. Also verified on SCSI target side that these reads are indeed coming
to the disk.

I used following function to open volume (Note: Flag NO_BUFFERING and
WRITE_THROUGH are not specified). Volume name is of type “\.\E:”
hFile = CreateFile (deviceNameW,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
0,
NULL);

Thanks,
Sunil

On Tue, Sep 20, 2011 at 7:58 PM, Peter Wieland wrote:

> Cache is at the file level. If you open the entire volume as a file then
> you have caching at the volume level. Either the file system allows both at
> the same time and manages the cache collisions, or only allows file or
> volume access.
>
> What’s your concern?
>
> -p
>
> On Sep 20, 2011, at 4:19 AM, “Sunil Patil” wrote:
>
> > Hi,
> >
> > We have an application which reads data from volume where it opens the
> volume and does a cached/buffered read. Question is when we do cached read
> on volume, data comes from cache or data is fetched from disk? Basically is
> there a cache at volume/block level? or is the data always fetched from disk
> for volume read irrespective of mode specified i.e. buffered or
> not-buffered?
> >
> > Thanks,
> > Sunil
> > — NTDEV is sponsored by OSR 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
>
> 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
>