Author: pschweitzer
Date: Sun Sep 24 09:50:36 2017
New Revision: 75938
URL:
http://svn.reactos.org/svn/reactos?rev=75938&view=rev
Log:
[FASTFAT]
Implement statistics counting for create operations.
Modified:
trunk/reactos/drivers/filesystems/fastfat/create.c
trunk/reactos/drivers/filesystems/fastfat/vfat.h
Modified: trunk/reactos/drivers/filesystems/fastfat/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] Sun Sep 24 09:50:36
2017
@@ -468,6 +468,8 @@
return STATUS_CANNOT_DELETE;
}
+ vfatAddToStat(DeviceExt, Fat.CreateHits, 1);
+
pFcb = DeviceExt->VolumeFcb;
if (pFcb->OpenHandleCount == 0)
@@ -486,6 +488,7 @@
FALSE);
if (!NT_SUCCESS(Status))
{
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return Status;
}
}
@@ -493,6 +496,7 @@
vfatAttachFCBToFileObject(DeviceExt, pFcb, FileObject);
DeviceExt->OpenHandleCount++;
pFcb->OpenHandleCount++;
+ vfatAddToStat(DeviceExt, Fat.SuccessfulCreates, 1);
Irp->IoStatus.Information = FILE_OPENED;
return STATUS_SUCCESS;
@@ -566,12 +570,16 @@
/* Try opening the file. */
if (!OpenTargetDir)
{
+ vfatAddToStat(DeviceExt, Fat.CreateHits, 1);
+
Status = VfatOpenFile(DeviceExt, &PathNameU, FileObject,
RequestedDisposition, RequestedOptions, &ParentFcb);
}
else
{
PVFATFCB TargetFcb;
LONG idx, FileNameLen;
+
+ vfatAddToStat(DeviceExt, Fat.CreateHits, 1);
ParentFcb = (FileObject->RelatedFileObject != NULL) ?
FileObject->RelatedFileObject->FsContext : NULL;
if (ParentFcb)
@@ -654,6 +662,7 @@
if (!NT_SUCCESS(Status))
{
VfatCloseFile(DeviceExt, FileObject);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return Status;
}
}
@@ -670,6 +679,15 @@
else if (ParentFcb != NULL)
{
vfatReleaseFCB(DeviceExt, ParentFcb);
+ }
+
+ if (NT_SUCCESS(Status))
+ {
+ vfatAddToStat(DeviceExt, Fat.SuccessfulCreates, 1);
+ }
+ else
+ {
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
}
return Status;
@@ -689,12 +707,14 @@
{
vfatReleaseFCB(DeviceExt, ParentFcb);
}
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return Status;
}
if (!NT_SUCCESS(Status) && ParentFcb == NULL)
{
DPRINT1("VfatOpenFile failed for '%wZ', status %x\n",
&PathNameU, Status);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return Status;
}
@@ -712,6 +732,7 @@
if (TrailingBackslash)
{
vfatReleaseFCB(DeviceExt, ParentFcb);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return STATUS_OBJECT_NAME_INVALID;
}
Attributes |= FILE_ATTRIBUTE_ARCHIVE;
@@ -726,6 +747,7 @@
if (!NT_SUCCESS(Status))
{
vfatReleaseFCB(DeviceExt, pFcb);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return Status;
}
@@ -745,12 +767,14 @@
}
else
{
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return Status;
}
}
else
{
vfatReleaseFCB(DeviceExt, ParentFcb);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return Status;
}
}
@@ -769,9 +793,11 @@
VfatCloseFile(DeviceExt, FileObject);
if (TrailingBackslash && !vfatFCBIsDirectory(pFcb))
{
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return STATUS_OBJECT_NAME_INVALID;
}
Irp->IoStatus.Information = FILE_EXISTS;
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return STATUS_OBJECT_NAME_COLLISION;
}
@@ -785,6 +811,7 @@
if (!NT_SUCCESS(Status))
{
VfatCloseFile(DeviceExt, FileObject);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return Status;
}
}
@@ -796,17 +823,20 @@
vfatFCBIsDirectory(pFcb))
{
VfatCloseFile (DeviceExt, FileObject);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return STATUS_FILE_IS_A_DIRECTORY;
}
if (BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE) &&
!vfatFCBIsDirectory(pFcb))
{
VfatCloseFile (DeviceExt, FileObject);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return STATUS_NOT_A_DIRECTORY;
}
if (TrailingBackslash && !vfatFCBIsDirectory(pFcb))
{
VfatCloseFile (DeviceExt, FileObject);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return STATUS_OBJECT_NAME_INVALID;
}
#ifndef USE_ROS_CC_AND_FS
@@ -823,6 +853,7 @@
DPRINT1("%d %d %d\n",
Stack->Parameters.Create.SecurityContext->DesiredAccess & FILE_WRITE_DATA,
RequestedDisposition == FILE_OVERWRITE, RequestedDisposition
== FILE_OVERWRITE_IF);
VfatCloseFile (DeviceExt, FileObject);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return (BooleanFlagOn(RequestedOptions, FILE_DELETE_ON_CLOSE)) ?
STATUS_CANNOT_DELETE
:
STATUS_SHARING_VIOLATION;
}
@@ -844,6 +875,7 @@
if(!BooleanFlagOn(pFcb->Flags, FCB_IS_PAGE_FILE))
{
VfatCloseFile(DeviceExt, FileObject);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return STATUS_INVALID_PARAMETER;
}
}
@@ -857,6 +889,7 @@
if (BooleanFlagOn(pFcb->Flags, FCB_IS_PAGE_FILE))
{
VfatCloseFile(DeviceExt, FileObject);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return STATUS_INVALID_PARAMETER;
}
}
@@ -881,6 +914,7 @@
if (!NT_SUCCESS (Status))
{
VfatCloseFile(DeviceExt, FileObject);
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
return Status;
}
}
@@ -938,6 +972,15 @@
/* FIXME : test write access if requested */
+ if (NT_SUCCESS(Status))
+ {
+ vfatAddToStat(DeviceExt, Fat.SuccessfulCreates, 1);
+ }
+ else
+ {
+ vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
+ }
+
return Status;
}
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] Sun Sep 24 09:50:36
2017
@@ -602,6 +602,12 @@
return BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX);
}
+#define vfatAddToStat(Vcb, Stat, Inc)
\
+{
\
+ PSTATISTICS Stats = &(Vcb)->Statistics[KeGetCurrentProcessorNumber() %
VfatGlobalData->NumberProcessors]; \
+ Stats->Stat += Inc;
\
+}
+
/* blockdev.c */
NTSTATUS