Split the OS cache settings into Disk IO read/write modes

Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
This commit is contained in:
summer
2022-07-13 17:16:23 +08:00
committed by Chocobo1
parent 4f1684c714
commit 5b730ffb72
6 changed files with 126 additions and 33 deletions

View File

@@ -121,6 +121,13 @@ namespace BitTorrent
};
Q_ENUM_NS(ChokingAlgorithm)
enum class DiskIOReadMode : int
{
DisableOSCache = 0,
EnableOSCache = 1
};
Q_ENUM_NS(DiskIOReadMode)
enum class DiskIOType : int
{
Default = 0,
@@ -129,6 +136,16 @@ namespace BitTorrent
};
Q_ENUM_NS(DiskIOType)
enum class DiskIOWriteMode : int
{
DisableOSCache = 0,
EnableOSCache = 1,
#ifdef QBT_USES_LIBTORRENT2
WriteThrough = 2
#endif
};
Q_ENUM_NS(DiskIOWriteMode)
enum class MixedModeAlgorithm : int
{
TCP = 0,
@@ -359,8 +376,10 @@ namespace BitTorrent
void setDiskQueueSize(qint64 size);
DiskIOType diskIOType() const;
void setDiskIOType(DiskIOType type);
bool useOSCache() const;
void setUseOSCache(bool use);
DiskIOReadMode diskIOReadMode() const;
void setDiskIOReadMode(DiskIOReadMode mode);
DiskIOWriteMode diskIOWriteMode() const;
void setDiskIOWriteMode(DiskIOWriteMode mode);
bool isCoalesceReadWriteEnabled() const;
void setCoalesceReadWriteEnabled(bool enabled);
bool usePieceExtentAffinity() const;
@@ -687,7 +706,8 @@ namespace BitTorrent
CachedSettingValue<int> m_diskCacheTTL;
CachedSettingValue<qint64> m_diskQueueSize;
CachedSettingValue<DiskIOType> m_diskIOType;
CachedSettingValue<bool> m_useOSCache;
CachedSettingValue<DiskIOReadMode> m_diskIOReadMode;
CachedSettingValue<DiskIOWriteMode> m_diskIOWriteMode;
CachedSettingValue<bool> m_coalesceReadWriteEnabled;
CachedSettingValue<bool> m_usePieceExtentAffinity;
CachedSettingValue<bool> m_isSuggestMode;