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
57a27d67
Commit
57a27d67
authored
Oct 07, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
32eb3adf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
wcfs/wcfs.go
wcfs/wcfs.go
+12
-6
No files found.
wcfs/wcfs.go
View file @
57a27d67
...
...
@@ -323,9 +323,9 @@ type BigFileData struct {
bigfile
*
BigFile
// inflight loadings
from ZBigFile
// inflight loadings
of ZBigFile from ZODB
loadMu
sync
.
Mutex
loading
map
[
int64
]
*
blkLoadState
loading
map
[
int64
]
*
blkLoadState
// #blk -> ...
}
// blkLoadState represents a ZBlk load state/result.
...
...
@@ -528,7 +528,7 @@ func (bfdata *BigFileData) readBlk(ctx context.Context, blk int64, dest []byte)
loading
=
&
blkLoadState
{
ready
:
make
(
chan
struct
{}),
}
bfdata
.
loading
=
loading
bfdata
.
loading
[
blk
]
=
loading
}
bfdata
.
loadMu
.
Unlock
()
...
...
@@ -547,6 +547,8 @@ func (bfdata *BigFileData) readBlk(ctx context.Context, blk int64, dest []byte)
}
// noone was loading - we became reponsible to load this block
zbf
:=
bfdata
.
bigfile
.
zbf
blkdata
,
err
:=
zbf
.
LoadBlk
(
ctx
,
blk
)
loading
.
blkdata
=
blkdata
loading
.
err
=
err
...
...
@@ -555,7 +557,7 @@ func (bfdata *BigFileData) readBlk(ctx context.Context, blk int64, dest []byte)
// data loaded with error - cleanup .loading
if
loading
.
err
!=
nil
{
bfdata
.
loadMu
.
Lock
()
delete
bfdata
.
loading
[
blk
]
delete
(
bfdata
.
loading
,
blk
)
bfdata
.
loadMu
.
Unlock
()
return
err
}
...
...
@@ -574,18 +576,22 @@ func (bfdata *BigFileData) readBlk(ctx context.Context, blk int64, dest []byte)
// in deadlock inside kernel.
//
// .loading cleanup is done once we are finished with putting the data into OS cache.
// If we do it earlier - a simultaneous read covered by the same block could result
// into missing both kernel pagecache (if not yet updated) and empty .loading[blk],
// and thus would trigger DB access again.
go
func
()
{
// XXX locking - invalidation must make sure this workers are finished.
st
:=
gfsconn
.
FileNotifyStoreCache
(
bfdata
.
Inode
(),
blk
*
blksize
,
blkdata
)
bfdata
.
loadMu
.
Lock
()
delete
bfdata
.
loading
[
blk
]
delete
(
bfdata
.
loading
,
blk
)
bfdata
.
loadMu
.
Unlock
()
// XXX where to report error
if
st
!=
fuse
.
OK
{
return
fmt
.
Errorf
(
"bigfile %s: blk %d: -> pagecache: %s"
,
zbf
.
POid
(),
blk
,
st
)
}
}
}
()
return
nil
}
...
...
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