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
a80e3140
Commit
a80e3140
authored
Feb 17, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b546edf6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
11 deletions
+19
-11
bigfile/file_zodb.cpp
bigfile/file_zodb.cpp
+3
-0
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+15
-11
wcfs/client/wcfs.h
wcfs/client/wcfs.h
+1
-0
No files found.
bigfile/file_zodb.cpp
View file @
a80e3140
...
...
@@ -66,10 +66,13 @@ static int zfile_remmap_blk_read(VMA *vma, BigFile *file, blk_t blk) {
static
void
zfile_munmap
(
VMA
*
vma
,
BigFile
*
file
)
{
error
err
;
wcfs
::
_Mapping
*
mmap
=
static_cast
<
wcfs
::
_Mapping
*>
(
vma
->
mmap_overlay_server
);
#if 0
// NOTE taking 1 ref back from vma->mmap_overlay_server
wcfs::Mapping mmap = adoptref(static_cast<wcfs::_Mapping*>(vma->mmap_overlay_server));
vma->mmap_overlay_server = NULL;
#endif
err
=
mmap
->
unmap
();
if
(
err
!=
nil
)
...
...
wcfs/client/wcfs.cpp
View file @
a80e3140
...
...
@@ -259,7 +259,7 @@ error _Conn::__pin1(PinReq *req) {
bool
do_pin
=
true
;
error
err
;
if
(
mmap
->
vma
!=
nil
)
{
mmap
->
assertVMAOk
();
mmap
->
_
assertVMAOk
();
virt_lock
();
BigFileH
*
virt_fileh
=
mmap
->
vma
->
fileh
;
TODO
(
mmap
->
fileh
->
blksize
!=
virt_fileh
->
ramh
->
ram
->
pagesize
);
...
...
@@ -460,7 +460,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
vma
->
mmap_overlay_server
=
mmap
.
_ptr
();
vma
->
addr_start
=
(
uintptr_t
)
mmap
->
mem_start
;
vma
->
addr_stop
=
(
uintptr_t
)
mmap
->
mem_stop
;
mmap
.
assertVMAOk
();
// just in case
mmap
->
_
assertVMAOk
();
// just in case
}
f
.
_mmaps
.
push_back
(
mmap
);
// TODO keep f._mmaps ↑blk_start
...
...
@@ -472,7 +472,9 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
// unmap releases mapping memory from address space.
//
// After call to unmap the mapping must no longer be used.
// virtmem calls unmap when VMA is unmapped.
//
// virtmem calls unmap when VMA is unmapped, thus
// unmap must be called under virtmem lock for mappings associated with a VMA.
error
_Mapping
::
unmap
()
{
Mapping
mmap
=
newref
(
this
);
// XXX newref for std::remove
FileH
f
=
mmap
->
fileh
;
...
...
@@ -483,12 +485,13 @@ error _Mapping::unmap() {
// XXX make sure mmap cannot be XXX
if
(
mmap
->
vma
!=
nil
)
{
// must be called under virtmem lock fo virtmem-intergrated case (?)
mmap
->
assertVMAOk
();
mmap
->
_assertVMAOk
();
VMA
*
vma
=
mmap
->
vma
;
vma
->
mmap_overlay_server
=
NULL
;
vma
->
mmap_overlay_server
=
nil
;
mmap
->
decref
();
// vma->mmap_overlay_server was holding a ref to mmap
vma
->
addr_start
=
0
;
vma
->
addr_stop
=
0
;
mmap
->
vma
=
nil
;
}
error
err
=
mm
::
unmap
(
mmap
->
mem_start
,
mmap
->
mem_stop
-
mmap
->
mem_start
);
...
...
@@ -736,18 +739,19 @@ void _Mapping::decref() {
delete
this
;
}
// assertVMAOk() verifies that mmap and vma are related to each other and cover
//
_
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
()
{
void
_Mapping
::
_
assertVMAOk
()
{
_Mapping
*
mmap
=
this
;
VMA
*
vma
=
mmap
.
vma
;
VMA
*
vma
=
mmap
->
vma
;
if
(
!
(
vma
->
mmap_overlay_server
==
mmap
.
_ptr
(
)))
if
(
!
(
vma
->
mmap_overlay_server
==
static_cast
<
void
*>
(
mmap
)))
panic
(
"BUG: mmap and vma do not link to each other"
);
if
(
!
(
vma
->
addr_start
==
mmap
->
mem_start
&&
vma
->
addr_stop
==
mmap
->
mem_stop
))
if
(
!
(
vma
->
addr_start
==
uintptr_t
(
mmap
->
mem_start
)
&&
vma
->
addr_stop
==
uintptr_t
(
mmap
->
mem_stop
)))
panic
(
"BUG: mmap and vma cover different virtual memory ranges"
);
// verified ok
...
...
wcfs/client/wcfs.h
View file @
a80e3140
...
...
@@ -262,6 +262,7 @@ struct _Mapping : object {
return
blk_start
+
(
mem_stop
-
mem_start
)
/
fileh
->
blksize
;
}
void
_assertVMAOk
();
error
_remmapblk
(
int64_t
blk
,
zodb
::
Tid
at
);
error
remmap_blk
(
int64_t
blk
);
// for virtmem-only
error
unmap
();
...
...
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