Commit 4fca6260 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0e8a1ecb
...@@ -143,7 +143,7 @@ def _pinner(wconn, ctx): ...@@ -143,7 +143,7 @@ def _pinner(wconn, ctx):
for mmap in f.mmaps: # XXX use ↑blk_start for binary search for mmap in f.mmaps: # XXX use ↑blk_start for binary search
if not (mmap.blk_start <= req.blk && req.blk < mmap.blk_stop): if not (mmap.blk_start <= req.blk && req.blk < mmap.blk_stop):
continue continue # blk ∉ mmap
# FIXME check if virtmem did not mapped RW page into this block already # FIXME check if virtmem did not mapped RW page into this block already
mmap._mmapblk(req.blk, req.at) mmap._mmapblk(req.blk, req.at)
...@@ -166,14 +166,14 @@ def _mmapblk(mmap, blk, at): ...@@ -166,14 +166,14 @@ def _mmapblk(mmap, blk, at):
if at is None: if at is None:
fsfile = f.headf fsfile = f.headf
else: else:
# TODO share @rev fd until wconn is recynced? # TODO share @rev fd until wconn is resynced?
fsfile = f.wconn._wc._open("@%s/%s" % (ashex(at), ashex(f.foid)), "rb") fsfile = f.wconn._wc._open("@%s/%s" % (ashex(at), ashex(f.foid)), "rb")
defer(fsfile.close) defer(fsfile.close)
mm.mmap_into_ro(mmap.mem[(blk-mmap.blk_start)*blksize:][:blksize], fsfile.fileno(), blk*blksize) mm.mmap_into_ro(mmap.mem[(blk-mmap.blk_start)*blksize:][:blksize], fsfile.fileno(), blk*blksize)
# mmap creats file mapping representing file data as of wconn.at database state. # mmap creates file mapping representing file data as of wconn.at database state.
@func(Conn) @func(Conn)
def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blkoff, blksize ? def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blkoff, blksize ?
with wconn._filemu: with wconn._filemu:
...@@ -215,6 +215,8 @@ def unmap(mmap): ...@@ -215,6 +215,8 @@ def unmap(mmap):
mm.unmap(mmap.mem) mm.unmap(mmap.mem)
mmap.mem = None mmap.mem = None
mmap.file.mmaps.remove(mmap)
# WatchLink represents /head/watch link opened on wcfs. # WatchLink represents /head/watch link opened 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