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
8c94bf6e
Commit
8c94bf6e
authored
Oct 18, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5aff3f81
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
17 deletions
+27
-17
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+1
-8
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+1
-1
wcfs/wcfs.go
wcfs/wcfs.go
+25
-8
No files found.
wcfs/internal/zdata/δftail.go
View file @
8c94bf6e
...
...
@@ -958,14 +958,7 @@ func flipsign(x int64) int64 {
// zfile must be any checkout from (tail, head]
// at must ∈ (tail, head]
// blk must be tracked
func
(
δFtail
*
ΔFtail
)
BlkRevAt
(
ctx
context
.
Context
,
zfile
*
ZBigFile
,
blk
int64
,
at
zodb
.
Tid
)
(
_
zodb
.
Tid
,
exact
bool
)
{
rev
,
exact
,
err
:=
δFtail
.
_BlkRevAt
(
ctx
,
zfile
,
blk
,
at
)
if
err
!=
nil
{
panic
(
err
)
// XXX
}
return
rev
,
exact
}
func
(
δFtail
*
ΔFtail
)
_BlkRevAt
(
ctx
context
.
Context
,
zfile
*
ZBigFile
,
blk
int64
,
at
zodb
.
Tid
)
(
_
zodb
.
Tid
,
exact
bool
,
err
error
)
{
func
(
δFtail
*
ΔFtail
)
BlkRevAt
(
ctx
context
.
Context
,
zfile
*
ZBigFile
,
blk
int64
,
at
zodb
.
Tid
)
(
_
zodb
.
Tid
,
exact
bool
,
err
error
)
{
foid
:=
zfile
.
POid
()
defer
xerr
.
Contextf
(
&
err
,
"blkrev f<%s> #%d @%s"
,
foid
,
blk
,
at
)
...
...
wcfs/internal/zdata/δftail_test.go
View file @
8c94bf6e
...
...
@@ -575,7 +575,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
at
:=
vδf
[
j
]
.
Rev
blkRev
:=
blkRevAt
[
at
]
for
_
,
blk
:=
range
blkv
{
rev
,
exact
:=
δFtail
.
BlkRevAt
(
ctx
,
zfile
,
blk
,
at
)
rev
,
exact
,
err
:=
δFtail
.
BlkRevAt
(
ctx
,
zfile
,
blk
,
at
);
X
(
err
)
revOK
,
ok
:=
blkRev
[
blk
]
if
!
ok
{
k
:=
len
(
epochv
)
-
1
...
...
wcfs/wcfs.go
View file @
8c94bf6e
...
...
@@ -1085,22 +1085,29 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) {
//
// if we have the data - preserve it under @revX/bigfile/file[blk].
if
int64
(
len
(
blkdata
))
==
blksize
{
func
()
{
err
:=
func
()
error
{
// store retrieved data back to OS cache for file @<rev>/file[blk]
δFtail
:=
f
.
head
.
bfdir
.
δFtail
blkrev
,
_
:=
δFtail
.
BlkRevAt
(
ctx
,
f
.
zfile
,
blk
,
f
.
head
.
zconn
.
At
())
blkrev
,
_
,
err
:=
δFtail
.
BlkRevAt
(
ctx
,
f
.
zfile
,
blk
,
f
.
head
.
zconn
.
At
())
if
err
!=
nil
{
return
err
}
frev
,
funlock
,
err
:=
groot
.
lockRevFile
(
blkrev
,
f
.
zfile
.
POid
())
if
err
!=
nil
{
log
.
Errorf
(
"BUG: %s: invalidate blk #%d: %s (ignoring, but reading @revX/bigfile will be slow)"
,
f
.
path
(),
blk
,
err
)
return
return
fmt
.
Errorf
(
"BUG: %s"
,
err
)
}
defer
funlock
()
st
:=
fsconn
.
FileNotifyStoreCache
(
frev
.
Inode
(),
off
,
blkdata
)
if
st
!=
fuse
.
OK
{
log
.
Errorf
(
"BUG: %s: invalidate blk #%d: %s: store cache: %s (ignoring, but reading @revX/bigfile will be slow)"
,
f
.
path
(),
blk
,
frev
.
path
(),
st
)
return
fmt
.
Errorf
(
"BUG: %s: store cache: %s"
,
frev
.
path
(),
st
)
}
return
nil
}()
if
err
!=
nil
{
log
.
Errorf
(
"%s: invalidate blk #%d: %s (ignoring, but reading @revX/bigfile will be slow)"
,
f
.
path
(),
blk
,
err
)
}
}
// invalidate file/head/data[blk] in OS file cache.
...
...
@@ -1566,7 +1573,11 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr
// we'll relock atMu again and recheck blkrev vs w.at after.
w
.
atMu
.
RUnlock
()
blkrev
,
_
=
δFtail
.
BlkRevAt
(
ctx
,
f
.
zfile
,
blk
,
f
.
head
.
zconn
.
At
())
var
err
error
blkrev
,
_
,
err
=
δFtail
.
BlkRevAt
(
ctx
,
f
.
zfile
,
blk
,
f
.
head
.
zconn
.
At
())
if
err
!=
nil
{
panic
(
err
)
// XXX
}
blkrevRough
=
false
w
.
atMu
.
RLock
()
...
...
@@ -1582,8 +1593,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
,
_
:=
δFtail
.
BlkRevAt
(
ctx
,
w
.
file
.
zfile
,
blk
,
w
.
at
)
// XXX move into go?
pinrev
,
_
,
err
:=
δFtail
.
BlkRevAt
(
ctx
,
w
.
file
.
zfile
,
blk
,
w
.
at
)
// XXX move into go?
// XXX ^^^ w.file vs f ?
if
err
!=
nil
{
panic
(
err
)
// XXX
}
//fmt.Printf("S: read #%d: watch @%s: pin -> @%s\n", blk, w.at, pinrev)
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
...
...
@@ -1764,7 +1778,10 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
continue
}
toPin
[
blk
],
_
=
δFtail
.
BlkRevAt
(
ctx
,
f
.
zfile
,
blk
,
at
)
// XXX err
toPin
[
blk
],
_
,
err
=
δFtail
.
BlkRevAt
(
ctx
,
f
.
zfile
,
blk
,
at
)
if
err
!=
nil
{
panic
(
err
)
// XXX
}
}
}
...
...
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