Commit d18ded8e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 594e0684
......@@ -88,33 +88,6 @@ class WCFS(_WCFS):
pass
"""
# _remmapblk remmaps mapping memory for file[blk] to be viewing database as of @at state.
#
# at=None means unpin to head/ .
# NOTE this does not check wrt virtmem already mapped blk as RW XXX ok?
@func(_Mapping)
def _remmapblk(mmap, blk, at):
assert mmap.blk_start <= blk < mmap.blk_stop
f = mmap.file
blkmem = mmap.mem[(blk-mmap.blk_start)*f.blksize:][:f.blksize]
if at is None:
fsfile = f.headf
else:
# TODO share @rev fd until wconn is resynced?
fsfile = f.wconn._wc._open("@%s/bigfile/%s" % (h(at), h(f.foid)), "rb")
defer(fsfile.close)
_ = os.fstat(fsfile.fileno())
assert _.st_blksize == f.blksize # FIXME assert
# block is beyond file size - mmap with zeros (assumes head/f size ↑=)
if (blk+1)*f.blksize > _.st_size:
mm.map_zero_into_ro(blkmem)
# block is inside file - mmap file data
else:
mm.map_into_ro(blkmem, fsfile.fileno(), blk*f.blksize)
# remmap_blk remmaps file[blk] in its place again.
# virtmem calls this to remmap a block after RW dirty page was e.g. discarded.
@func(_Mapping)
......
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