[FASTFAT]

Implement support for FastIO for:
- FastIoQueryBasicInfo
- FastIoQueryStandardInfo

Now, with this commit and the two previous, ReactOS won't attempt to issue an IRP for these query, but will directly go with the FastIO path.
The performance improvement is really visible in 1st stage (at least, here with VBox).

svn path=/trunk/; revision=67824
This commit is contained in:
Pierre Schweitzer 2015-05-18 19:51:14 +00:00
parent 30c11d7825
commit 4f7de22ae4
3 changed files with 100 additions and 15 deletions

View file

@ -1,9 +1,10 @@
/* /*
* FILE: drivers/fs/vfat/fastio.c * FILE: drivers/filesystems/fastfat/fastio.c
* PURPOSE: Fast IO routines. * PURPOSE: Fast IO routines.
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* PROGRAMMER: Herve Poussineau (hpoussin@reactos.org) * PROGRAMMER: Herve Poussineau (hpoussin@reactos.org)
* Pierre Schweitzer (pierre@reactos.org)
*/ */
#include "vfat.h" #include "vfat.h"
@ -111,15 +112,51 @@ VfatFastIoQueryBasicInfo(
OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject) IN PDEVICE_OBJECT DeviceObject)
{ {
NTSTATUS Status;
PVFATFCB FCB = NULL;
BOOLEAN Success = FALSE;
ULONG BufferLength = sizeof(FILE_BASIC_INFORMATION);
DPRINT("VfatFastIoQueryBasicInfo()\n"); DPRINT("VfatFastIoQueryBasicInfo()\n");
UNREFERENCED_PARAMETER(FileObject); FCB = (PVFATFCB)FileObject->FsContext;
UNREFERENCED_PARAMETER(Wait); if (FCB == NULL)
UNREFERENCED_PARAMETER(Buffer); {
UNREFERENCED_PARAMETER(IoStatus); return FALSE;
UNREFERENCED_PARAMETER(DeviceObject); }
return FALSE; FsRtlEnterFileSystem();
if (!(FCB->Flags & FCB_IS_PAGE_FILE))
{
if (!ExAcquireResourceSharedLite(&FCB->MainResource, Wait))
{
FsRtlExitFileSystem();
return FALSE;
}
}
Status = VfatGetBasicInformation(FileObject,
FCB,
DeviceObject,
Buffer,
&BufferLength);
if (!(FCB->Flags & FCB_IS_PAGE_FILE))
{
ExReleaseResourceLite(&FCB->MainResource);
}
if (NT_SUCCESS(Status))
{
IoStatus->Status = STATUS_SUCCESS;
IoStatus->Information = sizeof(FILE_BASIC_INFORMATION) - BufferLength;
Success = TRUE;
}
FsRtlExitFileSystem();
return Success;
} }
static FAST_IO_QUERY_STANDARD_INFO VfatFastIoQueryStandardInfo; static FAST_IO_QUERY_STANDARD_INFO VfatFastIoQueryStandardInfo;
@ -134,15 +171,51 @@ VfatFastIoQueryStandardInfo(
OUT PIO_STATUS_BLOCK IoStatus, OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject) IN PDEVICE_OBJECT DeviceObject)
{ {
DPRINT("VfatFastIoQueryStandardInfo\n"); NTSTATUS Status;
PVFATFCB FCB = NULL;
BOOLEAN Success = FALSE;
ULONG BufferLength = sizeof(FILE_STANDARD_INFORMATION);
DPRINT("VfatFastIoQueryStandardInfo()\n");
UNREFERENCED_PARAMETER(FileObject);
UNREFERENCED_PARAMETER(Wait);
UNREFERENCED_PARAMETER(Buffer);
UNREFERENCED_PARAMETER(IoStatus);
UNREFERENCED_PARAMETER(DeviceObject); UNREFERENCED_PARAMETER(DeviceObject);
return FALSE; FCB = (PVFATFCB)FileObject->FsContext;
if (FCB == NULL)
{
return FALSE;
}
FsRtlEnterFileSystem();
if (!(FCB->Flags & FCB_IS_PAGE_FILE))
{
if (!ExAcquireResourceSharedLite(&FCB->MainResource, Wait))
{
FsRtlExitFileSystem();
return FALSE;
}
}
Status = VfatGetStandardInformation(FCB,
Buffer,
&BufferLength);
if (!(FCB->Flags & FCB_IS_PAGE_FILE))
{
ExReleaseResourceLite(&FCB->MainResource);
}
if (NT_SUCCESS(Status))
{
IoStatus->Status = STATUS_SUCCESS;
IoStatus->Information = sizeof(FILE_STANDARD_INFORMATION) - BufferLength;
Success = TRUE;
}
FsRtlExitFileSystem();
return Success;
} }
static FAST_IO_LOCK VfatFastIoLock; static FAST_IO_LOCK VfatFastIoLock;

View file

@ -71,7 +71,6 @@ const char* FileInformationClassNames[] =
/* /*
* FUNCTION: Retrieve the standard file information * FUNCTION: Retrieve the standard file information
*/ */
static
NTSTATUS NTSTATUS
VfatGetStandardInformation( VfatGetStandardInformation(
PVFATFCB FCB, PVFATFCB FCB,
@ -236,7 +235,6 @@ VfatSetBasicInformation(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
static
NTSTATUS NTSTATUS
VfatGetBasicInformation( VfatGetBasicInformation(
PFILE_OBJECT FileObject, PFILE_OBJECT FileObject,

View file

@ -874,6 +874,20 @@ vfatMakeFCBFromDirEntry(
/* finfo.c */ /* finfo.c */
NTSTATUS
VfatGetStandardInformation(
PVFATFCB FCB,
PFILE_STANDARD_INFORMATION StandardInfo,
PULONG BufferLength);
NTSTATUS
VfatGetBasicInformation(
PFILE_OBJECT FileObject,
PVFATFCB FCB,
PDEVICE_OBJECT DeviceObject,
PFILE_BASIC_INFORMATION BasicInfo,
PULONG BufferLength);
NTSTATUS NTSTATUS
VfatQueryInformation( VfatQueryInformation(
PVFAT_IRP_CONTEXT IrpContext); PVFAT_IRP_CONTEXT IrpContext);