Compare commits

...

2 Commits

Author SHA1 Message Date
Alexey Rybalchenko
4218c185a4 Shmem: Send acks also for local regions 2020-05-04 10:01:29 +02:00
Alexey Rybalchenko
5a49c5b9b1 Truncate the file used for the region mapping 2020-05-04 10:01:29 +02:00
2 changed files with 13 additions and 2 deletions

View File

@@ -183,7 +183,6 @@ Region* Manager::GetRegionUnsafe(const uint64_t id)
// LOG(debug) << "Located remote region with id '" << id << "', path: '" << path << "', flags: '" << flags << "'";
auto r = fRegions.emplace(id, tools::make_unique<Region>(*this, id, 0, true, nullptr, path, flags));
r.first->second->StartSendingAcks();
return r.first->second.get();
} catch (bie& e) {
LOG(warn) << "Could not get remote region for id: " << id;

View File

@@ -19,6 +19,7 @@
#include <cerrno>
#include <chrono>
#include <ios>
using namespace std;
@@ -49,7 +50,17 @@ Region::Region(Manager& manager, uint64_t id, uint64_t size, bool remote, Region
if (path != "") {
fName = string(path + fName);
fFile = fopen(fName.c_str(), fRemote ? "r+" : "w+");
if (!fRemote) {
// create a file
filebuf fbuf;
if (fbuf.open(fName, ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary)) {
// set the size
fbuf.pubseekoff(size - 1, ios_base::beg);
fbuf.sputc(0);
}
}
fFile = fopen(fName.c_str(), "r+");
if (!fFile) {
LOG(error) << "Failed to initialize file: " << fName;
@@ -70,6 +81,7 @@ Region::Region(Manager& manager, uint64_t id, uint64_t size, bool remote, Region
}
InitializeQueues();
StartSendingAcks();
LOG(debug) << "shmem: initialized region: " << fName;
}