Commit cfb6df9a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 821d3909
......@@ -136,7 +136,7 @@ def _pinner(wconn, ctx):
# FIXME check if virtmem did not mapped RW page into this block already
mmap.pin(req.blk, req.at)
# update .pinned
# update f.pinned
if req.at is None:
f.pinned.pop(req.blk, None) # = delete(f.pinned, req.blk) -- unpin to @head
else:
......@@ -149,6 +149,7 @@ def _pinner(wconn, ctx):
# NOTE this does not check wrt virtmem already mapped blk as RW XXX ok?
@func(_Mapping)
def pin(mmap, blk, at):
assert mmap.blk_start <= blk < mmap.blk_stop
f = mmap.file
if at is None:
fsfile = f.headf
......@@ -174,11 +175,15 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
# create memory with head/f mapping and applied pins
mem = mm.mmap_ro(f.headf.fileno(), offset, size)
mmap = _Mapping(f, blk_start, mem)
for blk, rev in f.pin.items(): # XXX keep f.pin ↑blk and use binary search?
if not (blk_start <= blk && blk < blk_stop):
continue # blk out of this mapping
mmap.pin(blk, rev)
mm.mmap_into_ro(mem[(blk - blk_start)*blksize:][:blksize],
f.mmaps.append(mmap) # XXX keep f.mmaps ↑blk_start
return mmap
# XXX Watch
......
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