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
56d0b374
Commit
56d0b374
authored
Jul 04, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e58e9845
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
wcfs/wcfs.go
wcfs/wcfs.go
+15
-9
No files found.
wcfs/wcfs.go
View file @
56d0b374
...
...
@@ -1414,29 +1414,34 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr
blkrev
:=
blkrevMax
blkrevRough
:=
true
// XXX locking (f.watchTab)
wg
,
ctx
:=
errgroup
.
WithContext
(
ctx
)
for
w
:=
range
f
.
watchTab
{
for
w
:=
range
f
.
watchTab
{
// XXX locking (f.watchTab)
w
:=
w
fmt
.
Printf
(
"S: read -> pin watchers: w @%s
\n
"
,
w
.
at
)
// make sure w.at stays unchanged while we pin the block
w
.
atMu
.
RLock
()
// XXX locking (w
)
fmt
.
Printf
(
"S: read -> pin watchers: w @%s
\n
"
,
w
.
at
)
// the block is already covered by @w.at database view
if
blkrev
<=
w
.
at
{
// XXX locking
if
blkrev
<=
w
.
at
{
w
.
atMu
.
RUnlock
()
continue
}
// if blkrev is rough estimation and that upper bound is > w.at
// we have to recompute ~exact file[blk] revision @head.
if
blkrevRough
{
// unlock atMu while we are (re-)calculating blkrev
// we'll relock atMu again and recheck blkrev vs w.at after.
w
.
atMu
.
RUnlock
()
blkrev
,
_
=
f
.
LastBlkRev
(
ctx
,
blk
,
f
.
head
.
zconn
.
At
())
blkrevRough
=
false
// XXX w.at could be only ↑ ? if not - locking is more complex
if
blkrev
<=
w
.
at
{
// XXX locking
w
.
atMu
.
RLock
()
if
blkrev
<=
w
.
at
{
w
.
atMu
.
RUnlock
()
continue
}
}
...
...
@@ -1447,10 +1452,11 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr
// and most of them would be on different w.at - cache of the file will
// be lost. Via pinning to particular block revision, we make sure the
// revision to pin is the same on all clients, and so file cache is shared.
pinrev
,
_
:=
w
.
file
.
LastBlkRev
(
ctx
,
blk
,
w
.
at
)
// XXX
locking (w),
move into go?
pinrev
,
_
:=
w
.
file
.
LastBlkRev
(
ctx
,
blk
,
w
.
at
)
// XXX move into go?
wg
.
Go
(
func
()
error
{
// XXX close watcher on any error
defer
w
.
atMu
.
RUnlock
()
return
w
.
pin
(
ctx
,
blk
,
pinrev
)
})
}
...
...
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