Removing option to disable the OS disk cache because it has limited use and is unreliable in Windows.

This commit is contained in:
John Peterson 2012-12-03 18:05:05 +01:00
parent f2c05131c3
commit 6894a4b640
3 changed files with 2 additions and 29 deletions

View file

@ -13,7 +13,7 @@
#include "preferences.h" #include "preferences.h"
enum AdvSettingsCols {PROPERTY, VALUE}; enum AdvSettingsCols {PROPERTY, VALUE};
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, 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,
#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_write_cache, cb_read_cache, cb_ignore_limits_lan, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts, QCheckBox 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;
@ -69,8 +69,6 @@ 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());
@ -172,12 +170,6 @@ private slots:
spin_cache.setValue(pref.diskCacheSize()); spin_cache.setValue(pref.diskCacheSize());
updateCacheSpinSuffix(spin_cache.value()); updateCacheSpinSuffix(spin_cache.value());
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);

View file

@ -952,22 +952,6 @@ public:
setValue(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), size); setValue(QString::fromUtf8("Preferences/Downloads/DiskWriteCacheSize"), 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();
} }

View file

@ -405,9 +405,6 @@ void QBtSession::configureSession() {
int cache_size = pref.diskCacheSize(); int cache_size = pref.diskCacheSize();
sessionSettings.cache_size = cache_size ? cache_size * 64 : -1; sessionSettings.cache_size = cache_size ? cache_size * 64 : -1;
qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB"; qDebug() << "Using a disk cache size of" << pref.diskCacheSize() << "MiB";
// Disabling the OS disk cache is intended to reduce memory usage (especially when checking files) but might be unreliable
sessionSettings.disk_io_write_mode = pref.disableOSWriteCache() ? session_settings::disable_os_cache : session_settings::enable_os_cache;
sessionSettings.disk_io_read_mode = pref.disableOSReadCache() ? session_settings::disable_os_cache : session_settings::enable_os_cache;
#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) {