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
a1a06fea
Commit
a1a06fea
authored
Feb 14, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
3310888d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
6 deletions
+25
-6
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+14
-4
wcfs/client/wcfs.h
wcfs/client/wcfs.h
+11
-2
No files found.
wcfs/client/wcfs.cpp
View file @
a1a06fea
...
...
@@ -45,6 +45,9 @@
// Mapping FileH
//
// XXX locking -> explain atMu + slaves and refer to "Locking" in wcfs.go
#include "wcfs_misc.h"
#include "wcfs.h"
#include "wcfs_watchlink.h"
...
...
@@ -297,6 +300,9 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
error
err
;
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: open f<%s>"
,
v
(
wconn
.
_wc
->
mountpoint
),
v
(
wconn
.
at
),
v
(
foid
));
// XXX wconn._atMu.RLock()
// XXX defer wconn._atMu.RUnlock()
wconn
.
_filehmu
.
lock
();
defer
([
&
]()
{
wconn
.
_filehmu
.
unlock
();
...
...
@@ -401,6 +407,9 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
panic
(
"(blk_start + blk_len)*f.blksize overflow int64"
);
int64_t
start
=
blk_start
*
f
.
blksize
;
// XXX wconn.atMu.RLock()
// XXX defer wconn.atMu.RUnlock()
// XXX f locking?
// create memory with head/f mapping and applied pins
...
...
@@ -459,6 +468,9 @@ error _Conn::resync(zodb::Tid at) {
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: resync -> @%s"
,
v
(
wconn
.
_wc
->
mountpoint
),
v
(
wconn
.
at
),
v
(
at
));
// XXX locking
// wconn.atMu.Lock()
// defer wconn.atMu.Unlock()
error
err
;
wconn
.
_downMu
.
lock
();
...
...
@@ -517,7 +529,6 @@ error _Conn::resync(zodb::Tid at) {
if
(
err
!=
nil
)
return
E
(
err
);
if
(
ack
!=
"ok"
)
{
// XXX unregister f from _filehtab ?
return
E
(
fmt
::
errorf
(
"%s"
,
v
(
ack
)));
}
}
...
...
@@ -617,10 +628,9 @@ error _Mapping::unmap() {
v
(
f
->
wconn
->
_wc
->
mountpoint
),
v
(
f
->
wconn
->
at
),
v
(
f
->
foid
));
// XXX locking
// XXX make sure mmap cannot be XXX
error
err
=
mm
::
unmap
(
mmap
->
mem_start
,
mmap
->
mem_stop
-
mmap
->
mem_start
);
if
(
err
!=
nil
)
return
E
(
err
);
mmap
->
mem_start
=
NULL
;
mmap
->
mem_stop
=
NULL
;
// XXX clear other fields?
...
...
@@ -632,7 +642,7 @@ error _Mapping::unmap() {
std
::
remove
(
f
->
_mmaps
.
begin
(),
f
->
_mmaps
.
end
(),
mmap
),
f
->
_mmaps
.
end
());
return
nil
;
return
E
(
err
)
;
}
...
...
wcfs/client/wcfs.h
View file @
a1a06fea
...
...
@@ -167,14 +167,23 @@ struct WCFS {
typedef
refptr
<
struct
_Conn
>
Conn
;
struct
_Conn
:
object
{
WCFS
*
_wc
;
zodb
::
Tid
at
;
// XXX -> under mu
WatchLink
_wlink
;
// watch/receive pins for mappings created under this conn
// atMu protects .at.
// While it is rlocked, .at is guaranteed to stay unchanged and Conn
// viewing the database at particular state. .resync write-locks this and
// knows noone is using the connection for reading simultaneously.
//
// XXX deadlock with pinner?
//
// sync::RWMutex _atMu
zodb
::
Tid
at
;
// XXX kill downMu? (move under filehmu so that e.g. .open() can check downErr without race)
sync
::
Mutex
_downMu
;
error
_downErr
;
// !nil if connection is closed or no longer operational
sync
::
Mutex
_filehmu
;
sync
::
Mutex
_filehmu
;
// _atMu.W | _atMu.R + _filehMu
dict
<
zodb
::
Oid
,
FileH
>
_filehtab
;
// {} foid -> fileh
sync
::
WorkGroup
_pinWG
;
// pin/unpin messages from wcfs are served by _pinner
...
...
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