Commit 37a1acb4 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d8138920
......@@ -190,32 +190,49 @@ def _pinner(wconn, ctx):
return # XXX ok? (EOF - when wcfs closes wlink)
# we received request to pin/unpin file block. perform it
trace('lock _filemu ...')
with wconn._filemu:
trace('_filemu locked')
f = wconn._filetab.get(req.foid)
if f is None:
1/0 # XXX we are not watching the file - why wcfs sent us this update?
trace(f)
# XXX relock wconn -> f ?
for mmap in f.mmaps: # XXX use ↑blk_start for binary search
trace('\t%s' % mmap)
if not (mmap.blk_start <= req.blk < mmap.blk_stop):
continue # blk ∉ mmap
trace('\tremmapblk %d @%s' % (req.blk, h(req.at)))
# FIXME check if virtmem did not mapped RW page into this block already
mmap._remmapblk(req.blk, req.at)
trace('\t-> remmaped')
# update f.pinned
if req.at is None:
f.pinned.pop(req.blk, None) # = delete(f.pinned, req.blk) -- unpin to @head
else:
f.pinned[req.blk] = req.at
wconn._pin1(req)
# pin1 handles one pin request received from wcfs
@func(Conn)
def _pin1(wconn, req):
# reply either ack or nak on error
def _():
ack = "ack"
exc = sys.exc_info()[1]
if exc is not None:
ack = "nak: %s" % exc
req.reply(ack)
defer(_)
def trace(msg):
print('pin1: %s' % msg)
trace('lock _filemu ...')
with wconn._filemu:
trace('_filemu locked')
f = wconn._filetab.get(req.foid)
if f is None:
1/0 # XXX we are not watching the file - why wcfs sent us this update?
trace(f)
# XXX relock wconn -> f ?
for mmap in f.mmaps: # XXX use ↑blk_start for binary search
trace('\t%s' % mmap)
if not (mmap.blk_start <= req.blk < mmap.blk_stop):
continue # blk ∉ mmap
trace('\tremmapblk %d @%s' % (req.blk, h(req.at)))
# FIXME check if virtmem did not mapped RW page into this block already
mmap._remmapblk(req.blk, req.at)
trace('\t-> remmaped')
# update f.pinned
if req.at is None:
f.pinned.pop(req.blk, None) # = delete(f.pinned, req.blk) -- unpin to @head
else:
f.pinned[req.blk] = req.at
# mmap creates file mapping representing file[blk_start +blk_len) data as of wconn.at database state.
......
......@@ -1760,7 +1760,7 @@ def test_wcfspy_virtmem():
assert f.pinned == {2:at1}
tm1.assertBlk(3, 'd1')
assert f.pinned == {2:at1}
tm1.assertBlk(3, 'x')
tm1.assertBlk(4, 'x')
assert f.pinned == {2:at1}
#assertData (m1, ['c1','d1',''])
......
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