Author: pschweitzer
Date: Mon May 18 19:51:14 2015
New Revision: 67824
URL:
http://svn.reactos.org/svn/reactos?rev=67824&view=rev
Log:
[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).
Modified:
trunk/reactos/drivers/filesystems/fastfat/fastio.c
trunk/reactos/drivers/filesystems/fastfat/finfo.c
trunk/reactos/drivers/filesystems/fastfat/vfat.h
Modified: trunk/reactos/drivers/filesystems/fastfat/fastio.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/fastio.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fastio.c [iso-8859-1] Mon May 18 19:51:14
2015
@@ -1,9 +1,10 @@
/*
- * FILE: drivers/fs/vfat/fastio.c
+ * FILE: drivers/filesystems/fastfat/fastio.c
* PURPOSE: Fast IO routines.
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PROGRAMMER: Herve Poussineau (hpoussin(a)reactos.org)
+ * Pierre Schweitzer (pierre(a)reactos.org)
*/
#include "vfat.h"
@@ -111,15 +112,51 @@
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject)
{
+ NTSTATUS Status;
+ PVFATFCB FCB = NULL;
+ BOOLEAN Success = FALSE;
+ ULONG BufferLength = sizeof(FILE_BASIC_INFORMATION);
+
DPRINT("VfatFastIoQueryBasicInfo()\n");
- UNREFERENCED_PARAMETER(FileObject);
- UNREFERENCED_PARAMETER(Wait);
- UNREFERENCED_PARAMETER(Buffer);
- UNREFERENCED_PARAMETER(IoStatus);
- 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 = 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;
@@ -134,15 +171,51 @@
OUT PIO_STATUS_BLOCK IoStatus,
IN PDEVICE_OBJECT DeviceObject)
{
- DPRINT("VfatFastIoQueryStandardInfo\n");
-
- UNREFERENCED_PARAMETER(FileObject);
- UNREFERENCED_PARAMETER(Wait);
- UNREFERENCED_PARAMETER(Buffer);
- UNREFERENCED_PARAMETER(IoStatus);
- UNREFERENCED_PARAMETER(DeviceObject);
-
- return FALSE;
+ NTSTATUS Status;
+ PVFATFCB FCB = NULL;
+ BOOLEAN Success = FALSE;
+ ULONG BufferLength = sizeof(FILE_STANDARD_INFORMATION);
+
+ DPRINT("VfatFastIoQueryStandardInfo()\n");
+
+ UNREFERENCED_PARAMETER(DeviceObject);
+
+ 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;
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] Mon May 18 19:51:14
2015
@@ -71,7 +71,6 @@
/*
* FUNCTION: Retrieve the standard file information
*/
-static
NTSTATUS
VfatGetStandardInformation(
PVFATFCB FCB,
@@ -236,7 +235,6 @@
return STATUS_SUCCESS;
}
-static
NTSTATUS
VfatGetBasicInformation(
PFILE_OBJECT FileObject,
Modified: trunk/reactos/drivers/filesystems/fastfat/vfat.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/vfat.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/vfat.h [iso-8859-1] Mon May 18 19:51:14
2015
@@ -875,6 +875,20 @@
/* 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
VfatQueryInformation(
PVFAT_IRP_CONTEXT IrpContext);