How to redirect cache read to page read

Hi All
I want to redirect any read call coming for cache, to the read of file
on disk. So the read call, instead of getting data from cache, should
get it from the file on disk.
And also after any IO operation I want to clean my cache completely.

Thanks in Advance.

Regards,
Raghwendra

*********************************************************
Disclaimer:
The contents of this E-mail (including the contents of the enclosure(s) or attachment(s) if any) are privileged and confidential material of MBT and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee(s). In case you are not the desired addressee, you should delete this message and/or re-direct it to the sender. The views expressed in this E-mail message (including the enclosure(s) or attachment(s) if any) are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be free of any virus. However, it is the responsibility of the recipient to ensure that it is virus free and MBT is not responsible for any loss or damage arising in any way from its use

********************************************************

> I want to redirect any read call coming for cache, to the read of file

on disk. So the read call, instead of getting data from cache, should
get it from the file on disk.
And also after any IO operation I want to clean my cache completely.

What is your strategy for files mapped as sections?

What if I clear the section object.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rod Widdowson
Sent: Friday, October 07, 2005 4:09 PM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] How to redirect cache read to page read

I want to redirect any read call coming for cache, to the read of
file
on disk. So the read call, instead of getting data from cache, should
get it from the file on disk.
And also after any IO operation I want to clean my cache completely.

What is your strategy for files mapped as sections?


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@mahindrabt.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

*********************************************************
Disclaimer:
The contents of this E-mail (including the contents of the enclosure(s) or attachment(s) if any) are privileged and confidential material of MBT and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee(s). In case you are not the desired addressee, you should delete this message and/or re-direct it to the sender. The views expressed in this E-mail message (including the enclosure(s) or attachment(s) if any) are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be free of any virus. However, it is the responsibility of the recipient to ensure that it is virus free and MBT is not responsible for any loss or damage arising in any way from its use

********************************************************

> What if I clear the section object.

I’d have thought (I’ve not tried it) that you might give the memory manager
indigestion next time you get a page fault but I have no certainty there.
It’s my experience that trying to persuade the cache manager to do what you
want when you are not the underlying filesystem is, at its very best,
extremely painful so I try to avoid going down that path.

Anyway, the FAT source has examples of tearing up the cache. Do bear in
mind that MmForceSectionClose can fail, also and PLEASE remember that if you
are not the file system other parts of the system may object to you ripping
away memory they were trusting. So I’d recommend a full review of the FAT
caching paths before you put finger to keyboard.

You can try and persuade the underlying layers not to cache file by
intercepting the CREATE and setting the appropriate bit in the File Object
(however some file systems ignore the hint). This may well be your best bet
to reducing the chances of data being cached. I’d advise against mucking
about with the PAGING flag in the read (and especially the) write path since
it is a recipe for corruption of the sort you won’t see until aeons later.

You don’t say what your end user requirements are, but I have a suspicion
that unless you own the application environment you are not going to be able
to guarantee that what you want to achieve (and if you own the application
there are probably easier ways of going about it), also robustmess may be a
challenge.

/rod

Since you don’t mention if this is a filter or a file system in which
you are performing it, you make the conversation a bit more difficult.

In either case, you have the initial problem that cached read operations
do not have the same restrictions that non-cached read operations have.
Thus, you cannot just “convert” a six-byte cached read into a six-byte
non-cached read. The non-cached read must be done in properly aligned
buffers on sector-sized boundaries in sector sized units. Thus, in the
worst case, you need to allocate an aligned buffer, retrieve the
existing data, update the appropriate bytes and then write the existing
data, ensuring that you don’t allow any other access to that region of
the file while you are doing so.

If you are a file system, the easiest thing to do is to never allow
caching in the first place - don’t create a section object pointers
structure region and it will “just work”. Caching will never be
established, memory mapping will never be allowed.

If you are a filter driver, you are out of luck. You can try persuasive
techniques (Cc and Mm functions that try to make the section go away)
but they are not guaranteed to fail.

And of course there is the bottom line issue that disabling caching in
this fashion is going to be a horrible drain on performance. Thus, you
might achieve a mixture of techniques here you find acceptable from a
technical perspective but the overall project will fail because it makes
the user’s machines so hideously slow that they find it unusable.

Disabling caching is, in my experience, something that developers
believe will simplify their development but ultimately makes it fragile
and complex and horribly performing.

Regards,

Tony

Tony Mason

Consulting Partner

OSR Open Systems Resources, Inc.

http://www.osr.com

Looking forward to seeing you at the next OSR File Systems class in Los
Angeles, CA October 24-27, 2005.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Raghwendra Kshatriya
Sent: Friday, October 07, 2005 5:08 AM
To: ntfsd redirect
Subject: [ntfsd] How to redirect cache read to page read

Hi All

I want to redirect any read call coming for cache, to the read of file
on disk. So the read call, instead of getting data from cache, should
get it from the file on disk.

And also after any IO operation I want to clean my cache completely.

Thanks in Advance.

Regards,

Raghwendra


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

*********************************************************
Disclaimer:
The contents of this E-mail (including the contents of the enclosure(s)
or attachment(s) if any) are privileged and confidential material of MBT
and should not be disclosed to, used by or copied in any manner by
anyone other than the intended addressee(s). In case you are not the
desired addressee, you should delete this message and/or re-direct it to
the sender. The views expressed in this E-mail message (including the
enclosure(s) or attachment(s) if any) are those of the individual
sender, except where the sender expressly, and with authority, states
them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be
free of any virus. However, it is the responsibility of the recipient to
ensure that it is virus free and MBT is not responsible for any loss or
damage arising in any way from its use

********************************************************