added volatile read cache option
This commit is contained in:
parent
a4ff3cdf87
commit
ccf8b0278a
|
@ -106,6 +106,7 @@ void bind_session_settings()
|
|||
.def_readwrite("max_suggest_pieces", &session_settings::max_suggest_pieces)
|
||||
.def_readwrite("drop_skipped_requests", &session_settings::drop_skipped_requests)
|
||||
.def_readwrite("low_prio_disk", &session_settings::low_prio_disk)
|
||||
.def_readwrite("volatile_read_cache", &session_settings::volatile_read_cache)
|
||||
;
|
||||
|
||||
enum_<proxy_settings::proxy_type>("proxy_type")
|
||||
|
|
|
@ -3721,6 +3721,7 @@ session_settings
|
|||
bool drop_skipped_requests;
|
||||
|
||||
bool low_prio_disk;
|
||||
bool volatile_read_cache;
|
||||
};
|
||||
|
||||
``user_agent`` this is the client identification to the tracker.
|
||||
|
@ -4191,6 +4192,12 @@ overall responsiveness of the system while downloading in the
|
|||
background. For high-performance server setups, this might not
|
||||
be desirable.
|
||||
|
||||
``volatile_read_cache``, if this is set to true, read cache blocks
|
||||
that are hit by peer read requests are removed from the disk cache
|
||||
to free up more space. This is useful if you don't expect the disk
|
||||
cache to create any cache hits from other peers than the one who
|
||||
triggered the cache line to be read into the cache in the first place.
|
||||
|
||||
pe_settings
|
||||
===========
|
||||
|
||||
|
|
|
@ -186,6 +186,7 @@ namespace libtorrent
|
|||
, max_suggest_pieces(10)
|
||||
, drop_skipped_requests(false)
|
||||
, low_prio_disk(true)
|
||||
, volatile_read_cache(false)
|
||||
{}
|
||||
|
||||
// this is the user agent that will be sent to the tracker
|
||||
|
@ -683,6 +684,12 @@ namespace libtorrent
|
|||
// to foreground tasks, while bittorrent runs
|
||||
// in the background
|
||||
bool low_prio_disk;
|
||||
|
||||
// if this is set to true, any block read from the
|
||||
// disk cache will be dropped from the cache immediately
|
||||
// following. This may be useful if the block is not
|
||||
// expected to be hit again. It would save some memory
|
||||
bool volatile_read_cache;
|
||||
};
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
|
|
@ -711,6 +711,12 @@ namespace libtorrent
|
|||
{
|
||||
std::memcpy(buf.get() + offset, p.blocks[i].buf, block_size);
|
||||
offset += m_block_size;
|
||||
if (m_settings.volatile_read_cache)
|
||||
{
|
||||
free_buffer(p.blocks[i].buf);
|
||||
p.blocks[i].buf = 0;
|
||||
--p.num_blocks;
|
||||
}
|
||||
}
|
||||
buffer_size += block_size;
|
||||
TORRENT_ASSERT(p.num_blocks > 0);
|
||||
|
@ -1232,6 +1238,12 @@ namespace libtorrent
|
|||
size -= to_copy;
|
||||
block_offset = 0;
|
||||
buffer_offset += to_copy;
|
||||
if (m_settings.volatile_read_cache)
|
||||
{
|
||||
free_buffer(p.blocks[block].buf);
|
||||
p.blocks[block].buf = 0;
|
||||
--p.num_blocks;
|
||||
}
|
||||
++block;
|
||||
}
|
||||
return j.buffer_size;
|
||||
|
|
|
@ -1021,6 +1021,7 @@ namespace aux {
|
|||
|| m_settings.use_read_cache != s.use_read_cache
|
||||
|| m_settings.allow_reordered_disk_operations != s.allow_reordered_disk_operations
|
||||
|| m_settings.file_pool_size != s.file_pool_size
|
||||
|| m_settings.volatile_read_cache != s.volatile_read_cache
|
||||
|| m_settings.low_prio_disk != s.low_prio_disk)
|
||||
update_disk_io_thread = true;
|
||||
|
||||
|
|
Loading…
Reference in New Issue