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
272e43bd
Commit
272e43bd
authored
Jan 15, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
60dacc49
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
wcfs/internal/wcfs.cpp
wcfs/internal/wcfs.cpp
+17
-19
No files found.
wcfs/internal/wcfs.cpp
View file @
272e43bd
...
...
@@ -77,7 +77,7 @@ static error mmap_into_ro(void *addr, size_t size, os::File f, off_t offset);
// connect creates new Conn viewing WCFS state as of @at.
pair
<
Conn
,
error
>
WCFS
::
connect
(
zodb
::
Tid
at
)
{
WCFS
*
wc
=
this
;
// XXX errctx "connect @%s", at
xerr
::
Contextf
E
(
"connect @%s"
,
v
(
at
));
// XXX +wc path?
// TODO support !isolated mode
...
...
@@ -85,7 +85,7 @@ pair<Conn, error> WCFS::connect(zodb::Tid at) {
error
err
;
tie
(
wlink
,
err
)
=
wc
->
_openwatch
();
if
(
err
!=
nil
)
return
make_pair
(
nil
,
err
);
return
make_pair
(
nil
,
E
(
err
)
);
Conn
wconn
=
adoptref
(
new
_Conn
());
wconn
->
_wc
=
wc
;
...
...
@@ -108,8 +108,10 @@ pair<Conn, error> WCFS::connect(zodb::Tid at) {
// XXX what happens to file mmappings?
error
_Conn
::
close
()
{
_Conn
&
wconn
=
*
this
;
// XXX errctx "close conn @%s", wconn.at
//xerr::Contextf E("close conn @%s", v(wconn.at));
xerr
::
Contextf
E
(
"wcfs %s: close conn @%s"
,
v
(
wconn
.
_wc
->
mountpoint
),
v
(
wconn
.
at
));
// XXX + conn # e.g. from wconn._wlink.id? or wlink.close should include its id itself?
error
err
,
eret
;
auto
reterr1
=
[
&
eret
](
error
err
)
{
if
(
eret
==
nil
&&
err
!=
nil
)
...
...
@@ -122,7 +124,7 @@ error _Conn::close() {
wconn
.
_pinCancel
();
err
=
wconn
.
_pinWG
->
wait
();
if
(
err
!=
context
::
canceled
)
// canceled - ok
reterr1
(
err
);
reterr1
(
fmt
::
errorf
(
"pinwg.wait: %s"
,
v
(
err
)));
// XXX remove errctx
// close all files - both that have no mappings and that still have opened mappings.
// XXX after file is closed mappings continue to survive, but we can no
...
...
@@ -145,11 +147,7 @@ error _Conn::close() {
wconn
.
_filehtab
.
clear
();
// XXX -> try to xerr.Contextf at top
if
(
eret
!=
nil
)
eret
=
fmt
::
errorf
(
"close conn @%s: %s"
,
v
(
wconn
.
at
),
v
(
eret
));
return
eret
;
return
E
(
eret
);
}
// _pinner receives pin messages from wcfs and adjusts wconn mappings.
...
...
@@ -196,7 +194,7 @@ void _Conn::_pin1(PinReq *req) {
// reply either ack or nak on error
string
ack
=
"ack"
;
if
(
err
!=
nil
)
ack
=
fmt
::
sprintf
(
"nak: %s"
,
err
->
Error
().
c_str
(
));
ack
=
fmt
::
sprintf
(
"nak: %s"
,
v
(
err
));
wconn
.
_wlink
->
replyReq
(
context
::
background
(),
req
,
ack
);
// XXX ctx ok?
}
...
...
@@ -259,7 +257,7 @@ error _Conn::__pin1(PinReq *req) {
pair
<
FileH
,
error
>
_Conn
::
open
(
zodb
::
Oid
foid
)
{
_Conn
&
wconn
=
*
this
;
error
err
;
// XXX err ctx
xerr
::
Contextf
E
(
"conn @%s: open f<%s>"
,
v
(
wconn
.
at
),
v
(
foid
));
wconn
.
_filehmu
.
lock
();
defer
([
&
]()
{
...
...
@@ -281,16 +279,16 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
tie
(
f
->
_headf
,
err
)
=
wconn
.
_wc
->
_open
(
fmt
::
sprintf
(
"head/bigfile/%s"
,
v
(
foid
)));
if
(
err
!=
nil
)
return
make_pair
(
nil
,
err
);
return
make_pair
(
nil
,
E
(
err
)
);
struct
stat
st
;
err
=
f
->
_headf
->
stat
(
&
st
);
if
(
err
!=
nil
)
return
make_pair
(
nil
,
err
);
return
make_pair
(
nil
,
E
(
err
));
// XXX close headf
f
->
blksize
=
st
.
st_blksize
;
f
->
_headfsize
=
st
.
st_size
;
if
(
!
(
f
->
_headfsize
%
f
->
blksize
==
0
))
return
make_pair
(
nil
,
fmt
::
errorf
(
"wcfs bug: head/file size %% blksize != 0"
));
if
(
!
(
f
->
_headfsize
%
f
->
blksize
==
0
))
// XXX close headf
return
make_pair
(
nil
,
E
(
fmt
::
errorf
(
"wcfs bug: head/file size %% blksize != 0"
)
));
wconn
.
_filehtab
[
foid
]
=
f
;
...
...
@@ -298,11 +296,11 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
string
ack
;
tie
(
ack
,
err
)
=
wconn
.
_wlink
->
sendReq
(
context
::
background
(),
fmt
::
sprintf
(
"watch %s @%s"
,
v
(
foid
),
v
(
wconn
.
at
)));
if
(
err
!=
nil
)
return
make_pair
(
nil
,
err
);
return
make_pair
(
nil
,
E
(
err
)
);
if
(
ack
!=
"ok"
)
{
// XXX unregister f from _filehtab
// XXX
vvv -> errctx?
return
make_pair
(
nil
,
fmt
::
errorf
(
"
@%s: open f<%s>: watch: %s"
,
v
(
wconn
.
at
),
v
(
foid
),
ack
.
c_str
(
)));
// XXX
close headf
return
make_pair
(
nil
,
fmt
::
errorf
(
"
watch: %s"
,
v
(
ack
)));
}
return
make_pair
(
f
,
nil
);
...
...
@@ -431,7 +429,7 @@ error _Conn::resync(zodb::Tid at) {
if
(
ack
!=
"ok"
)
{
// XXX unregister f from _filehtab
// XXX vvv -> errctx?
return
fmt
::
errorf
(
"resync @%s -> @%s: f<%s>: %s"
,
v
(
wconn
.
at
),
v
(
at
),
v
(
foid
),
ack
.
c_str
(
));
return
fmt
::
errorf
(
"resync @%s -> @%s: f<%s>: %s"
,
v
(
wconn
.
at
),
v
(
at
),
v
(
foid
),
v
(
ack
));
}
}
...
...
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