summarylogtreecommitdiffstats
path: root/lt-ps-honor_system_file_allocate_all.patch
diff options
context:
space:
mode:
authorxsmile2017-03-16 01:07:09 +0100
committerxsmile2017-03-16 01:07:09 +0100
commita4dc2af7c732e8aaef000436b0bdd7b4cfe06b90 (patch)
tree1482ad7fe83e37b42d30bcf224e9c48676c94aa9 /lt-ps-honor_system_file_allocate_all.patch
parent66566742bf2075e09f17e0f7cb4a3bf9ff69673a (diff)
downloadaur-a4dc2af7c732e8aaef000436b0bdd7b4cfe06b90.tar.gz
new version scheme, update
Diffstat (limited to 'lt-ps-honor_system_file_allocate_all.patch')
-rw-r--r--lt-ps-honor_system_file_allocate_all.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/lt-ps-honor_system_file_allocate_all.patch b/lt-ps-honor_system_file_allocate_all.patch
new file mode 100644
index 000000000000..bf466e3683bf
--- /dev/null
+++ b/lt-ps-honor_system_file_allocate_all.patch
@@ -0,0 +1,64 @@
+--- release/src/download/download_wrapper.cc 2015-08-08 16:01:49.000000000 +0100
++++ patched/src/download/download_wrapper.cc 2016-08-23 18:06:34.346151049 +0100
+@@ -343,6 +343,8 @@ DownloadWrapper::receive_update_prioriti
+ data()->mutable_high_priority()->insert((*itr)->range().first, (*itr)->range().second);
+ break;
+ default:
++ // Unset fallocate flag if priority of a file is Off.
++ (*itr)->unset_flags(File::flag_fallocate);
+ break;
+ }
+ }
+--- release/src/torrent/data/file.cc 2015-08-08 16:01:49.000000000 +0100
++++ patched/src/torrent/data/file.cc 2016-08-23 12:59:32.115952838 +0100
+@@ -168,13 +168,14 @@ File::resize_file() {
+ if (m_size == SocketFile(m_fd).size())
+ return true;
+
+- // For now make it so that the fallocate flag indicates if we want
+- // to do potentially blocking allocation, while FS supported
+- // non-blocking allocation is done always.
+- int flags = SocketFile::flag_fallocate;
++ int flags = 0;
+
+- if (m_flags & flag_fallocate)
++ // Set FS supported non-blocking allocation flag and potentially
++ // blocking allocation flag if fallocate flag is set.
++ if (m_flags & flag_fallocate) {
++ flags |= SocketFile::flag_fallocate;
+ flags |= SocketFile::flag_fallocate_blocking;
++ }
+
+ return SocketFile(m_fd).set_size(m_size, flags);
+ }
+--- release/src/torrent/data/file_list.cc 2015-08-08 16:01:32.000000000 +0100
++++ patched/src/torrent/data/file_list.cc 2016-08-23 17:17:19.248826853 +0100
+@@ -580,7 +580,12 @@ FileList::open_file(File* node, const Pa
+ return false;
+ }
+
+- return node->prepare(MemoryChunk::prot_read, 0);
++ // File allocation will be done if fallocate flag is set,
++ // create zero-length file otherwise.
++ if (node->has_flags(File::flag_fallocate))
++ return node->prepare(MemoryChunk::prot_write, 0);
++ else
++ return node->prepare(MemoryChunk::prot_read, 0);
+ }
+
+ MemoryChunk
+--- release/src/torrent/download.cc 2015-08-08 16:01:49.000000000 +0100
++++ patched/src/torrent/download.cc 2016-08-23 18:14:20.843623816 +0100
+@@ -131,9 +131,9 @@ Download::start(int flags) {
+
+ // file_list()->open(flags);
+
+- // If the FileList::open_no_create flag was not set, our new
+- // behavior is to create all zero-length files with
+- // flag_queued_create set.
++ // If the open_enable_fallocate or the FileList::open_no_create
++ // flag was not set, then create all zero-length files with
++ // flag_create_queued set.
+ file_list()->open(flags & ~FileList::open_no_create);
+
+ if (m_ptr->connection_type() == CONNECTION_INITIAL_SEED) {