diff options
author | Kenneth Heafield <github@kheafield.com> | 2020-03-26 23:58:53 +0300 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2020-03-26 23:58:53 +0300 |
commit | 6d338f237f783c7d98a8124ca923ac5d6a6ad161 (patch) | |
tree | bbf1a61fcee455a834aafa4053cf7f5d27d8f187 | |
parent | 7826fc3530dfe83916626e2d65a23da637537b47 (diff) |
Fix from Jelmer to source
-rw-r--r-- | util/mmap.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/util/mmap.cc b/util/mmap.cc index e6a06ca..35bf382 100644 --- a/util/mmap.cc +++ b/util/mmap.cc @@ -6,7 +6,6 @@ #include "util/exception.hh" #include "util/file.hh" -#include "util/parallel_read.hh" #include "util/scoped.hh" #include <iostream> @@ -267,8 +266,9 @@ void HugeRealloc(std::size_t to, bool zero_new, scoped_memory &mem) { // main path: try to mremap. void *new_addr = mremap(mem.get(), RoundUpSize(mem), to, MREMAP_MAYMOVE); if (new_addr != MAP_FAILED) { - mem.steal(); - mem.reset(new_addr, to, mem.source()); + scoped_memory::Alloc source(mem.source()); // steal resets mem.source() + mem.steal(); // let go otherwise reset() will free it first + mem.reset(new_addr, to, source); } else { // Reallocating huge pages can fail with EINVAL. // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/mremap.c?id=refs/tags/v3.19#n346 @@ -319,8 +319,7 @@ void MapRead(LoadMethod method, int fd, uint64_t offset, std::size_t size, scope ReadOrThrow(fd, out.get(), size); break; case PARALLEL_READ: - HugeMalloc(size, false, out); - ParallelRead(fd, out.get(), size, offset); + UTIL_THROW(Exception, "Parallel read was removed from this repo."); break; } } |