- Prepared ntfs for using CcInitializeCacheMap/CcUninitializeCacheMap instead of CcRosInitializeFileCache/CcRosReleaseFileCache.

svn path=/trunk/; revision=13530
This commit is contained in:
Hartmut Birr 2005-02-13 17:23:41 +00:00
parent be6f666161
commit 11aca778bc
3 changed files with 31 additions and 5 deletions

View file

@ -155,7 +155,11 @@ NtfsReleaseFCB(PDEVICE_EXTENSION Vcb,
if (Fcb->RefCount <= 0 && !NtfsFCBIsDirectory(Fcb)) if (Fcb->RefCount <= 0 && !NtfsFCBIsDirectory(Fcb))
{ {
RemoveEntryList(&Fcb->FcbListEntry); RemoveEntryList(&Fcb->FcbListEntry);
#ifdef USE_ROS_CC_AND_FS
CcRosReleaseFileCache(Fcb->FileObject); CcRosReleaseFileCache(Fcb->FileObject);
#else
CcUninitializeCacheMap (Fcb->FileObject, NULL, NULL);
#endif
NtfsDestroyFCB(Fcb); NtfsDestroyFCB(Fcb);
} }
KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql); KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
@ -241,7 +245,7 @@ NtfsFCBInitializeCache(PVCB Vcb,
newCCB->PtrFileObject = FileObject; newCCB->PtrFileObject = FileObject;
Fcb->FileObject = FileObject; Fcb->FileObject = FileObject;
Fcb->DevExt = Vcb; Fcb->DevExt = Vcb;
#ifdef ROS_USE_CC_AND_FS
Status = CcRosInitializeFileCache(FileObject, Status = CcRosInitializeFileCache(FileObject,
CACHEPAGESIZE(Vcb)); CACHEPAGESIZE(Vcb));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -249,7 +253,13 @@ NtfsFCBInitializeCache(PVCB Vcb,
DbgPrint("CcRosInitializeFileCache failed\n"); DbgPrint("CcRosInitializeFileCache failed\n");
KEBUGCHECK(0); KEBUGCHECK(0);
} }
#else
CcInitializeCacheMap(FileObject,
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
FALSE,
NULL,
NULL);
#endif
ObDereferenceObject(FileObject); ObDereferenceObject(FileObject);
Fcb->Flags |= FCB_CACHE_INITIALIZED; Fcb->Flags |= FCB_CACHE_INITIALIZED;
@ -394,7 +404,6 @@ NtfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
PFCB Fcb, PFCB Fcb,
PFILE_OBJECT FileObject) PFILE_OBJECT FileObject)
{ {
NTSTATUS Status;
PCCB newCCB; PCCB newCCB;
newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), TAG_CCB); newCCB = ExAllocatePoolWithTag(NonPagedPool, sizeof(CCB), TAG_CCB);
@ -412,6 +421,8 @@ NtfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
if (!(Fcb->Flags & FCB_CACHE_INITIALIZED)) if (!(Fcb->Flags & FCB_CACHE_INITIALIZED))
{ {
#ifdef ROS_USE_CC_AND_FS
NTSTATUS Status;
Status = CcRosInitializeFileCache(FileObject, Status = CcRosInitializeFileCache(FileObject,
CACHEPAGESIZE(Vcb)); CACHEPAGESIZE(Vcb));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -419,6 +430,13 @@ NtfsAttachFCBToFileObject(PDEVICE_EXTENSION Vcb,
DbgPrint("CcRosInitializeFileCache failed\n"); DbgPrint("CcRosInitializeFileCache failed\n");
KEBUGCHECK(0); KEBUGCHECK(0);
} }
#else
CcInitializeCacheMap(FileObject,
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
FALSE,
NULL,
NULL);
#endif
Fcb->Flags |= FCB_CACHE_INITIALIZED; Fcb->Flags |= FCB_CACHE_INITIALIZED;
} }

View file

@ -387,7 +387,7 @@ NtfsMountVolume(PDEVICE_OBJECT DeviceObject,
// Fcb->Entry.ExtentLocationL = 0; // Fcb->Entry.ExtentLocationL = 0;
// Fcb->Entry.DataLengthL = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE; // Fcb->Entry.DataLengthL = DeviceExt->CdInfo.VolumeSpaceSize * BLOCKSIZE;
#ifdef ROS_USE_CC_AND_FS
Status = CcRosInitializeFileCache(DeviceExt->StreamFileObject, Status = CcRosInitializeFileCache(DeviceExt->StreamFileObject,
CACHEPAGESIZE(DeviceExt)); CACHEPAGESIZE(DeviceExt));
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS (Status))
@ -395,7 +395,13 @@ NtfsMountVolume(PDEVICE_OBJECT DeviceObject,
DbgPrint("CcRosInitializeFileCache() failed (Status %lx)\n", Status); DbgPrint("CcRosInitializeFileCache() failed (Status %lx)\n", Status);
goto ByeBye; goto ByeBye;
} }
#else
CcInitializeCacheMap(DeviceExt->StreamFileObject,
(PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
FALSE,
NULL,
NULL);
#endif
ExInitializeResourceLite(&DeviceExt->DirResource); ExInitializeResourceLite(&DeviceExt->DirResource);
// ExInitializeResourceLite(&DeviceExt->FatResource); // ExInitializeResourceLite(&DeviceExt->FatResource);

View file

@ -3,6 +3,8 @@
#include <ddk/ntifs.h> #include <ddk/ntifs.h>
#define USE_ROS_CC_AND_FS
#define CACHEPAGESIZE(pDeviceExt) \ #define CACHEPAGESIZE(pDeviceExt) \
((pDeviceExt)->NtfsInfo.BytesPerCluster > PAGE_SIZE ? \ ((pDeviceExt)->NtfsInfo.BytesPerCluster > PAGE_SIZE ? \