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
a8bbffa9
Commit
a8bbffa9
authored
Mar 02, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
26bc909a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
19 deletions
+14
-19
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+9
-11
wcfs/client/wcfs.h
wcfs/client/wcfs.h
+5
-8
No files found.
wcfs/client/wcfs.cpp
View file @
a8bbffa9
...
...
@@ -676,22 +676,22 @@ retry:
f
->
_headfsize
=
0
;
f
->
_state
=
_FileHOpening
;
f
->
_nopen
=
1
;
f
->
_closed
=
false
;
bool
retok
=
false
;
wconn
.
_filehTab
[
foid
]
=
f
;
defer
([
&
]()
{
wconn
.
_mu
.
Lock
();
if
(
wconn
.
_filehTab
.
get
(
foid
)
!=
f
)
{
wconn
.
_mu
.
Unlock
();
panic
(
"BUG: wconn.open: wconn.filehTab[foid] mutated while file open was in progress"
);
}
if
(
!
retok
)
{
wconn
.
_mu
.
Lock
();
// don't care about f->_nopen-- since f is not returned anywhere
if
(
wconn
.
_filehTab
.
get
(
foid
)
!=
f
)
{
wconn
.
_mu
.
Unlock
();
panic
(
"BUG: wconn.open: wconn.filehTab[foid] mutated while file open was in progress"
);
}
wconn
.
_filehTab
.
erase
(
foid
);
wconn
.
_mu
.
Unlock
();
}
else
{
f
->
_state
=
_FileHOpened
;
}
f
->
_state
=
_FileHOpened
;
// XXX move under wconn._mu ?
wconn
.
_mu
.
Unlock
();
f
->
_openReady
.
close
();
});
wconn
.
_mu
.
Unlock
();
...
...
@@ -768,7 +768,6 @@ error _FileH::close() {
});
// fileh.close can be called several times. just return nil for second close.
// if (fileh._closed)
if
(
fileh
.
_state
>=
_FileHClosing
)
return
nil
;
...
...
@@ -818,7 +817,6 @@ error _FileH::close() {
fileh
.
_state
=
_FileHClosed
;
// XXX locking
fileh
.
_closedq
.
close
();
fileh
.
_closed
=
true
;
return
E
(
eret
);
}
...
...
@@ -840,7 +838,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
xerr
::
Contextf
E
(
"%s: mmap f<%s> [blk%ld +blk%ld)"
,
v
(
f
.
wconn
),
v
(
f
.
foid
),
blk_start
,
blk_len
);
if
(
f
.
_
closed
)
// XXX locking
if
(
f
.
_
state
>=
_FileHClosing
)
// XXX locking
return
make_pair
(
nil
,
E
(
os
::
ErrClosed
));
error
err
;
...
...
wcfs/client/wcfs.h
View file @
a8bbffa9
...
...
@@ -231,6 +231,11 @@ struct _FileH : object {
Conn
wconn
;
zodb
::
Oid
foid
;
// ZBigFile root object ID (does not change after fileh open)
// protect by wconn.mu
_FileHState
_state
;
// opening/opened/closing/closed
int
_nopen
;
// number of times Conn.open returned this fileh
bool
_closed
;
// y after .close()
chan
<
structZ
>
_openReady
;
// in-flight open completed
error
_openErr
;
// error result from open
chan
<
structZ
>
_closedq
;
// in-flight close completed
...
...
@@ -246,14 +251,6 @@ struct _FileH : object {
dict
<
int64_t
,
zodb
::
Tid
>
_pinned
;
// {} blk -> rev that wcfs already sent us for this file
vector
<
Mapping
>
_mmaps
;
// []Mapping ↑blk_start mappings of this file
// XXX protect by wconn.mu ?
enum
_FileHState
_state
;
// opening/opened/closing/closed
int
_nopen
;
// number of times Conn.open returned this fileh
bool
_closed
;
// y after .close()
// "watch <.foid> ..." requests we send to wcfs are serialized via FileH._watchMu
// XXX sync::Mutex _watchMu; XXX kill
// don't new - create via Conn.open
private:
_FileH
();
...
...
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