diff --git a/bindings/python/src/session_settings.cpp b/bindings/python/src/session_settings.cpp index 45b10ca9c..b17170c07 100644 --- a/bindings/python/src/session_settings.cpp +++ b/bindings/python/src/session_settings.cpp @@ -99,9 +99,7 @@ void bind_session_settings() .def_readwrite("strict_super_seeding", &session_settings::strict_super_seeding) .def_readwrite("seeding_piece_quota", &session_settings::seeding_piece_quota) .def_readwrite("max_sparse_regions", &session_settings::max_sparse_regions) -#ifndef TORRENT_DISABLE_MLOCK .def_readwrite("lock_disk_cache", &session_settings::lock_disk_cache) -#endif .def_readwrite("max_rejects", &session_settings::max_rejects) .def_readwrite("recv_socket_buffer_size", &session_settings::recv_socket_buffer_size) .def_readwrite("send_socket_buffer_size", &session_settings::send_socket_buffer_size) diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index eb5d76b33..d7fa0ab3d 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -141,7 +141,6 @@ POSSIBILITY OF SUCH DAMAGE. // ==== AMIGA === #if defined __AMIGA__ || defined __amigaos__ || defined __AROS__ #define TORRENT_AMIGA -#define TORRENT_USE_MLOCK 0 #define TORRENT_USE_IPV6 0 #define TORRENT_USE_BOOST_THREAD 0 #define TORRENT_USE_IOSTREAM 0 @@ -310,7 +309,6 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_BEOS #include // B_PATH_NAME_LENGTH #define TORRENT_HAS_FALLOCATE 0 -#define TORRENT_USE_MLOCK 0 #define TORRENT_USE_BEOS_ATOMIC 1 #ifndef TORRENT_USE_ICONV #define TORRENT_USE_ICONV 0 @@ -328,7 +326,6 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_HAS_FALLOCATE 0 #define TORRENT_USE_IFCONF 1 #define TORRENT_USE_SYSCTL 1 -#define TORRENT_USE_MLOCK 0 #define TORRENT_USE_IPV6 0 #define TORRENT_ICONV_ARG (const char**) #define TORRENT_USE_WRITEV 0 @@ -565,10 +562,6 @@ int snprintf(char* buf, int len, char const* fmt, ...) #define TORRENT_USE_IPV6 1 #endif -#ifndef TORRENT_USE_MLOCK -#define TORRENT_USE_MLOCK 1 -#endif - // if preadv() exists, we assume pwritev() does as well #ifndef TORRENT_USE_PREADV #define TORRENT_USE_PREADV 0 diff --git a/include/libtorrent/disk_buffer_pool.hpp b/include/libtorrent/disk_buffer_pool.hpp index 035f40b91..6d03908d1 100644 --- a/include/libtorrent/disk_buffer_pool.hpp +++ b/include/libtorrent/disk_buffer_pool.hpp @@ -149,7 +149,6 @@ namespace libtorrent mutable mutex m_pool_mutex; int m_cache_buffer_chunk_size; - bool m_lock_disk_cache; #if TORRENT_HAVE_MMAP // the file descriptor of the cache mmap file diff --git a/include/libtorrent/settings_pack.hpp b/include/libtorrent/settings_pack.hpp index aecc3fa81..dc1f2db96 100644 --- a/include/libtorrent/settings_pack.hpp +++ b/include/libtorrent/settings_pack.hpp @@ -346,11 +346,15 @@ namespace libtorrent // out. This is the traditional definition of super seeding. strict_super_seeding, +#ifndef TORRENT_NO_DEPRECATE // 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 // a disk buffer is allocated and freed, there will be the extra // overhead of a system call. lock_disk_cache, +#else + deprecated8, +#endif // 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 diff --git a/src/disk_buffer_pool.cpp b/src/disk_buffer_pool.cpp index 274f5e4f4..8ebd8c4a3 100644 --- a/src/disk_buffer_pool.cpp +++ b/src/disk_buffer_pool.cpp @@ -48,7 +48,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#if TORRENT_USE_MLOCK && !defined TORRENT_WINDOWS +#if TORRENT_HAVE_MMAP #include #endif @@ -93,7 +93,6 @@ namespace libtorrent , m_exceeded_max_size(false) , m_ios(ios) , m_cache_buffer_chunk_size(0) - , m_lock_disk_cache(false) #if TORRENT_HAVE_MMAP , m_cache_fd(-1) , m_cache_pool(0) @@ -329,16 +328,6 @@ namespace libtorrent m_exceeded_max_size = true; 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)); return ret; @@ -378,7 +367,6 @@ namespace libtorrent // 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); - m_lock_disk_cache = sett.get_bool(settings_pack::lock_disk_cache); #ifndef TORRENT_DISABLE_POOL_ALLOCATOR // 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) @@ -529,17 +517,6 @@ namespace libtorrent TORRENT_ASSERT(l.locked()); 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 (m_cache_pool) { diff --git a/src/session.cpp b/src/session.cpp index e844bff29..eec512187 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -218,9 +218,6 @@ namespace libtorrent // 30 seconds expiration to save cache // space for active pieces 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 // readv/writev, allocate contiguous buffers for diff --git a/src/settings_pack.cpp b/src/settings_pack.cpp index c743e9833..608c77ae1 100644 --- a/src/settings_pack.cpp +++ b/src/settings_pack.cpp @@ -164,7 +164,7 @@ namespace libtorrent SET(announce_to_all_tiers, false, 0), SET(prefer_udp_trackers, true, 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(allow_i2p_mixed, false, 0), SET(low_prio_disk, true, 0),