From 3902874ac93fe40685d9761f46a96358ba24f24c Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Tue, 11 Jun 2019 11:51:20 -0700 Subject: [PATCH] dll: FspFileSystemStartDispatcher Change default number of threads when ThreadCount==0 is passed. New min DEFAULT number of threads is 4 and new max DEFAULT number of threads is 16. The absolute minimum number of threads that any file system dispatcher has remains 2. --- src/dll/fs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dll/fs.c b/src/dll/fs.c index 43b20d747..cb23889cb 100644 --- a/src/dll/fs.c +++ b/src/dll/fs.c @@ -24,6 +24,8 @@ enum { FspFileSystemDispatcherThreadCountMin = 2, + FspFileSystemDispatcherDefaultThreadCountMin = 4, + FspFileSystemDispatcherDefaultThreadCountMax = 16, }; static FSP_FILE_SYSTEM_INTERFACE FspFileSystemNullInterface; @@ -636,6 +638,11 @@ FSP_API NTSTATUS FspFileSystemStartDispatcher(FSP_FILE_SYSTEM *FileSystem, ULONG for (ThreadCount = 0; 0 != ProcessMask; ProcessMask >>= 1) ThreadCount += ProcessMask & 1; + + if (ThreadCount < FspFileSystemDispatcherDefaultThreadCountMin) + ThreadCount = FspFileSystemDispatcherDefaultThreadCountMin; + else if (ThreadCount > FspFileSystemDispatcherDefaultThreadCountMax) + ThreadCount = FspFileSystemDispatcherDefaultThreadCountMax; } if (ThreadCount < FspFileSystemDispatcherThreadCountMin)