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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
6676a354
Commit
6676a354
authored
Jul 16, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4fca6260
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
wcfs/__init__.py
wcfs/__init__.py
+23
-22
No files found.
wcfs/__init__.py
View file @
6676a354
...
...
@@ -146,7 +146,7 @@ def _pinner(wconn, ctx):
continue
# blk ∉ mmap
# FIXME check if virtmem did not mapped RW page into this block already
mmap
.
_mmapblk
(
req
.
blk
,
req
.
at
)
mmap
.
_
re
mmapblk
(
req
.
blk
,
req
.
at
)
# update f.pinned
if
req
.
at
is
None
:
...
...
@@ -155,24 +155,6 @@ def _pinner(wconn, ctx):
f
.
pinned
[
req
.
blk
]
=
req
.
at
# _mmapblk 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
_mmapblk
(
mmap
,
blk
,
at
):
assert
mmap
.
blk_start
<=
blk
<
mmap
.
blk_stop
f
=
mmap
.
file
if
at
is
None
:
fsfile
=
f
.
headf
else
:
# TODO share @rev fd until wconn is resynced?
fsfile
=
f
.
wconn
.
_wc
.
_open
(
"@%s/%s"
%
(
ashex
(
at
),
ashex
(
f
.
foid
)),
"rb"
)
defer
(
fsfile
.
close
)
mm
.
mmap_into_ro
(
mmap
.
mem
[(
blk
-
mmap
.
blk_start
)
*
blksize
:][:
blksize
],
fsfile
.
fileno
(),
blk
*
blksize
)
# mmap creates file mapping representing file data as of wconn.at database state.
@
func
(
Conn
)
def
mmap
(
wconn
,
foid
,
offset
,
size
):
# -> Mapping XXX offset, size -> blkoff, blksize ?
...
...
@@ -191,20 +173,39 @@ def mmap(wconn, foid, offset, size): # -> Mapping XXX offset, size -> blko
for
blk
,
rev
in
f
.
pinned
.
items
():
# XXX keep f.pinned ↑blk and use binary search?
if
not
(
blk_start
<=
blk
&&
blk
<
blk_stop
):
continue
# blk out of this mapping
mmap
.
_mmapblk
(
blk
,
rev
)
mmap
.
_
re
mmapblk
(
blk
,
rev
)
f
.
mmaps
.
append
(
mmap
)
# XXX keep f.mmaps ↑blk_start
return
mmap
# remmap_blk remmapfs file[blk] in its place again.
# _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
if
at
is
None
:
fsfile
=
f
.
headf
else
:
# TODO share @rev fd until wconn is resynced?
fsfile
=
f
.
wconn
.
_wc
.
_open
(
"@%s/%s"
%
(
ashex
(
at
),
ashex
(
f
.
foid
)),
"rb"
)
defer
(
fsfile
.
close
)
mm
.
mmap_into_ro
(
mmap
.
mem
[(
blk
-
mmap
.
blk_start
)
*
blksize
:][:
blksize
],
fsfile
.
fileno
(),
blk
*
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
)
def
remmap_blk
(
mmap
,
blk
):
# XXX locking
assert
(
mmap
.
blk_start
<=
blk
<
mmap
.
blk_stop
)
blkrev
=
mmap
.
pinned
.
get
(
blk
,
None
)
# rev | @head
mmap
.
_mmapblk
(
blk
,
blkrev
)
mmap
.
_
re
mmapblk
(
blk
,
blkrev
)
# unmap is removes mapping memory from address space.
...
...
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