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