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
e83b9085
Commit
e83b9085
authored
Feb 14, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
eab13d28
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
12 deletions
+29
-12
bigfile/file_zodb.cpp
bigfile/file_zodb.cpp
+5
-1
wcfs/client/_wcfs.pxd
wcfs/client/_wcfs.pxd
+2
-2
wcfs/client/_wcfs.pyx
wcfs/client/_wcfs.pyx
+5
-3
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+7
-3
wcfs/client/wcfs.h
wcfs/client/wcfs.h
+10
-3
No files found.
bigfile/file_zodb.cpp
View file @
e83b9085
...
...
@@ -61,11 +61,15 @@ static int zfile_remmap_blk_read(VMA *vma, BigFile *file, blk_t blk) {
static
void
zfile_munmap
(
VMA
*
vma
,
BigFile
*
file
)
{
error
err
;
// 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
;
mmap
->
unmap
();
err
=
mmap
->
unmap
();
if
(
err
!=
nil
)
panic
(
v
(
err
));
// XXX
// XXX close mmap->fileh
}
...
...
wcfs/client/_wcfs.pxd
View file @
e83b9085
...
...
@@ -111,7 +111,7 @@ cdef extern from "wcfs/client/wcfs.h" namespace "wcfs" nogil:
uint8_t
*
mem_start
uint8_t
*
mem_stop
void
unmap
()
error
unmap
()
cppclass
Mapping
(
refptr
[
_Mapping
]):
# Mapping.X = Mapping->X in C++
...
...
@@ -121,7 +121,7 @@ cdef extern from "wcfs/client/wcfs.h" namespace "wcfs" nogil:
uint8_t
*
mem_start
"_ptr()->mem_start"
uint8_t
*
mem_stop
"_ptr()->mem_stop"
void
unmap
"_ptr()->unmap"
()
error
unmap
"_ptr()->unmap"
()
cxx
.
dict
[
int64_t
,
Tid
]
_tfileh_pinned
(
FileH
wfileh
)
...
...
wcfs/client/_wcfs.pyx
View file @
e83b9085
...
...
@@ -155,7 +155,9 @@ cdef class PyMapping:
def
unmap
(
PyMapping
pywmmap
):
with
nogil
:
wmmap_unmap_pyexc
(
pywmmap
.
wmmap
)
# XXX +err
err
=
wmmap_unmap_pyexc
(
pywmmap
.
wmmap
)
if
err
!=
nil
:
raise
pyerr
(
err
)
# ----------------------------------------
...
...
@@ -291,8 +293,8 @@ cdef nogil:
pair
[
Mapping
,
error
]
wfileh_mmap_pyexc
(
FileH
wfileh
,
int64_t
blk_start
,
int64_t
blk_len
)
except
+
topyexc
:
return
wfileh
.
mmap
(
blk_start
,
blk_len
)
void
wmmap_unmap_pyexc
(
Mapping
wmmap
)
except
+
topyexc
:
wmmap
.
unmap
()
error
wmmap_unmap_pyexc
(
Mapping
wmmap
)
except
+
topyexc
:
return
wmmap
.
unmap
()
error
wlink_close_pyexc
(
WatchLink
wlink
)
except
+
topyexc
:
return
wlink
.
close
()
...
...
wcfs/client/wcfs.cpp
View file @
e83b9085
...
...
@@ -606,25 +606,29 @@ void _Mapping::remmap_blk(int64_t blk) {
// unmap removes mapping memory from address space.
// virtmem calls this when VMA is unmapped.
void
_Mapping
::
unmap
()
{
error
_Mapping
::
unmap
()
{
Mapping
mmap
=
newref
(
this
);
// XXX newref for std::remove
FileH
f
=
mmap
->
fileh
;
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: f<%s>: unmap"
,
v
(
f
->
wconn
->
_wc
->
mountpoint
),
v
(
f
->
wconn
->
at
),
v
(
f
->
foid
));
// XXX locking
error
err
=
mm
::
unmap
(
mmap
->
mem_start
,
mmap
->
mem_stop
-
mmap
->
mem_start
);
if
(
err
!=
nil
)
panic
(
v
(
err
));
// XXX
return
E
(
err
);
mmap
->
mem_start
=
NULL
;
mmap
->
mem_stop
=
NULL
;
// XXX clear other fields?
FileH
f
=
mmap
->
fileh
;
//f->_mmaps.remove(mmap);
// FIXME keep mmaps sorted
f
->
_mmaps
.
erase
(
std
::
remove
(
f
->
_mmaps
.
begin
(),
f
->
_mmaps
.
end
(),
mmap
),
f
->
_mmaps
.
end
());
return
nil
;
}
...
...
wcfs/client/wcfs.h
View file @
e83b9085
...
...
@@ -141,6 +141,7 @@ struct PinReq;
// XXX raw files?
//
// WCFS logically mirrors ZODB.DB .
// It is safe to use WCFS from multiple threads simultaneously.
struct
WCFS
{
string
mountpoint
;
...
...
@@ -162,10 +163,11 @@ struct WCFS {
// Use .resync to resync Conn onto different database view.
//
// Conn logically mirrors ZODB.Connection .
// It is safe to use Conn from multiple threads simultaneously.
typedef
refptr
<
struct
_Conn
>
Conn
;
struct
_Conn
:
object
{
WCFS
*
_wc
;
zodb
::
Tid
at
;
zodb
::
Tid
at
;
// XXX -> under mu
WatchLink
_wlink
;
// watch/receive pins for mappings created under this conn
// XXX kill downMu? (move under filehmu so that e.g. .open() can check downErr without race)
...
...
@@ -205,6 +207,8 @@ private:
// /head/<file>/data primarily and /@revX/<file>/data pin overrides.
//
// Use .mmap to map file view into memory.
//
// It is safe to use FileH from multiple threads simultaneously.
typedef
refptr
<
struct
_FileH
>
FileH
;
struct
_FileH
:
object
{
Conn
wconn
;
...
...
@@ -232,6 +236,9 @@ public:
// Mapping represents one memory mapping of FileH.
//
// The mapped memory is [.mem_start, .mem_stop)
// Use .unmap to release virtual memory resources used by mapping.
//
// XXX It is safe to use Mapping from multiple threads simultaneously.
typedef
refptr
<
struct
_Mapping
>
Mapping
;
struct
_Mapping
:
object
{
FileH
fileh
;
...
...
@@ -247,8 +254,8 @@ struct _Mapping : object {
}
error
_remmapblk
(
int64_t
blk
,
zodb
::
Tid
at
);
void
remmap_blk
(
int64_t
blk
);
void
unmap
();
void
remmap_blk
(
int64_t
blk
);
// for virtmem-only
error
unmap
();
// don't new - create via FileH.mmap
private:
...
...
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