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
d5568544
Commit
d5568544
authored
Oct 07, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
57a27d67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
wcfs/wcfs.go
wcfs/wcfs.go
+16
-2
No files found.
wcfs/wcfs.go
View file @
d5568544
...
...
@@ -521,6 +521,8 @@ func (bfdata *BigFileData) Read(_ nodefs.File, dest []byte, off int64, fctx *fus
// readBlk serves Read to read 1 ZBlk #blk into destination buffer.
func
(
bfdata
*
BigFileData
)
readBlk
(
ctx
context
.
Context
,
blk
int64
,
dest
[]
byte
)
error
{
// XXX errctx?
// check if someone else is already loading this block
bfdata
.
loadMu
.
Lock
()
loading
,
already
:=
bfdata
.
loading
[
blk
]
...
...
@@ -532,7 +534,7 @@ func (bfdata *BigFileData) readBlk(ctx context.Context, blk int64, dest []byte)
}
bfdata
.
loadMu
.
Unlock
()
// if it is already loading - wait for it
// if it is already loading -
just
wait for it
if
already
{
select
{
case
<-
ctx
.
Done
()
:
...
...
@@ -581,13 +583,20 @@ func (bfdata *BigFileData) readBlk(ctx context.Context, blk int64, dest []byte)
// and thus would trigger DB access again.
go
func
()
{
// XXX locking - invalidation must make sure this workers are finished.
// XXX if direct-io: don't touch pagecache
st
:=
gfsconn
.
FileNotifyStoreCache
(
bfdata
.
Inode
(),
blk
*
blksize
,
blkdata
)
bfdata
.
loadMu
.
Lock
()
delete
(
bfdata
.
loading
,
blk
)
bfdata
.
loadMu
.
Unlock
()
// XXX where to report error
// XXX where to report error (-> log)
// XXX st == ENOSYS -> log once + disable pagecache update?
// EINVAL | ENOENT -> bug
// ENOMEN - kernel is already under memory pressure - we must not keep here
if
st
!=
fuse
.
OK
{
return
fmt
.
Errorf
(
"bigfile %s: blk %d: -> pagecache: %s"
,
zbf
.
POid
(),
blk
,
st
)
}
...
...
@@ -681,6 +690,11 @@ func main() {
}
gfsconn
=
fsconn
// FIXME temp workaround (see ^^^)
supports
:=
fssrv
.
KernelSettings
()
.
SupportsNotify
if
!
(
supports
(
fuse
.
NOTIFY_STORE
)
&&
supports
(
fuse
.
NOTIFY_RETRIEVE
))
{
log
.
Fatalf
(
"kernel FUSE does not support cache control"
)
// XXX more details?
}
// add entries to /
mkfile
(
root
,
".wcfs"
,
NewStaticFile
([]
byte
(
zurl
)))
mkdir
(
root
,
"bigfile"
,
&
BigFileRoot
{
...
...
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