Author: pschweitzer
Date: Sat Aug 6 08:30:30 2016
New Revision: 72124
URL:
http://svn.reactos.org/svn/reactos?rev=72124&view=rev
Log:
[FASTFAT]
Track child FCB in parent FCB to allow browsing them in case it's needed.
This allows fixing a FIXME and offering better performances when renaming a directory.
CORE-11377
CORE-11426
Modified:
trunk/reactos/drivers/filesystems/fastfat/fcb.c
trunk/reactos/drivers/filesystems/fastfat/finfo.c
Modified: trunk/reactos/drivers/filesystems/fastfat/fcb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] Sat Aug 6 08:30:30 2016
@@ -153,6 +153,7 @@
rcFCB->RFCB.PagingIoResource = &rcFCB->PagingIoResource;
rcFCB->RFCB.Resource = &rcFCB->MainResource;
rcFCB->RFCB.IsFastIoPossible = FastIoIsNotPossible;
+ InitializeListHead(&rcFCB->ParentListHead);
return rcFCB;
}
@@ -271,6 +272,8 @@
ExDeleteResourceLite(&pFCB->PagingIoResource);
ExDeleteResourceLite(&pFCB->MainResource);
ExFreeToNPagedLookasideList(&VfatGlobalData->FcbLookasideList, pFCB);
+ RemoveEntryList(&pFCB->ParentListEntry);
+ ASSERT(IsListEmpty(&pFCB->ParentListHead));
}
BOOLEAN
@@ -455,6 +458,7 @@
/* Save old parent */
OldParent = Fcb->parentFcb;
+ RemoveEntryList(&Fcb->ParentListEntry);
/* Reinit FCB */
vfatInitFCBFromDirEntry(pVCB, Fcb, DirContext);
@@ -464,6 +468,7 @@
CcFlushCache(&Fcb->SectionObjectPointers, NULL, 0, NULL);
}
Fcb->parentFcb = ParentFcb;
+ InsertTailList(&ParentFcb->ParentListHead, &Fcb->ParentListEntry);
vfatAddFCBToTable(pVCB, Fcb);
/* If we moved across directories, dereference our old parent
@@ -673,6 +678,7 @@
vfatFCBInitializeCacheFromVolume(vcb, rcFCB);
}
rcFCB->parentFcb = directoryFCB;
+ InsertTailList(&directoryFCB->ParentListHead,
&rcFCB->ParentListEntry);
vfatAddFCBToTable(vcb, rcFCB);
*fileFCB = rcFCB;
Modified: trunk/reactos/drivers/filesystems/fastfat/finfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Sat Aug 6 08:30:30
2016
@@ -704,19 +704,17 @@
vfatSplitPathName(&NewName, &NewPath, &NewFile);
DPRINT("New dir: %wZ, New file: %wZ\n", &NewPath, &NewFile);
- /* FIXME: Do it in a more efficient way, like linking FCBs to their parent FCB so
that we browse less FCBs
- * Note: The FIXME is the way MS FastFAT seems to do it
- */
- if (vfatFCBIsDirectory(FCB))
+ if (vfatFCBIsDirectory(FCB) && !IsListEmpty(&FCB->ParentListHead))
{
PLIST_ENTRY Entry;
PVFATFCB VolFCB;
- for (Entry = DeviceExt->FcbListHead.Flink; Entry !=
&DeviceExt->FcbListHead; Entry = Entry->Flink)
- {
- VolFCB = CONTAINING_RECORD(Entry, VFATFCB, FcbListEntry);
- if (VolFCB->parentFcb == FCB && VolFCB->OpenHandleCount != 0)
- {
+ for (Entry = FCB->ParentListHead.Flink; Entry != &FCB->ParentListHead;
Entry = Entry->Flink)
+ {
+ VolFCB = CONTAINING_RECORD(Entry, VFATFCB, ParentListEntry);
+ if (VolFCB->OpenHandleCount != 0)
+ {
+ ASSERT(VolFCB->parentFCB == FCB);
DPRINT1("At least one children file opened! %wZ (%u, %u)\n",
&VolFCB->PathNameU, VolFCB->RefCount, VolFCB->OpenHandleCount);
Status = STATUS_ACCESS_DENIED;
ASSERT(OldReferences == FCB->parentFcb->RefCount);