I’m going to go out on a limb, and disagree with the esteemed Mr. Craig.
Maybe it’ll get him to light that cigar.
Whether a legacy FSFD or a mini-filter, MOST of the code can be pageable.
The exact proportions will naturally depend on the nature of the filter, but
heres an attempt at the basic guidelines the OP asked for:
All dispatch (pre-processing) routines may be paged, with the exception of
read and write. Read and write need to be non-paged to handle I/O to the
paging file (see FsRtlIsPagingFile()). If you are not interested in I/O to
the paging file, then your dispatch routine can be a stub that calls a paged
routine to do the real work.
All I/O completion routines (post-processing) must be non-paged. However,
in many cases (See IoIsOperationSynchronous), the completion routine can
simply synchronize back to the dispatch routine, which is paged.
If the completion cannot be synchronized to dispatch, it can often be posted
to a worker thread, which may be pageable. The complex rules regarding what
can and cannot be posted, and what you can and cannot do from posted
completion processing are beyond the scope of the OP’s question, so I’ll
refuse to address it.
All of this assumes that you are using synchronization mechanisms that are
reasonable and appropriate for file systems, e.g. ERESOURCEs, not spin
locks. It also assumes the driver is written in C, as God and Dave
intended.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David Craig
Sent: Monday, March 26, 2007 5:23 PM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] PAGE code sections
If the FSFD is a legacy driver, then probably only the DriverEntry() path is
good for paging. If you are using C++, then never use paged code or data.
The placement of functions called from C++ is very unpredictable and one
might get placed in paged memory where it might be referenced in the paging
path. If your driver was to only attach to volumes that cannot contain the
page file, then paging might work, but analyze carefully.
If it is a minifilter, I guess most of the same rules apply. Watch out for
function that can be called on a volume that can contain a page file. Also
watch out for use of C++. Create a .map file and see where each function
gets placed. All this can be done and will have to be done with each
build - automate with python, if you like.
“Neil Weicher” wrote in message news:xxxxx@ntfsd…
>I have seen discussions that using #pragma alloc_text(PAGE, …) can do
>more
> harm than good if not done right.
>
> Can someone in the know give some rules of thumb as when it might be
> helpful, if ever? Particularly in a FSFD.
>
> Thanks.
>
>
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@privtek.com
To unsubscribe send a blank email to xxxxx@lists.osr.com