[ros-diffs] [arty] 44181: Merge back to pierre-fsd, to keep track.

arty at svn.reactos.org arty at svn.reactos.org
Sun Nov 15 23:10:10 CET 2009


Author: arty
Date: Sun Nov 15 23:10:09 2009
New Revision: 44181

URL: http://svn.reactos.org/svn/reactos?rev=44181&view=rev
Log:
Merge back to pierre-fsd, to keep track.

Modified:
    branches/pierre-fsd/lib/rtl/generictable.c
    branches/pierre-fsd/ntoskrnl/fsrtl/largemcb.c

Modified: branches/pierre-fsd/lib/rtl/generictable.c
URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/lib/rtl/generictable.c?rev=44181&r1=44180&r2=44181&view=diff
==============================================================================
--- branches/pierre-fsd/lib/rtl/generictable.c [iso-8859-1] (original)
+++ branches/pierre-fsd/lib/rtl/generictable.c [iso-8859-1] Sun Nov 15 23:10:09 2009
@@ -134,6 +134,8 @@
     /* Get the splay links and table search result immediately */
     Result = RtlpFindGenericTableNodeOrParent(Table, Buffer, &NodeOrParent);
 
+	DPRINT1("Result %d\n", Result);
+
     /* Now call the routine to do the full insert */
     return RtlInsertElementGenericTableFull(Table,
                                             Buffer,
@@ -619,7 +621,7 @@
                                            IN OUT PVOID *RestartKey)
 {
     /* FIXME! */
-	return RtlEnumerateGenericTableWithoutSplayingAvl(Table, RestartKey);
+	return NULL;
 }
 
 /*
@@ -689,14 +691,7 @@
 	if(NodeOrParent) *NodeOrParent = OurNodeOrParent;
 	if(SearchResult) *SearchResult = OurSearchResult;
 
-	if(OurSearchResult == TableFoundNode)
-	{
-		RtlDeleteElementGenericTableAvl(Table, Buffer);
-		return RtlInsertElementGenericTableFullAvl
-			(Table, Buffer, BufferSize,
-			 NewElement, NodeOrParent, SearchResult);
-	}
-	else
+	if(OurSearchResult != TableFoundNode)
 	{
 		PRTL_BALANCED_LINKS NewNode =
 			Table->AllocateRoutine
@@ -711,8 +706,12 @@
 		OurNodeOrParent = NewNode;
 
 		avl_insert_node(Table, NewNode);
+		if (NewElement) *NewElement = TRUE;
 		return avl_data(NewNode);
 	}
+	
+	if (NewElement) *NewElement = FALSE;
+	return avl_data(OurNodeOrParent);
 }
 
 /*

Modified: branches/pierre-fsd/ntoskrnl/fsrtl/largemcb.c
URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/fsrtl/largemcb.c?rev=44181&r1=44180&r2=44181&view=diff
==============================================================================
--- branches/pierre-fsd/ntoskrnl/fsrtl/largemcb.c [iso-8859-1] (original)
+++ branches/pierre-fsd/ntoskrnl/fsrtl/largemcb.c [iso-8859-1] Sun Nov 15 23:10:09 2009
@@ -11,7 +11,7 @@
 /* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
-#define NDEBUG
+//#define NDEBUG
 #include <debug.h>
 
 /* GLOBALS *******************************************************************/
@@ -78,14 +78,19 @@
 
 	while (!NewElement)
 	{
+		DPRINT("Inserting %x:%x\n", Node.RunStartVbn.LowPart, Node.SectorCount.LowPart);
 		Existing = RtlInsertElementGenericTable
 			(Mcb->Mapping, &Node, sizeof(Node), &NewElement);
+		DPRINT("Existing %x\n", Existing);
 		if (!Existing) break;
 
+		DPRINT("NewElement %d\n", NewElement);
 		if (!NewElement)
 		{
 			// We merge the existing runs
 			LARGE_INTEGER StartVbn, FinalVbn;
+			DPRINT("Existing: %x:%x\n", 
+				   Existing->RunStartVbn.LowPart, Node.SectorCount.LowPart);
 			if (Existing->RunStartVbn.QuadPart < Node.RunStartVbn.QuadPart)
 			{
 				StartVbn = Existing->RunStartVbn;
@@ -95,6 +100,7 @@
 			{
 				StartVbn = Node.RunStartVbn;
 			}
+			DPRINT("StartVbn %x\n", StartVbn.LowPart);
 			if (Existing->RunStartVbn.QuadPart + Existing->SectorCount.QuadPart >
 				Node.RunStartVbn.QuadPart + Node.SectorCount.QuadPart)
 			{
@@ -106,6 +112,7 @@
 				FinalVbn.QuadPart =
 					Node.RunStartVbn.QuadPart + Node.SectorCount.QuadPart;
 			}
+			DPRINT("FinalVbn %x\n", FinalVbn.LowPart);
 			Node.RunStartVbn.QuadPart = StartVbn.QuadPart;
 			Node.SectorCount.QuadPart = FinalVbn.QuadPart - StartVbn.QuadPart;
 			RemoveHeadList(&Existing->Sequence);
@@ -114,12 +121,14 @@
 		}
 		else
 		{
+			DPRINT("Mapping added %x\n", Existing);
 			Mcb->MaximumPairCount++;
 			Mcb->PairCount++;
 			InsertHeadList(GET_LIST_HEAD(Mcb->Mapping), &Existing->Sequence);
 		}
 	}
 
+	DPRINT("!!Existing %d\n", !!Existing);
 	return !!Existing;
 }
 
@@ -135,7 +144,7 @@
 {
     BOOLEAN Result;
 
-	DPRINT1("Mcb %x Vbn %x Lbn %x SectorCount %x\n", Mcb, Vbn, Lbn, SectorCount);
+	DPRINT("Mcb %x Vbn %x Lbn %x SectorCount %x\n", Mcb, Vbn, Lbn, SectorCount);
 
     KeAcquireGuardedMutex(Mcb->GuardedMutex);
     Result = FsRtlAddBaseMcbEntry(&(Mcb->BaseMcb),
@@ -143,6 +152,8 @@
                                   Lbn,
                                   SectorCount);
     KeReleaseGuardedMutex(Mcb->GuardedMutex);
+
+	DPRINT("Done %d\n", Result);
 
     return Result;
 }
@@ -193,6 +204,8 @@
 {
     BOOLEAN Result;
 
+	DPRINT("FsRtlGetNextLargeMcbEntry Mcb %x RunIndex %x\n", Mcb, RunIndex);
+
     KeAcquireGuardedMutex(Mcb->GuardedMutex);
     Result = FsRtlGetNextBaseMcbEntry(&(Mcb->BaseMcb),
                                       RunIndex,
@@ -200,6 +213,8 @@
                                       Lbn,
                                       SectorCount);
     KeReleaseGuardedMutex(Mcb->GuardedMutex);
+
+	DPRINT("Done %d\n", Result);
 
     return Result;
 }
@@ -353,6 +368,8 @@
 {
     BOOLEAN Result;
 
+	DPRINT("FsRtlLookupLargeMcbEntry Mcb %x Vbn %x\n", Mcb, (ULONG)Vbn);
+
     KeAcquireGuardedMutex(Mcb->GuardedMutex);
     Result = FsRtlLookupBaseMcbEntry(&(Mcb->BaseMcb),
                                      Vbn,
@@ -363,6 +380,8 @@
                                      Index);
     KeReleaseGuardedMutex(Mcb->GuardedMutex);
 
+	DPRINT("Done %d\n", Result);
+
     return Result;
 }
 
@@ -411,6 +430,8 @@
                                      OUT PULONG Index)
 {
     BOOLEAN Result;
+
+	DPRINT("FsRtlLookupLastLargeMcbEntryAndIndex %x\n", OpaqueMcb);
 
     KeAcquireGuardedMutex(OpaqueMcb->GuardedMutex);
     Result = FsRtlLookupLastBaseMcbEntryAndIndex(&(OpaqueMcb->BaseMcb),
@@ -419,6 +440,8 @@
                                                  Index);
     KeReleaseGuardedMutex(OpaqueMcb->GuardedMutex);
 
+	DPRINT("Done %d\n", Result);
+
     return Result;
 }
 
@@ -457,6 +480,8 @@
                              OUT PLONGLONG Lbn)
 {
     BOOLEAN Result;
+
+	DPRINT("FsRtlLookupLastLargeMcbEntry Mcb %x\n", Mcb);
 
     KeAcquireGuardedMutex(Mcb->GuardedMutex);
     Result = FsRtlLookupLastBaseMcbEntry(&(Mcb->BaseMcb),
@@ -464,6 +489,8 @@
                                          Lbn);
     KeReleaseGuardedMutex(Mcb->GuardedMutex);
 
+	DPRINT("Done %d\n", Result);
+
     return Result;
 }
 
@@ -486,11 +513,15 @@
 FsRtlNumberOfRunsInLargeMcb(IN PLARGE_MCB Mcb)
 {
     ULONG NumberOfRuns;
+
+	DPRINT("FsRtlNumberOfRunsInLargeMcb Mcb %x\n", Mcb);
 
     /* Read the number of runs while holding the MCB lock */
     KeAcquireGuardedMutex(Mcb->GuardedMutex);
     NumberOfRuns = Mcb->BaseMcb.PairCount;
     KeReleaseGuardedMutex(Mcb->GuardedMutex);
+
+	DPRINT("Done %d\n", NumberOfRuns);
 
     /* Return the count */
     return NumberOfRuns;
@@ -600,11 +631,15 @@
                          IN LONGLONG Vbn,
                          IN LONGLONG SectorCount)
 {
+	DPRINT("FsRtlRemoveLargeMcbEntry Mcb %x, Vbn %x, SectorCount %x\n", Mcb, (ULONG)Vbn, (ULONG)SectorCount);
+
     KeAcquireGuardedMutex(Mcb->GuardedMutex);
     FsRtlRemoveBaseMcbEntry(&(Mcb->BaseMcb),
                             Vbn,
                             SectorCount);
     KeReleaseGuardedMutex(Mcb->GuardedMutex);
+
+	DPRINT("Done\n");
 }
 
 /*
@@ -656,14 +691,18 @@
 	LARGE_MCB_MAPPING_ENTRY Reimagined;
 	PLARGE_MCB_MAPPING_ENTRY Found = NULL;
 
+	DPRINT("McbBump %x (%x:%x)\n", Mcb, FixedPart->RunStartVbn.LowPart, FixedPart->SectorCount.LowPart);
+
 	Reimagined = *FixedPart;
 	while ((Found = RtlLookupElementGenericTable(Mcb->Mapping, &Reimagined)))
 	{
 		Reimagined = *Found;
 		Reimagined.RunStartVbn.QuadPart = 
 			FixedPart->RunStartVbn.QuadPart + FixedPart->SectorCount.QuadPart;
-	}
-
+		DPRINT("Reimagined %x\n", Reimagined.RunStartVbn.LowPart);
+	}
+
+	DPRINT("Found %x\n", Found);
 	if (!Found) return MCB_BUMP_NO_MORE;
 	DPRINT1
 		("Moving %x-%x to %x because %x-%x overlaps\n",
@@ -674,6 +713,8 @@
 		 Reimagined.RunStartVbn.LowPart + Reimagined.SectorCount.LowPart);
 	Found->RunStartVbn.QuadPart = Reimagined.RunStartVbn.QuadPart + Reimagined.SectorCount.QuadPart;
 	Found->StartingLbn.QuadPart = Reimagined.StartingLbn.QuadPart + Reimagined.SectorCount.QuadPart;
+
+	DPRINT("Again\n");
 	return MCB_BUMP_AGAIN;
 }
 
@@ -713,7 +754,12 @@
 		
 		Node = UpperPart;
 
-		while ((Result = McbBump(Mcb, &Node)) == MCB_BUMP_AGAIN);
+		DPRINT("Loop: %x\n", Node.RunStartVbn.LowPart);
+		while ((Result = McbBump(Mcb, &Node)) == MCB_BUMP_AGAIN)
+		{
+			DPRINT("Node: %x\n", Node.RunStartVbn.LowPart);
+		}
+		DPRINT("Done\n");
 
 		if (Result == MCB_BUMP_NO_MORE)
 		{
@@ -744,6 +790,8 @@
 			return Result == MCB_BUMP_NO_MORE;
 		}
 	}
+
+	DPRINT("Done\n");
 	
 	return TRUE;
 }
@@ -758,6 +806,8 @@
                    IN LONGLONG Amount)
 {
     BOOLEAN Result;
+
+	DPRINT("FsRtlSplitLargeMcb %x, Vbn %x, Amount %x\n", Mcb, (ULONG)Vbn, (ULONG)Amount);
 
     KeAcquireGuardedMutex(Mcb->GuardedMutex);
     Result = FsRtlSplitBaseMcb(&(Mcb->BaseMcb),
@@ -765,6 +815,8 @@
                                Amount);
     KeReleaseGuardedMutex(Mcb->GuardedMutex);
 
+	DPRINT("Done %d\n", Result);
+
     return Result;
 }
 
@@ -803,10 +855,12 @@
 FsRtlTruncateLargeMcb(IN PLARGE_MCB Mcb,
                       IN LONGLONG Vbn)
 {
+	DPRINT("FsRtlTruncateLargeMcb %x Vbn %x\n", Mcb, (ULONG)Vbn);
     KeAcquireGuardedMutex(Mcb->GuardedMutex);
     FsRtlTruncateBaseMcb(&(Mcb->BaseMcb),
                          Vbn);
     KeReleaseGuardedMutex(Mcb->GuardedMutex);
+	DPRINT("Done\n");
 }
 
 /*




More information about the Ros-diffs mailing list