1
0

Try to fix slowness

This commit is contained in:
Scott E. Graves
2017-03-23 08:32:21 -05:00
parent 02ae20e806
commit 4a2784aae6

View File

@@ -134,7 +134,6 @@ private:
ULONG CreateOptions,
PDOKAN_FILE_INFO DokanFileInfo)
{
std::lock_guard<std::mutex> l(_dokanMutex);
SECURITY_ATTRIBUTES securityAttrib;
securityAttrib.nLength = sizeof(securityAttrib);
securityAttrib.lpSecurityDescriptor = SecurityContext->AccessState.SecurityDescriptor;
@@ -354,6 +353,7 @@ private:
// TODO Detect if file is read-only
// TODO Quick hash to detect changes
ofi.ReadOnly = false;
std::lock_guard<std::mutex> l(_dokanMutex);
_openFileMap.insert({ DokanFileInfo->Context, ofi });
/*if (creationDisposition == OPEN_ALWAYS ||
@@ -389,7 +389,6 @@ private:
static NTSTATUS DOKAN_CALLBACK Sia_FindFiles(LPCWSTR FileName, PFillFindData FillFindData, PDOKAN_FILE_INFO DokanFileInfo)
{
std::lock_guard<std::mutex> l(_dokanMutex);
auto siaFileTree = _siaFileTree;
if (siaFileTree)
{
@@ -451,7 +450,6 @@ private:
static void DOKAN_CALLBACK Sia_CloseFile(LPCWSTR FileName, PDOKAN_FILE_INFO DokanFileInfo)
{
std::lock_guard<std::mutex> l(_dokanMutex);
ULONG64 id = DokanFileInfo->Context;
if (id)
{
@@ -473,6 +471,8 @@ private:
{
QueueUploadIfChanged(id, li.QuadPart);
}
std::lock_guard<std::mutex> l(_dokanMutex);
_openFileMap.erase(id);
}
@@ -875,7 +875,7 @@ public:
ZeroMemory(&_dokanOptions, sizeof(DOKAN_OPTIONS));
_dokanOptions.Version = DOKAN_VERSION;
_dokanOptions.ThreadCount = 4; // use default
_dokanOptions.ThreadCount = 0; // use default
_dokanOptions.Options = DOKAN_OPTION_DEBUG;
}
@@ -902,6 +902,7 @@ public:
{
while (!DokanRemoveMountPoint(&_mountPoint[0]))
::Sleep(1000);
_uploadManager.reset(nullptr);
// HACK - DokanMain() never returns
::TerminateThread(_mountThread->native_handle(), -1);
_mountThread->join();
@@ -914,7 +915,6 @@ public:
{
StopFileListThread();
Unmount();
_uploadManager.reset(nullptr);
_siaApi = nullptr;
_siaDriveConfig = nullptr;
ZeroMemory(&_dokanOps, sizeof(_dokanOps));