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
b546edf6
Commit
b546edf6
authored
Feb 17, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ded803b0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
include/wendelin/bigfile/file.h
include/wendelin/bigfile/file.h
+3
-3
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+24
-0
No files found.
include/wendelin/bigfile/file.h
View file @
b546edf6
...
@@ -129,7 +129,7 @@ struct bigfile_ops {
...
@@ -129,7 +129,7 @@ struct bigfile_ops {
* virt_unlock()
* virt_unlock()
*
*
* XXX mention VMA.mmap_overlay_server?
* XXX mention VMA.mmap_overlay_server?
*
XXX called under virtmem lock?
*
called under virtmem lock
*
*
* NOTE blk and blklen are in blocks, not pages.
* NOTE blk and blklen are in blocks, not pages.
*
*
...
@@ -142,14 +142,14 @@ struct bigfile_ops {
...
@@ -142,14 +142,14 @@ struct bigfile_ops {
// remmap_blk_read is called to remmap a block into vma again, after e.g.
// remmap_blk_read is called to remmap a block into vma again, after e.g.
// RW dirty page was discarded.
// RW dirty page was discarded.
//
//
//
XXX called under virtmem lock?
//
called under virtmem lock.
//
//
// XXX error -> bug (must not fail)
// XXX error -> bug (must not fail)
int
(
*
remmap_blk_read
)
(
VMA
*
vma
,
BigFile
*
file
,
blk_t
blk
);
int
(
*
remmap_blk_read
)
(
VMA
*
vma
,
BigFile
*
file
,
blk_t
blk
);
/* munmap is called when vma set up via mmap_setup_read is going to be unmapped.
/* munmap is called when vma set up via mmap_setup_read is going to be unmapped.
*
*
*
XXX called under virtmem lock?
*
called under virtmem lock.
* Must not fail.
* Must not fail.
*/
*/
void
(
*
munmap
)
(
VMA
*
vma
,
BigFile
*
file
);
void
(
*
munmap
)
(
VMA
*
vma
,
BigFile
*
file
);
...
...
wcfs/client/wcfs.cpp
View file @
b546edf6
...
@@ -259,6 +259,7 @@ error _Conn::__pin1(PinReq *req) {
...
@@ -259,6 +259,7 @@ error _Conn::__pin1(PinReq *req) {
bool
do_pin
=
true
;
bool
do_pin
=
true
;
error
err
;
error
err
;
if
(
mmap
->
vma
!=
nil
)
{
if
(
mmap
->
vma
!=
nil
)
{
mmap
->
assertVMAOk
();
virt_lock
();
virt_lock
();
BigFileH
*
virt_fileh
=
mmap
->
vma
->
fileh
;
BigFileH
*
virt_fileh
=
mmap
->
vma
->
fileh
;
TODO
(
mmap
->
fileh
->
blksize
!=
virt_fileh
->
ramh
->
ram
->
pagesize
);
TODO
(
mmap
->
fileh
->
blksize
!=
virt_fileh
->
ramh
->
ram
->
pagesize
);
...
@@ -459,6 +460,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
...
@@ -459,6 +460,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
vma
->
mmap_overlay_server
=
mmap
.
_ptr
();
vma
->
mmap_overlay_server
=
mmap
.
_ptr
();
vma
->
addr_start
=
(
uintptr_t
)
mmap
->
mem_start
;
vma
->
addr_start
=
(
uintptr_t
)
mmap
->
mem_start
;
vma
->
addr_stop
=
(
uintptr_t
)
mmap
->
mem_stop
;
vma
->
addr_stop
=
(
uintptr_t
)
mmap
->
mem_stop
;
mmap
.
assertVMAOk
();
// just in case
}
}
f
.
_mmaps
.
push_back
(
mmap
);
// TODO keep f._mmaps ↑blk_start
f
.
_mmaps
.
push_back
(
mmap
);
// TODO keep f._mmaps ↑blk_start
...
@@ -481,6 +483,12 @@ error _Mapping::unmap() {
...
@@ -481,6 +483,12 @@ error _Mapping::unmap() {
// XXX make sure mmap cannot be XXX
// XXX make sure mmap cannot be XXX
if
(
mmap
->
vma
!=
nil
)
{
if
(
mmap
->
vma
!=
nil
)
{
// must be called under virtmem lock fo virtmem-intergrated case (?)
mmap
->
assertVMAOk
();
VMA
*
vma
=
mmap
->
vma
;
vma
->
mmap_overlay_server
=
NULL
;
vma
->
addr_start
=
0
;
vma
->
addr_stop
=
0
;
}
}
error
err
=
mm
::
unmap
(
mmap
->
mem_start
,
mmap
->
mem_stop
-
mmap
->
mem_start
);
error
err
=
mm
::
unmap
(
mmap
->
mem_start
,
mmap
->
mem_stop
-
mmap
->
mem_start
);
...
@@ -728,6 +736,22 @@ void _Mapping::decref() {
...
@@ -728,6 +736,22 @@ void _Mapping::decref() {
delete
this
;
delete
this
;
}
}
// assertVMAOk() verifies that mmap and vma are related to each other and cover
// exactly the same virtual memory rane.
//
// It panics if mmap and vma do not exactly relate to each other or cover
// different virtual memory range.
void
_Mapping
::
assertVMAOk
()
{
_Mapping
*
mmap
=
this
;
VMA
*
vma
=
mmap
.
vma
;
if
(
!
(
vma
->
mmap_overlay_server
==
mmap
.
_ptr
()))
panic
(
"BUG: mmap and vma do not link to each other"
);
if
(
!
(
vma
->
addr_start
==
mmap
->
mem_start
&&
vma
->
addr_stop
==
mmap
->
mem_stop
))
panic
(
"BUG: mmap and vma cover different virtual memory ranges"
);
// verified ok
}
dict
<
int64_t
,
zodb
::
Tid
>
_tfileh_pinned
(
FileH
fileh
)
{
dict
<
int64_t
,
zodb
::
Tid
>
_tfileh_pinned
(
FileH
fileh
)
{
return
fileh
->
_pinned
;
return
fileh
->
_pinned
;
...
...
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