CcFlushCache question

Hi all,

Can anybody explain me exactly, why fastfat use acquring and releasing of
PagingIoResource after CcFlushCache (see comment) ?
It seems strange - CcFlushCache call is synchronous operation and all data
should be written on return. I made some tests and it looks really
important -
without acquiring PagingIoResource rarely data is not completelly written.

Thanks

Petr

CcFlushCache( &Fcb->NonPaged->SectionObjectPointers, NULL,
0, NULL );

//
// Grab and release PagingIo to serialize ourselves with
the lazy writer.
// This will work to ensure that all IO has completed on
the cached
// data and we will succesfully tear away the cache
section.
//

ExAcquireResourceExclusiveLite(
Fcb->Header.PagingIoResource, TRUE);
ExReleaseResourceLite( Fcb->Header.PagingIoResource );

CcPurgeCacheSection( &Fcb->NonPaged->SectionObjectPointers,
NULL,
0,
FALSE );

CcFlushCache does not synchronize vs. others flushers who have picked up ranges of the file to flush, to guarantee that all the ranges have been flushed by the time this call returns. That is left to the filesystem.

This is FAT dealing with that, making sure there is no instance of the lazy writer currently active on that file by the time it calls purge. Look at the resources it acquires in the AcquireForLazyWrite callback.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Petr Borsodi
Sent: Wednesday, November 07, 2007 11:50 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] CcFlushCache question

Hi all,

Can anybody explain me exactly, why fastfat use acquring and releasing of
PagingIoResource after CcFlushCache (see comment) ?
It seems strange - CcFlushCache call is synchronous operation and all data
should be written on return. I made some tests and it looks really
important -
without acquiring PagingIoResource rarely data is not completelly written.

Thanks

Petr

CcFlushCache( &Fcb->NonPaged->SectionObjectPointers, NULL,
0, NULL );

//
// Grab and release PagingIo to serialize ourselves with
the lazy writer.
// This will work to ensure that all IO has completed on
the cached
// data and we will succesfully tear away the cache
section.
//

ExAcquireResourceExclusiveLite(
Fcb->Header.PagingIoResource, TRUE);
ExReleaseResourceLite( Fcb->Header.PagingIoResource );

CcPurgeCacheSection( &Fcb->NonPaged->SectionObjectPointers,
NULL,
0,
FALSE );


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars

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

CcFlushCache called by the main FSD thread is not synchronized with the
possible Cc-initiated lazy writer’s flushes.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“Petr Borsodi” wrote in message news:xxxxx@ntfsd…
> Hi all,
>
> Can anybody explain me exactly, why fastfat use acquring and releasing of
> PagingIoResource after CcFlushCache (see comment) ?
> It seems strange - CcFlushCache call is synchronous operation and all data
> should be written on return. I made some tests and it looks really
> important -
> without acquiring PagingIoResource rarely data is not completelly written.
>
> Thanks
>
> Petr
>
>
>
> CcFlushCache( &Fcb->NonPaged->SectionObjectPointers, NULL,
> 0, NULL );
>
> //
> // Grab and release PagingIo to serialize ourselves with
> the lazy writer.
> // This will work to ensure that all IO has completed on
> the cached
> // data and we will succesfully tear away the cache
> section.
> //
>
> ExAcquireResourceExclusiveLite(
> Fcb->Header.PagingIoResource, TRUE);
> ExReleaseResourceLite( Fcb->Header.PagingIoResource );
>
> CcPurgeCacheSection( &Fcb->NonPaged->SectionObjectPointers,
> NULL,
> 0,
> FALSE );
>
>
>

Thank you, it makes sense - without synchronization the purge is sometimes
quicker than lazy writer.
But how is flush synchronized with Modified Page Writer -
AcquireForModifiedPageWriter callback not always grab PagingIoResource…

Petr

“Dan Lovinger” píse v diskusním príspevku
news:xxxxx@ntfsd…
CcFlushCache does not synchronize vs. others flushers who have picked up
ranges of the file to flush, to guarantee that all the ranges have been
flushed by the time this call returns. That is left to the filesystem.

This is FAT dealing with that, making sure there is no instance of the lazy
writer currently active on that file by the time it calls purge. Look at the
resources it acquires in the AcquireForLazyWrite callback.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Petr Borsodi
Sent: Wednesday, November 07, 2007 11:50 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] CcFlushCache question

Hi all,

Can anybody explain me exactly, why fastfat use acquring and releasing of
PagingIoResource after CcFlushCache (see comment) ?
It seems strange - CcFlushCache call is synchronous operation and all data
should be written on return. I made some tests and it looks really
important -
without acquiring PagingIoResource rarely data is not completelly written.

Thanks

Petr

CcFlushCache( &Fcb->NonPaged->SectionObjectPointers, NULL,
0, NULL );

//
// Grab and release PagingIo to serialize ourselves with
the lazy writer.
// This will work to ensure that all IO has completed on
the cached
// data and we will succesfully tear away the cache
section.
//

ExAcquireResourceExclusiveLite(
Fcb->Header.PagingIoResource, TRUE);
ExReleaseResourceLite( Fcb->Header.PagingIoResource );

CcPurgeCacheSection( &Fcb->NonPaged->SectionObjectPointers,
NULL,
0,
FALSE );


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars

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

Note that the context of the code you’re looking at here, in the create path, already holds the main resource exclusive. By the time it does the flush and pick/drop of the pagingio, we should have synchronized with any form of the modified page writer, whether it was extending VDL or not.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Petr Borsodi
Sent: Wednesday, November 07, 2007 2:09 PM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] CcFlushCache question

Thank you, it makes sense - without synchronization the purge is sometimes
quicker than lazy writer.
But how is flush synchronized with Modified Page Writer -
AcquireForModifiedPageWriter callback not always grab PagingIoResource…

Petr

“Dan Lovinger” p?se v diskusn?m pr?spevku
news:xxxxx@ntfsd…
CcFlushCache does not synchronize vs. others flushers who have picked up
ranges of the file to flush, to guarantee that all the ranges have been
flushed by the time this call returns. That is left to the filesystem.

This is FAT dealing with that, making sure there is no instance of the lazy
writer currently active on that file by the time it calls purge. Look at the
resources it acquires in the AcquireForLazyWrite callback.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Petr Borsodi
Sent: Wednesday, November 07, 2007 11:50 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] CcFlushCache question

Hi all,

Can anybody explain me exactly, why fastfat use acquring and releasing of
PagingIoResource after CcFlushCache (see comment) ?
It seems strange - CcFlushCache call is synchronous operation and all data
should be written on return. I made some tests and it looks really
important -
without acquiring PagingIoResource rarely data is not completelly written.

Thanks

Petr

CcFlushCache( &Fcb->NonPaged->SectionObjectPointers, NULL,
0, NULL );

//
// Grab and release PagingIo to serialize ourselves with
the lazy writer.
// This will work to ensure that all IO has completed on
the cached
// data and we will succesfully tear away the cache
section.
//

ExAcquireResourceExclusiveLite(
Fcb->Header.PagingIoResource, TRUE);
ExReleaseResourceLite( Fcb->Header.PagingIoResource );

CcPurgeCacheSection( &Fcb->NonPaged->SectionObjectPointers,
NULL,
0,
FALSE );


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars

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


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars

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

Oh yes, of course. I omit it. My code already holds main resource in these
situations.

Thank you

Petr

“Dan Lovinger” píse v diskusním príspevku
news:xxxxx@ntfsd…
Note that the context of the code you’re looking at here, in the create
path, already holds the main resource exclusive. By the time it does the
flush and pick/drop of the pagingio, we should have synchronized with any
form of the modified page writer, whether it was extending VDL or not.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Petr Borsodi
Sent: Wednesday, November 07, 2007 2:09 PM
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] CcFlushCache question

Thank you, it makes sense - without synchronization the purge is sometimes
quicker than lazy writer.
But how is flush synchronized with Modified Page Writer -
AcquireForModifiedPageWriter callback not always grab PagingIoResource…

Petr

“Dan Lovinger” píse v diskusním príspevku
news:xxxxx@ntfsd…
CcFlushCache does not synchronize vs. others flushers who have picked up
ranges of the file to flush, to guarantee that all the ranges have been
flushed by the time this call returns. That is left to the filesystem.

This is FAT dealing with that, making sure there is no instance of the lazy
writer currently active on that file by the time it calls purge. Look at the
resources it acquires in the AcquireForLazyWrite callback.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Petr Borsodi
Sent: Wednesday, November 07, 2007 11:50 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] CcFlushCache question

Hi all,

Can anybody explain me exactly, why fastfat use acquring and releasing of
PagingIoResource after CcFlushCache (see comment) ?
It seems strange - CcFlushCache call is synchronous operation and all data
should be written on return. I made some tests and it looks really
important -
without acquiring PagingIoResource rarely data is not completelly written.

Thanks

Petr

CcFlushCache( &Fcb->NonPaged->SectionObjectPointers, NULL,
0, NULL );

//
// Grab and release PagingIo to serialize ourselves with
the lazy writer.
// This will work to ensure that all IO has completed on
the cached
// data and we will succesfully tear away the cache
section.
//

ExAcquireResourceExclusiveLite(
Fcb->Header.PagingIoResource, TRUE);
ExReleaseResourceLite( Fcb->Header.PagingIoResource );

CcPurgeCacheSection( &Fcb->NonPaged->SectionObjectPointers,
NULL,
0,
FALSE );


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars

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


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars

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