forked from premiere/premiere-libtorrent
Merge pull request #550 from arvidn/remove-mlock-1.1
remove/deprecate bad idea with mlock
This commit is contained in:
commit
dbbf8be8a5
|
@ -99,9 +99,7 @@ void bind_session_settings()
|
||||||
.def_readwrite("strict_super_seeding", &session_settings::strict_super_seeding)
|
.def_readwrite("strict_super_seeding", &session_settings::strict_super_seeding)
|
||||||
.def_readwrite("seeding_piece_quota", &session_settings::seeding_piece_quota)
|
.def_readwrite("seeding_piece_quota", &session_settings::seeding_piece_quota)
|
||||||
.def_readwrite("max_sparse_regions", &session_settings::max_sparse_regions)
|
.def_readwrite("max_sparse_regions", &session_settings::max_sparse_regions)
|
||||||
#ifndef TORRENT_DISABLE_MLOCK
|
|
||||||
.def_readwrite("lock_disk_cache", &session_settings::lock_disk_cache)
|
.def_readwrite("lock_disk_cache", &session_settings::lock_disk_cache)
|
||||||
#endif
|
|
||||||
.def_readwrite("max_rejects", &session_settings::max_rejects)
|
.def_readwrite("max_rejects", &session_settings::max_rejects)
|
||||||
.def_readwrite("recv_socket_buffer_size", &session_settings::recv_socket_buffer_size)
|
.def_readwrite("recv_socket_buffer_size", &session_settings::recv_socket_buffer_size)
|
||||||
.def_readwrite("send_socket_buffer_size", &session_settings::send_socket_buffer_size)
|
.def_readwrite("send_socket_buffer_size", &session_settings::send_socket_buffer_size)
|
||||||
|
|
|
@ -141,7 +141,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
// ==== AMIGA ===
|
// ==== AMIGA ===
|
||||||
#if defined __AMIGA__ || defined __amigaos__ || defined __AROS__
|
#if defined __AMIGA__ || defined __amigaos__ || defined __AROS__
|
||||||
#define TORRENT_AMIGA
|
#define TORRENT_AMIGA
|
||||||
#define TORRENT_USE_MLOCK 0
|
|
||||||
#define TORRENT_USE_IPV6 0
|
#define TORRENT_USE_IPV6 0
|
||||||
#define TORRENT_USE_BOOST_THREAD 0
|
#define TORRENT_USE_BOOST_THREAD 0
|
||||||
#define TORRENT_USE_IOSTREAM 0
|
#define TORRENT_USE_IOSTREAM 0
|
||||||
|
@ -310,7 +309,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define TORRENT_BEOS
|
#define TORRENT_BEOS
|
||||||
#include <storage/StorageDefs.h> // B_PATH_NAME_LENGTH
|
#include <storage/StorageDefs.h> // B_PATH_NAME_LENGTH
|
||||||
#define TORRENT_HAS_FALLOCATE 0
|
#define TORRENT_HAS_FALLOCATE 0
|
||||||
#define TORRENT_USE_MLOCK 0
|
|
||||||
#define TORRENT_USE_BEOS_ATOMIC 1
|
#define TORRENT_USE_BEOS_ATOMIC 1
|
||||||
#ifndef TORRENT_USE_ICONV
|
#ifndef TORRENT_USE_ICONV
|
||||||
#define TORRENT_USE_ICONV 0
|
#define TORRENT_USE_ICONV 0
|
||||||
|
@ -328,7 +326,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define TORRENT_HAS_FALLOCATE 0
|
#define TORRENT_HAS_FALLOCATE 0
|
||||||
#define TORRENT_USE_IFCONF 1
|
#define TORRENT_USE_IFCONF 1
|
||||||
#define TORRENT_USE_SYSCTL 1
|
#define TORRENT_USE_SYSCTL 1
|
||||||
#define TORRENT_USE_MLOCK 0
|
|
||||||
#define TORRENT_USE_IPV6 0
|
#define TORRENT_USE_IPV6 0
|
||||||
#define TORRENT_ICONV_ARG (const char**)
|
#define TORRENT_ICONV_ARG (const char**)
|
||||||
#define TORRENT_USE_WRITEV 0
|
#define TORRENT_USE_WRITEV 0
|
||||||
|
@ -565,10 +562,6 @@ int snprintf(char* buf, int len, char const* fmt, ...)
|
||||||
#define TORRENT_USE_IPV6 1
|
#define TORRENT_USE_IPV6 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TORRENT_USE_MLOCK
|
|
||||||
#define TORRENT_USE_MLOCK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// if preadv() exists, we assume pwritev() does as well
|
// if preadv() exists, we assume pwritev() does as well
|
||||||
#ifndef TORRENT_USE_PREADV
|
#ifndef TORRENT_USE_PREADV
|
||||||
#define TORRENT_USE_PREADV 0
|
#define TORRENT_USE_PREADV 0
|
||||||
|
|
|
@ -149,7 +149,6 @@ namespace libtorrent
|
||||||
mutable mutex m_pool_mutex;
|
mutable mutex m_pool_mutex;
|
||||||
|
|
||||||
int m_cache_buffer_chunk_size;
|
int m_cache_buffer_chunk_size;
|
||||||
bool m_lock_disk_cache;
|
|
||||||
|
|
||||||
#if TORRENT_HAVE_MMAP
|
#if TORRENT_HAVE_MMAP
|
||||||
// the file descriptor of the cache mmap file
|
// the file descriptor of the cache mmap file
|
||||||
|
|
|
@ -346,11 +346,15 @@ namespace libtorrent
|
||||||
// out. This is the traditional definition of super seeding.
|
// out. This is the traditional definition of super seeding.
|
||||||
strict_super_seeding,
|
strict_super_seeding,
|
||||||
|
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
// if this is set to true, the memory allocated for the disk cache
|
// if this is set to true, the memory allocated for the disk cache
|
||||||
// will be locked in physical RAM, never to be swapped out. Every time
|
// will be locked in physical RAM, never to be swapped out. Every time
|
||||||
// a disk buffer is allocated and freed, there will be the extra
|
// a disk buffer is allocated and freed, there will be the extra
|
||||||
// overhead of a system call.
|
// overhead of a system call.
|
||||||
lock_disk_cache,
|
lock_disk_cache,
|
||||||
|
#else
|
||||||
|
deprecated8,
|
||||||
|
#endif
|
||||||
|
|
||||||
// when set to true, all data downloaded from peers will be assumed to
|
// when set to true, all data downloaded from peers will be assumed to
|
||||||
// be correct, and not tested to match the hashes in the torrent this
|
// be correct, and not tested to match the hashes in the torrent this
|
||||||
|
|
|
@ -48,7 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <boost/system/error_code.hpp>
|
#include <boost/system/error_code.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#if TORRENT_USE_MLOCK && !defined TORRENT_WINDOWS
|
#if TORRENT_HAVE_MMAP
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -93,7 +93,6 @@ namespace libtorrent
|
||||||
, m_exceeded_max_size(false)
|
, m_exceeded_max_size(false)
|
||||||
, m_ios(ios)
|
, m_ios(ios)
|
||||||
, m_cache_buffer_chunk_size(0)
|
, m_cache_buffer_chunk_size(0)
|
||||||
, m_lock_disk_cache(false)
|
|
||||||
#if TORRENT_HAVE_MMAP
|
#if TORRENT_HAVE_MMAP
|
||||||
, m_cache_fd(-1)
|
, m_cache_fd(-1)
|
||||||
, m_cache_pool(0)
|
, m_cache_pool(0)
|
||||||
|
@ -329,16 +328,6 @@ namespace libtorrent
|
||||||
m_exceeded_max_size = true;
|
m_exceeded_max_size = true;
|
||||||
m_trigger_cache_trim();
|
m_trigger_cache_trim();
|
||||||
}
|
}
|
||||||
#if TORRENT_USE_MLOCK
|
|
||||||
if (m_lock_disk_cache)
|
|
||||||
{
|
|
||||||
#ifdef TORRENT_WINDOWS
|
|
||||||
VirtualLock(ret, m_block_size);
|
|
||||||
#else
|
|
||||||
mlock(ret, m_block_size);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif // TORRENT_USE_MLOCK
|
|
||||||
|
|
||||||
TORRENT_ASSERT(is_disk_buffer(ret, l));
|
TORRENT_ASSERT(is_disk_buffer(ret, l));
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -378,7 +367,6 @@ namespace libtorrent
|
||||||
// 0 cache_buffer_chunk_size means 'automatic' (i.e.
|
// 0 cache_buffer_chunk_size means 'automatic' (i.e.
|
||||||
// proportional to the total disk cache size)
|
// proportional to the total disk cache size)
|
||||||
m_cache_buffer_chunk_size = sett.get_int(settings_pack::cache_buffer_chunk_size);
|
m_cache_buffer_chunk_size = sett.get_int(settings_pack::cache_buffer_chunk_size);
|
||||||
m_lock_disk_cache = sett.get_bool(settings_pack::lock_disk_cache);
|
|
||||||
#ifndef TORRENT_DISABLE_POOL_ALLOCATOR
|
#ifndef TORRENT_DISABLE_POOL_ALLOCATOR
|
||||||
// if the chunk size is set to 1, there's no point in creating a pool
|
// if the chunk size is set to 1, there's no point in creating a pool
|
||||||
m_want_pool_allocator = sett.get_bool(settings_pack::use_disk_cache_pool)
|
m_want_pool_allocator = sett.get_bool(settings_pack::use_disk_cache_pool)
|
||||||
|
@ -529,17 +517,6 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(l.locked());
|
TORRENT_ASSERT(l.locked());
|
||||||
TORRENT_UNUSED(l);
|
TORRENT_UNUSED(l);
|
||||||
|
|
||||||
#if TORRENT_USE_MLOCK
|
|
||||||
if (m_lock_disk_cache)
|
|
||||||
{
|
|
||||||
#ifdef TORRENT_WINDOWS
|
|
||||||
VirtualUnlock(buf, m_block_size);
|
|
||||||
#else
|
|
||||||
munlock(buf, m_block_size);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if TORRENT_HAVE_MMAP
|
#if TORRENT_HAVE_MMAP
|
||||||
if (m_cache_pool)
|
if (m_cache_pool)
|
||||||
{
|
{
|
||||||
|
|
|
@ -218,9 +218,6 @@ namespace libtorrent
|
||||||
// 30 seconds expiration to save cache
|
// 30 seconds expiration to save cache
|
||||||
// space for active pieces
|
// space for active pieces
|
||||||
set.set_int(settings_pack::cache_expiry, 30);
|
set.set_int(settings_pack::cache_expiry, 30);
|
||||||
// this is expensive and could add significant
|
|
||||||
// delays when freeing a large number of buffers
|
|
||||||
set.set_bool(settings_pack::lock_disk_cache, false);
|
|
||||||
|
|
||||||
// in case the OS we're running on doesn't support
|
// in case the OS we're running on doesn't support
|
||||||
// readv/writev, allocate contiguous buffers for
|
// readv/writev, allocate contiguous buffers for
|
||||||
|
|
|
@ -164,7 +164,7 @@ namespace libtorrent
|
||||||
SET(announce_to_all_tiers, false, 0),
|
SET(announce_to_all_tiers, false, 0),
|
||||||
SET(prefer_udp_trackers, true, 0),
|
SET(prefer_udp_trackers, true, 0),
|
||||||
SET(strict_super_seeding, false, 0),
|
SET(strict_super_seeding, false, 0),
|
||||||
SET(lock_disk_cache, false, 0),
|
DEPRECATED_SET(lock_disk_cache, false, 0),
|
||||||
SET(disable_hash_checks, false, 0),
|
SET(disable_hash_checks, false, 0),
|
||||||
SET(allow_i2p_mixed, false, 0),
|
SET(allow_i2p_mixed, false, 0),
|
||||||
SET(low_prio_disk, true, 0),
|
SET(low_prio_disk, true, 0),
|
||||||
|
|
Loading…
Reference in New Issue