Author: pschweitzer
Date: Tue Nov 23 20:05:33 2010
New Revision: 49759
URL: http://svn.reactos.org/svn/reactos?rev=49759&view=rev
Log:
[NTOSKRNL]
Forgotten comments...
Modified:
trunk/reactos/ntoskrnl/fsrtl/filtrctx.c
Modified: trunk/reactos/ntoskrnl/fsrtl/filtrctx.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/filtrctx.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/filtrctx.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/filtrctx.c [iso-8859-1] Tue Nov 23 20:05:33 2010
@@ -187,31 +187,39 @@
return STATUS_INVALID_DEVICE_REQUEST;
}
+ /* Get filter contexts */
FOContext = IoGetFileObjectFilterContext(FileObject);
if (!FOContext)
{
+ /* If there's none, allocate new structure */
FOContext = ExAllocatePoolWithTag(NonPagedPool, sizeof(FILE_OBJECT_FILTER_CONTEXTS), 'FOCX');
if (!FOContext)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
+ /* Initialize it */
ExInitializeFastMutex(&(FOContext->FilterContextsMutex));
InitializeListHead(&(FOContext->FilterContexts));
+ /* Set it */
if (!IoChangeFileObjectFilterContext(FileObject, FOContext, TRUE))
{
+ /* If it fails, it means that someone else has set it in the meanwhile */
ExFreePoolWithTag(FOContext, 'FOCX');
+ /* So, we can get it */
FOContext = IoGetFileObjectFilterContext(FileObject);
if (!FOContext)
{
+ /* If we fall down here, something went very bad. This shouldn't happen */
ASSERT(FALSE);
return STATUS_UNSUCCESSFUL;
}
}
}
+ /* Finally, insert */
ExAcquireFastMutex(&(FOContext->FilterContextsMutex));
InsertHeadList(&(FOContext->FilterContexts), &(Ptr->Links));
ExReleaseFastMutex(&(FOContext->FilterContextsMutex));
Author: sir_richard
Date: Tue Nov 23 17:29:40 2010
New Revision: 49756
URL: http://svn.reactos.org/svn/reactos?rev=49756&view=rev
Log:
[FREELDR]: For *every single heap allocation*, there was code to request an entire *heap statistic run*! This is ridiculous and slows heap allocations tremendously. Additionally, it also assumes bstats was linked in, which it might not be if the flag wasn't set in bheap.c. Only enable this code if a special MM_DBG define is set.
[FREELDR]: Done originally for ARM, but I think x86 will appreciate the benefit too (and x86 can now go ahead and disable all those ridiculous debug settings that are turned on by default in bheap.c).
Modified:
trunk/reactos/boot/freeldr/freeldr/mm/mm.c
Modified: trunk/reactos/boot/freeldr/freeldr/mm/mm.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/mm…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/mm/mm.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/mm/mm.c [iso-8859-1] Tue Nov 23 17:29:40 2010
@@ -85,7 +85,6 @@
PVOID MmHeapAlloc(ULONG MemorySize)
{
PVOID Result;
- LONG CurAlloc, TotalFree, MaxFree, NumberOfGets, NumberOfRels;
if (MemorySize > MM_PAGE_SIZE)
{
@@ -99,13 +98,17 @@
{
DPRINTM(DPRINT_MEMORY, "Heap allocation for %d bytes failed\n", MemorySize);
}
-
- // Gather some stats
- bstats(&CurAlloc, &TotalFree, &MaxFree, &NumberOfGets, &NumberOfRels);
-
- DPRINTM(DPRINT_MEMORY, "Current alloced %d bytes, free %d bytes, allocs %d, frees %d\n",
- CurAlloc, TotalFree, NumberOfGets, NumberOfRels);
-
+#if MM_DBG
+ {
+ LONG CurAlloc, TotalFree, MaxFree, NumberOfGets, NumberOfRels;
+
+ // Gather some stats
+ bstats(&CurAlloc, &TotalFree, &MaxFree, &NumberOfGets, &NumberOfRels);
+
+ DPRINTM(DPRINT_MEMORY, "Current alloced %d bytes, free %d bytes, allocs %d, frees %d\n",
+ CurAlloc, TotalFree, NumberOfGets, NumberOfRels);
+ }
+#endif
return Result;
}