Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
37a1acb4
Commit
37a1acb4
authored
5 years ago
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d8138920
x/gogccrash
t
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
27 deletions
+44
-27
wcfs/__init__.py
wcfs/__init__.py
+43
-26
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+1
-1
No files found.
wcfs/__init__.py
View file @
37a1acb4
...
...
@@ -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
(
'
\
t
remmapblk %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
(
'
\
t
remmapblk %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.
...
...
This diff is collapsed.
Click to expand it.
wcfs/wcfs_test.py
View file @
37a1acb4
...
...
@@ -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',''])
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment