[NTOSKRNL] Implement support for deferred writes in Cc.

Namely, implement CcCanIWrite() (very basic, and likely wrong).
And implement CcDeferWrite() which will queue the write operation.

In CciLazyWriter() (which may be renamed CcWorkerThread() ;-)),
handle the queued write operations one by one. This is likely
not to be accurate, but, given we have only on FS supporting
this for now (NFS / RDBSS / Shares), this is OK.

CORE-14235
This commit is contained in:
Pierre Schweitzer 2018-01-23 22:56:23 +01:00
parent 07e6e9c9c1
commit 9a07c71eef
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
3 changed files with 101 additions and 2 deletions

View file

@ -41,6 +41,10 @@
//
extern ULONG CcRosTraceLevel;
extern LIST_ENTRY DirtyVacbListHead;
extern ULONG CcDirtyPageThreshold;
extern ULONG CcTotalDirtyPages;
extern LIST_ENTRY CcDeferredWrites;
extern KSPIN_LOCK CcDeferredWriteSpinLock;
typedef struct _PF_SCENARIO_ID
{
@ -193,6 +197,17 @@ typedef struct _ROS_VACB
/* Pointer to the next VACB in a chain. */
} ROS_VACB, *PROS_VACB;
typedef struct _ROS_DEFERRED_WRITE_CONTEXT
{
LIST_ENTRY CcDeferredWritesEntry;
PFILE_OBJECT FileObject;
PCC_POST_DEFERRED_WRITE PostRoutine;
PVOID Context1;
PVOID Context2;
ULONG BytesToWrite;
BOOLEAN Retrying;
} ROS_DEFERRED_WRITE_CONTEXT, *PROS_DEFERRED_WRITE_CONTEXT;
typedef struct _INTERNAL_BCB
{
/* Lock */