Commit 95a8df7c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0ce9ff6e
...@@ -204,6 +204,7 @@ static error mmap_into_ro(void *addr, size_t size, os::File f, off_t offset); ...@@ -204,6 +204,7 @@ static error mmap_into_ro(void *addr, size_t size, os::File f, off_t offset);
pair<Conn, error> WCFS::connect(zodb::Tid at) { pair<Conn, error> WCFS::connect(zodb::Tid at) {
WCFS *wc = this; WCFS *wc = this;
xerr::Contextf E("wcfs %s: connect @%s", v(wc->mountpoint), v(at)); xerr::Contextf E("wcfs %s: connect @%s", v(wc->mountpoint), v(at));
etrace("");
// TODO support !isolated mode // TODO support !isolated mode
...@@ -261,6 +262,7 @@ error _Conn::close() { ...@@ -261,6 +262,7 @@ error _Conn::close() {
}); });
xerr::Contextf E("%s: close", v(wconn)); xerr::Contextf E("%s: close", v(wconn));
etrace("");
error err, eret; error err, eret;
auto reterr1 = [&eret](error err) { auto reterr1 = [&eret](error err) {
...@@ -345,6 +347,7 @@ error _Conn::_pinner(context::Context ctx) { ...@@ -345,6 +347,7 @@ error _Conn::_pinner(context::Context ctx) {
error _Conn::__pinner(context::Context ctx) { error _Conn::__pinner(context::Context ctx) {
_Conn& wconn = *this; _Conn& wconn = *this;
xerr::Contextf E("pinner"); // NOTE pinner error goes to Conn::close who has its own context xerr::Contextf E("pinner"); // NOTE pinner error goes to Conn::close who has its own context
etrace("");
PinReq req; PinReq req;
error err; error err;
...@@ -373,6 +376,7 @@ error _Conn::__pinner(context::Context ctx) { ...@@ -373,6 +376,7 @@ error _Conn::__pinner(context::Context ctx) {
error _Conn::_pin1(PinReq *req) { error _Conn::_pin1(PinReq *req) {
_Conn& wconn = *this; _Conn& wconn = *this;
xerr::Contextf E("pin f<%s> #%ld @%s", v(req->foid), req->blk, v(req->at)); xerr::Contextf E("pin f<%s> #%ld @%s", v(req->foid), req->blk, v(req->at));
etrace("");
error err = wconn.__pin1(req); error err = wconn.__pin1(req);
...@@ -457,7 +461,7 @@ error _Conn::__pin1(PinReq *req) { ...@@ -457,7 +461,7 @@ error _Conn::__pin1(PinReq *req) {
if (!(mmap->blk_start <= req->blk && req->blk < mmap->blk_stop())) if (!(mmap->blk_start <= req->blk && req->blk < mmap->blk_stop()))
continue; // blk ∉ mmap continue; // blk ∉ mmap
trace("\tremmapblk %d %s", req->blk, (req->at == TidHead ? v(req->at) : "@head")); trace("\tremmapblk %d @%s", req->blk, (req->at == TidHead ? "head" : v(req->at)));
// pin only if virtmem did not dirtied page corresponding to this block already // pin only if virtmem did not dirtied page corresponding to this block already
// if virtmem dirtied the page - it will ask us to remmap it again after commit or abort. // if virtmem dirtied the page - it will ask us to remmap it again after commit or abort.
...@@ -512,8 +516,7 @@ error _Conn::resync(zodb::Tid at) { ...@@ -512,8 +516,7 @@ error _Conn::resync(zodb::Tid at) {
wconn._atMu.RLock(); wconn._atMu.RLock();
xerr::Contextf E("%s: resync -> @%s", v(wconn), v(at)); xerr::Contextf E("%s: resync -> @%s", v(wconn), v(at));
wconn._atMu.RUnlock(); wconn._atMu.RUnlock();
etrace("");
etrace("...");
// XXX downErr -> E // XXX downErr -> E
// XXX at ^ (increases) // XXX at ^ (increases)
...@@ -665,6 +668,7 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) { ...@@ -665,6 +668,7 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
}); });
xerr::Contextf E("%s: open f<%s>", v(wconn), v(foid)); xerr::Contextf E("%s: open f<%s>", v(wconn), v(foid));
etrace("");
wconn._filehMu.Lock(); wconn._filehMu.Lock();
...@@ -823,6 +827,7 @@ error _FileH::close() { ...@@ -823,6 +827,7 @@ error _FileH::close() {
// last open went away - real close. // last open went away - real close.
xerr::Contextf E("%s: close f<%s>", v(wconn), v(fileh.foid)); xerr::Contextf E("%s: close f<%s>", v(wconn), v(fileh.foid));
etrace("");
ASSERT(fileh._state == _FileHOpened); // there can be no open-in-progress, because ASSERT(fileh._state == _FileHOpened); // there can be no open-in-progress, because
fileh._state = _FileHClosing; // .close() can be called only on "opened" fileh fileh._state = _FileHClosing; // .close() can be called only on "opened" fileh
...@@ -882,6 +887,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma) ...@@ -882,6 +887,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
}); });
xerr::Contextf E("%s: mmap f<%s> [blk%ld +blk%ld)", v(f.wconn), v(f.foid), blk_start, blk_len); xerr::Contextf E("%s: mmap f<%s> [blk%ld +blk%ld)", v(f.wconn), v(f.foid), blk_start, blk_len);
etrace("");
if (f._state >= _FileHClosing) // XXX locking if (f._state >= _FileHClosing) // XXX locking
return make_pair(nil, E(os::ErrClosed)); return make_pair(nil, E(os::ErrClosed));
...@@ -978,6 +984,7 @@ error _Mapping::unmap() { ...@@ -978,6 +984,7 @@ error _Mapping::unmap() {
}); });
xerr::Contextf E("%s: f<%s>: unmap", v(f->wconn), v(f->foid)); xerr::Contextf E("%s: f<%s>: unmap", v(f->wconn), v(f->foid));
etrace("");
if (mmap->vma != nil) { if (mmap->vma != nil) {
mmap->_assertVMAOk(); mmap->_assertVMAOk();
...@@ -1016,6 +1023,7 @@ error _Mapping::_remmapblk(int64_t blk, zodb::Tid at) { ...@@ -1016,6 +1023,7 @@ error _Mapping::_remmapblk(int64_t blk, zodb::Tid at) {
_Mapping *mmap = this; _Mapping *mmap = this;
FileH f = mmap->fileh; FileH f = mmap->fileh;
xerr::Contextf E("%s: f<%s>: remmapblk #%ld @%s", v(f->wconn), v(f->foid), blk, v(at)); xerr::Contextf E("%s: f<%s>: remmapblk #%ld @%s", v(f->wconn), v(f->foid), blk, v(at));
etrace("");
ASSERT(mmap->blk_start <= blk && blk < mmap->blk_stop()); ASSERT(mmap->blk_start <= blk && blk < mmap->blk_stop());
error err; error err;
...@@ -1118,6 +1126,7 @@ tuple<os::File, error> WCFS::_open(const string &path, int flags) { ...@@ -1118,6 +1126,7 @@ tuple<os::File, error> WCFS::_open(const string &path, int flags) {
// created mapping, even after it is accessed, does not consume memory. // created mapping, even after it is accessed, does not consume memory.
static error mmap_zero_into_ro(void *addr, size_t size) { static error mmap_zero_into_ro(void *addr, size_t size) {
xerr::Contextf E("mmap zero"); xerr::Contextf E("mmap zero");
etrace("");
// mmap /dev/zero with MAP_NORESERVE and MAP_SHARED // mmap /dev/zero with MAP_NORESERVE and MAP_SHARED
// this way the mapping will be able to be read, but no memory will be allocated to keep it. // this way the mapping will be able to be read, but no memory will be allocated to keep it.
......
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