-/* $Id: copy.c,v 1.30 2004/08/15 16:38:59 chorns Exp $
+/* $Id: copy.c,v 1.31 2004/08/25 15:08:28 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
static PFN_TYPE CcZeroPage = 0;
#define MAX_ZERO_LENGTH (256 * 1024)
-#define MAX_RW_LENGTH (64 * 1024)
+#define MAX_RW_LENGTH (256 * 1024)
#if defined(__GNUC__)
void * alloca(size_t size);
*/
current2 = current;
current_size = 0;
- while (current2 != NULL && !current2->Valid)
+ while (current2 != NULL && !current2->Valid && current_size < MAX_RW_LENGTH)
{
current2 = current2->NextInChain;
current_size += Bcb->CacheSegmentSize;
MmInitializeMdl(Mdl, NULL, current_size);
Mdl->MdlFlags |= (MDL_PAGES_LOCKED | MDL_IO_PAGE_READ);
current2 = current;
+ current_size = 0;
MdlPages = (PPFN_TYPE)(Mdl + 1);
- while (current2 != NULL && !current2->Valid)
+ while (current2 != NULL && !current2->Valid && current_size < MAX_RW_LENGTH)
{
PVOID address = current2->BaseAddress;
for (i = 0; i < (Bcb->CacheSegmentSize / PAGE_SIZE); i++, address += PAGE_SIZE)
*MdlPages++ = MmGetPfnForProcess(NULL, address);
}
current2 = current2->NextInChain;
+ current_size += Bcb->CacheSegmentSize;
}
/*
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Status = Iosb.Status;
}
- MmUnmapLockedPages(Mdl->MappedSystemVa, Mdl);
+ if (Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA)
+ {
+ MmUnmapLockedPages(Mdl->MappedSystemVa, Mdl);
+ }
if (!NT_SUCCESS(Status) && Status != STATUS_END_OF_FILE)
{
while (current != NULL)
}
return(Status);
}
- while (current != NULL && !current->Valid)
+ current_size = 0;
+ while (current != NULL && !current->Valid && current_size < MAX_RW_LENGTH)
{
previous = current;
current = current->NextInChain;
#endif
Length = Length - TempLength;
CcRosReleaseCacheSegment(Bcb, previous, TRUE, FALSE, FALSE);
+ current_size += Bcb->CacheSegmentSize;
}
}
}