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
e9c16aec
Commit
e9c16aec
authored
Jul 17, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4d006d3c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
wcfs/__init__.py
wcfs/__init__.py
+10
-7
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+2
-2
No files found.
wcfs/__init__.py
View file @
e9c16aec
...
...
@@ -260,6 +260,7 @@ def resync(wconn, at):
assert
f
.
headfsize
<=
headfsize
# head/file size ↑=
assert
headfsize
%
f
.
blksize
==
0
for
mmap
in
f
.
mmaps
:
print
(
' resync -> %s: unzero [%d:%d)'
%
(
at
,
f
.
headfsize
//
f
.
blksize
,
headfsize
//
f
.
blksize
))
memunzero
=
mmap
.
mem
[
f
.
headfsize
-
mmap
.
blk_start
*
f
.
blksize
:
headfsize
-
mmap
.
blk_start
*
f
.
blksize
]
if
len
(
memunzero
)
>
0
:
...
...
@@ -340,18 +341,20 @@ def _remmapblk(mmap, blk, at):
f
=
mmap
.
file
blkmem
=
mmap
.
mem
[(
blk
-
mmap
.
blk_start
)
*
f
.
blksize
:][:
f
.
blksize
]
if
at
is
None
:
# head/file[blk >= size] -> Z
if
blk
*
f
.
blksize
>=
f
.
headfsize
:
mm
.
map_zero_into
(
blkmem
)
return
# head/file[blk < size] -> use the file
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
)
assert
os
.
fstat
(
fsfile
.
fileno
()).
st_blksize
==
f
.
blksize
# FIXME assert
_
=
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
)
...
...
wcfs/wcfs_test.py
View file @
e9c16aec
...
...
@@ -1765,12 +1765,12 @@ def test_wcfspy_virtmem():
tm1
.
assertBlk
(
4
,
''
)
assert
f
.
pinned
==
{
2
:
at1
,
3
:
at1
}
# resync at1 -> at2: #2 must unpin to @head
# resync at1 -> at2: #2 must unpin to @head
; #4 must stay as zero
wconn
.
resync
(
at2
)
assert
f
.
pinned
==
{
3
:
at1
}
tm1
.
assertBlk
(
2
,
'c2'
)
tm1
.
assertBlk
(
3
,
'd1'
)
tm1
.
assertBlk
(
3
,
''
)
tm1
.
assertBlk
(
4
,
''
)
# resync at2 -> at3: #3 must unpin to @head; #4 - start to read with data
wconn
.
resync
(
at3
)
...
...
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