Commit 9637fdac authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent cb5c1ce6
...@@ -543,6 +543,35 @@ error _Conn::resync(zodb::Tid at) { ...@@ -543,6 +543,35 @@ error _Conn::resync(zodb::Tid at) {
return nil; return nil;
} }
// unmap releases mapping memory from address space.
//
// After call to unmap the mapping must no longer be used.
// virtmem calls unmap when VMA is unmapped.
error _Mapping::unmap() {
Mapping mmap = newref(this); // XXX newref for std::remove
FileH f = mmap->fileh;
xerr::Contextf E("wcfs %s: conn @%s: f<%s>: unmap",
v(f->wconn->_wc->mountpoint), v(f->wconn->at), v(f->foid));
// XXX locking
// XXX make sure mmap cannot be XXX
error err = mm::unmap(mmap->mem_start, mmap->mem_stop - mmap->mem_start);
mmap->mem_start = NULL;
mmap->mem_stop = NULL;
// XXX clear other fields?
//f->_mmaps.remove(mmap);
// FIXME keep mmaps sorted
f->_mmaps.erase(
std::remove(f->_mmaps.begin(), f->_mmaps.end(), mmap),
f->_mmaps.end());
return E(err);
}
// _remmapblk remmaps mapping memory for file[blk] to be viewing database as of @at state. // _remmapblk remmaps mapping memory for file[blk] to be viewing database as of @at state.
// //
// at=TidHead means unpin to head/ . // at=TidHead means unpin to head/ .
...@@ -622,35 +651,6 @@ error _Mapping::remmap_blk(int64_t blk) { ...@@ -622,35 +651,6 @@ error _Mapping::remmap_blk(int64_t blk) {
return nil; return nil;
} }
// unmap releases mapping memory from address space.
//
// After call to unmap the mapping must no longer be used.
// virtmem calls unmap when VMA is unmapped.
error _Mapping::unmap() {
Mapping mmap = newref(this); // XXX newref for std::remove
FileH f = mmap->fileh;
xerr::Contextf E("wcfs %s: conn @%s: f<%s>: unmap",
v(f->wconn->_wc->mountpoint), v(f->wconn->at), v(f->foid));
// XXX locking
// XXX make sure mmap cannot be XXX
error err = mm::unmap(mmap->mem_start, mmap->mem_stop - mmap->mem_start);
mmap->mem_start = NULL;
mmap->mem_stop = NULL;
// XXX clear other fields?
//f->_mmaps.remove(mmap);
// FIXME keep mmaps sorted
f->_mmaps.erase(
std::remove(f->_mmaps.begin(), f->_mmaps.end(), mmap),
f->_mmaps.end());
return E(err);
}
// ---- WCFS raw file access ---- // ---- WCFS raw file access ----
// _path returns path for object on wcfs. // _path returns path for object on wcfs.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment