mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Enabling Windows disk cache (and adding option to disable it) to prevent a relatively prevalent ERROR_INVALID_PARAMETER.
From my test only the write cache was the culprit, if this can be confirmed the read cache can be disabled by default if that has a benefit. (Other systems are unchanged.)
This commit is contained in:
parent
b2b959d5e3
commit
31ffbb1edd
@ -13,7 +13,7 @@
|
|||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
|
||||||
enum AdvSettingsCols {PROPERTY, VALUE};
|
enum AdvSettingsCols {PROPERTY, VALUE};
|
||||||
enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, NETWORK_ADDRESS, PROGRAM_NOTIFICATIONS, TRACKER_STATUS, TRACKER_PORT,
|
enum AdvSettingsRows {DISK_CACHE, OS_WRITE_CACHE, OS_READ_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_LIMIT_LAN, RECHECK_COMPLETED, LIST_REFRESH, RESOLVE_COUNTRIES, RESOLVE_HOSTS, MAX_HALF_OPEN, SUPER_SEEDING, NETWORK_IFACE, NETWORK_ADDRESS, PROGRAM_NOTIFICATIONS, TRACKER_STATUS, TRACKER_PORT,
|
||||||
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
|
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
|
||||||
UPDATE_CHECK,
|
UPDATE_CHECK,
|
||||||
#endif
|
#endif
|
||||||
@ -29,7 +29,7 @@ class AdvancedSettings: public QTableWidget {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QSpinBox spin_cache, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port;
|
QSpinBox spin_cache, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port;
|
||||||
QCheckBox cb_ignore_limits_lan, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts,
|
QCheckBox cb_write_cache, cb_read_cache, cb_ignore_limits_lan, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts,
|
||||||
cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion,
|
cb_super_seeding, cb_program_notifications, cb_tracker_status, cb_confirm_torrent_deletion,
|
||||||
cb_enable_tracker_ext;
|
cb_enable_tracker_ext;
|
||||||
QComboBox combo_iface;
|
QComboBox combo_iface;
|
||||||
@ -67,6 +67,8 @@ public slots:
|
|||||||
Preferences pref;
|
Preferences pref;
|
||||||
// Disk write cache
|
// Disk write cache
|
||||||
pref.setDiskCacheSize(spin_cache.value());
|
pref.setDiskCacheSize(spin_cache.value());
|
||||||
|
pref.disableOSWriteCache(cb_write_cache.isChecked());
|
||||||
|
pref.disableOSReadCache(cb_read_cache.isChecked());
|
||||||
// Outgoing ports
|
// Outgoing ports
|
||||||
pref.setOutgoingPortsMin(outgoing_ports_min.value());
|
pref.setOutgoingPortsMin(outgoing_ports_min.value());
|
||||||
pref.setOutgoingPortsMax(outgoing_ports_max.value());
|
pref.setOutgoingPortsMax(outgoing_ports_max.value());
|
||||||
@ -159,6 +161,12 @@ private slots:
|
|||||||
spin_cache.setValue(pref.diskCacheSize());
|
spin_cache.setValue(pref.diskCacheSize());
|
||||||
spin_cache.setSuffix(tr(" MiB"));
|
spin_cache.setSuffix(tr(" MiB"));
|
||||||
setRow(DISK_CACHE, tr("Disk write cache size"), &spin_cache);
|
setRow(DISK_CACHE, tr("Disk write cache size"), &spin_cache);
|
||||||
|
// OS write cache
|
||||||
|
cb_write_cache.setChecked(pref.disableOSWriteCache());
|
||||||
|
setRow(OS_WRITE_CACHE, tr("Disable OS caching of disk writes"), &cb_write_cache);
|
||||||
|
// OS read cache
|
||||||
|
cb_read_cache.setChecked(pref.disableOSReadCache());
|
||||||
|
setRow(OS_READ_CACHE, tr("Disable OS caching of disk reads"), &cb_read_cache);
|
||||||
// Outgoing port Min
|
// Outgoing port Min
|
||||||
outgoing_ports_min.setMinimum(0);
|
outgoing_ports_min.setMinimum(0);
|
||||||
outgoing_ports_min.setMaximum(65535);
|
outgoing_ports_min.setMaximum(65535);
|
||||||
|
@ -934,6 +934,22 @@ public:
|
|||||||
setValue(QString::fromUtf8("Preferences/Downloads/DiskCache"), size);
|
setValue(QString::fromUtf8("Preferences/Downloads/DiskCache"), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool disableOSWriteCache() const {
|
||||||
|
return value(QString::fromUtf8("Preferences/Advanced/DisableOSWriteCache"), false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableOSWriteCache(bool disable) {
|
||||||
|
setValue(QString::fromUtf8("Preferences/Advanced/DisableOSWriteCache"), disable);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool disableOSReadCache() const {
|
||||||
|
return value(QString::fromUtf8("Preferences/Advanced/DisableOSReadCache"), false).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void disableOSReadCache(bool disable) {
|
||||||
|
setValue(QString::fromUtf8("Preferences/Advanced/DisableOSReadCache"), disable);
|
||||||
|
}
|
||||||
|
|
||||||
uint outgoingPortsMin() const {
|
uint outgoingPortsMin() const {
|
||||||
return value(QString::fromUtf8("Preferences/Advanced/OutgoingPortsMin"), 0).toUInt();
|
return value(QString::fromUtf8("Preferences/Advanced/OutgoingPortsMin"), 0).toUInt();
|
||||||
}
|
}
|
||||||
|
@ -404,12 +404,9 @@ void QBtSession::configureSession() {
|
|||||||
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
|
sessionSettings.auto_scrape_min_interval = 900; // 15 minutes
|
||||||
sessionSettings.cache_size = pref.diskCacheSize()*64;
|
sessionSettings.cache_size = pref.diskCacheSize()*64;
|
||||||
qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB";
|
qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB";
|
||||||
// Disable OS cache to avoid memory problems (uTorrent behavior)
|
// Disabling the OS disk cache is intended to reduce memory usage (especially when checking files) but might be unreliable
|
||||||
#ifdef Q_WS_WIN
|
sessionSettings.disk_io_write_mode = pref.disableOSWriteCache() ? session_settings::disable_os_cache : session_settings::enable_os_cache;
|
||||||
// Fixes huge memory usage on Windows 7 (especially when checking files)
|
sessionSettings.disk_io_read_mode = pref.disableOSReadCache() ? session_settings::disable_os_cache : session_settings::enable_os_cache;
|
||||||
sessionSettings.disk_io_write_mode = session_settings::disable_os_cache;
|
|
||||||
sessionSettings.disk_io_read_mode = session_settings::disable_os_cache;
|
|
||||||
#endif
|
|
||||||
#if LIBTORRENT_VERSION_MINOR > 15
|
#if LIBTORRENT_VERSION_MINOR > 15
|
||||||
sessionSettings.anonymous_mode = pref.isAnonymousModeEnabled();
|
sessionSettings.anonymous_mode = pref.isAnonymousModeEnabled();
|
||||||
if (sessionSettings.anonymous_mode) {
|
if (sessionSettings.anonymous_mode) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user