remove left-overs from disk buffer pool allocator

This commit is contained in:
arvidn 2017-08-21 13:36:32 +02:00 committed by Arvid Norberg
parent 5130827fc7
commit f311bf354e
7 changed files with 8 additions and 28 deletions

View File

@ -729,7 +729,6 @@ namespace aux {
void update_queued_disk_bytes();
void update_alert_queue_size();
void update_disk_threads();
void update_cache_buffer_chunk_size();
void update_report_web_seed_downloads();
void update_outgoing_interfaces();
void update_listen_interfaces();

View File

@ -131,8 +131,6 @@ namespace libtorrent {
mutable std::mutex m_pool_mutex;
int m_cache_buffer_chunk_size;
// this is specifically exempt from release_asserts
// since it's a quite costly check. Only for debug
// builds.

View File

@ -963,20 +963,18 @@ namespace libtorrent {
// physical RAM available in the machine divided by 8. If the amount
// of physical RAM cannot be determined, it's set to 1024 (= 16 MiB).
//
// Disk buffers are allocated using a pool allocator, the number of
// blocks that are allocated at a time when the pool needs to grow can
// be specified in ``cache_buffer_chunk_size``. Lower numbers saves
// memory at the expense of more heap allocations. If it is set to 0,
// the effective chunk size is proportional to the total cache size,
// attempting to strike a good balance between performance and memory
// usage. It defaults to 0. ``cache_expiry`` is the number of seconds
// from the last cached write to a piece in the write cache, to when
// it's forcefully flushed to disk. Default is 60 second.
// ``cache_expiry`` is the number of seconds from the last cached write
// to a piece in the write cache, to when it's forcefully flushed to
// disk. Default is 60 second.
//
// On 32 bit builds, the effective cache size will be limited to 3/4 of
// 2 GiB to avoid exceeding the virtual address space limit.
cache_size,
#ifndef TORRENT_NO_DEPRECATE
cache_buffer_chunk_size,
#else
deprecated25,
#endif
cache_expiry,
// determines how files are opened when they're in read only mode

View File

@ -76,7 +76,6 @@ namespace libtorrent {
, m_trigger_cache_trim(trigger_trim)
, m_exceeded_max_size(false)
, m_ios(ios)
, m_cache_buffer_chunk_size(0)
{
#if TORRENT_USE_ASSERTS
m_magic = 0x1337;
@ -292,10 +291,6 @@ namespace libtorrent {
{
std::unique_lock<std::mutex> l(m_pool_mutex);
// 0 cache_buffer_chunk_size means 'automatic' (i.e.
// proportional to the total disk cache size)
m_cache_buffer_chunk_size = sett.get_int(settings_pack::cache_buffer_chunk_size);
int const cache_size = sett.get_int(settings_pack::cache_size);
if (cache_size < 0)
{
@ -356,8 +351,6 @@ namespace libtorrent {
m_exceeded_max_size = true;
m_trigger_cache_trim();
}
if (m_cache_buffer_chunk_size > m_max_use)
m_cache_buffer_chunk_size = m_max_use;
#if TORRENT_USE_ASSERTS
m_settings_set = true;

View File

@ -102,7 +102,6 @@ namespace libtorrent {
// don't use any disk cache
set.set_int(settings_pack::cache_size, 0);
set.set_int(settings_pack::cache_buffer_chunk_size, 1);
set.set_bool(settings_pack::use_read_cache, false);
set.set_bool(settings_pack::close_redundant_connections, true);
@ -166,7 +165,6 @@ namespace libtorrent {
// use 1 GB of cache
set.set_int(settings_pack::cache_size, 32768 * 2);
set.set_bool(settings_pack::use_read_cache, true);
set.set_int(settings_pack::cache_buffer_chunk_size, 0);
set.set_int(settings_pack::read_cache_line_size, 32);
set.set_int(settings_pack::write_cache_line_size, 256);
// 30 seconds expiration to save cache

View File

@ -6235,12 +6235,6 @@ namespace {
#endif
}
void session_impl::update_cache_buffer_chunk_size()
{
if (m_settings.get_int(settings_pack::cache_buffer_chunk_size) <= 0)
m_settings.set_int(settings_pack::cache_buffer_chunk_size, 1);
}
void session_impl::update_report_web_seed_downloads()
{
// if this flag changed, update all web seed connections

View File

@ -238,7 +238,7 @@ constexpr int CLOSE_FILE_INTERVAL = 0;
SET(choking_algorithm, settings_pack::fixed_slots_choker, nullptr),
SET(seed_choking_algorithm, settings_pack::round_robin, nullptr),
SET(cache_size, 1024, nullptr),
SET(cache_buffer_chunk_size, 0, &session_impl::update_cache_buffer_chunk_size),
DEPRECATED_SET(cache_buffer_chunk_size, 0, nullptr),
SET(cache_expiry, 300, nullptr),
SET(disk_io_write_mode, settings_pack::enable_os_cache, nullptr),
SET(disk_io_read_mode, settings_pack::enable_os_cache, nullptr),