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
822366a7
Commit
822366a7
authored
Dec 25, 2018
by
Kirill Smelkov
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X keeping fd to root opened prevents the filesystem from being unmounted
parent
f8f027d4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
14 deletions
+51
-14
wcfs/wcfs.go
wcfs/wcfs.go
+51
-14
No files found.
wcfs/wcfs.go
View file @
822366a7
...
...
@@ -540,18 +540,18 @@ func (r *Root) zwatcher(ctx context.Context) (err error) {
}
// zhandle1 handles 1 event from ZODB notification.
// (called with .zheadMu wlocked)
func (r *Root) zhandle1(zevent zodb.WatchEvent) {
// XXX locking correct? XXX too coarse? -> lock only around "resync .zhead ..." ?
r.zheadMu.Lock()
defer r.zheadMu.Unlock()
r.head.zconnMu.Lock()
defer r.head.zconnMu.Unlock()
zhead := r.head.zconn
//toinvalidate := map[*ZBigFile]SetI64{} // {} zfile -> set(#blk)
toinvalidate := map[*BigFile]SetI64{} // {} zfile -> set(#blk)
// zevent = (tid^, []oid)
for _, oid := range zevent.Changev {
obj :=
r.
zhead.Cache().Get(oid)
obj := zhead.Cache().Get(oid)
if obj == nil {
continue // nothing to do - see invariant
}
...
...
@@ -597,12 +597,15 @@ func (r *Root) zhandle1(zevent zodb.WatchEvent) {
}
// invalidateBlk invalidates 1 file block. XXX
//
// called with f.head.zconnMu wlocked.
//
// XXX see "4.4) for all file/blk to in invalidate we do"
func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) error {
fsconn :=
f.root().
fsconn
fsconn :=
g
fsconn
off := blk*blksize
// try retrieve cache of current head/data[blk]
// try
to
retrieve cache of current head/data[blk]
//
// if less than blksize was cached - probably the kernel had to evict
// some data from its cache already. In such case we don't try to
...
...
@@ -610,11 +613,13 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) error {
// system overloaded.
//
// XXX st != OK -> warn?
blkdata, st := fsconn.FileRetrieveCache(f.Inode(), off, blksize)
if len(blkdata) == blksize {
blkdata := make([]byte, blksize)
n, st := fsconn.FileRetrieveCache(f.Inode(), off, blkdata)
if n == blksize {
// XXX -> go
// store retrieved data back to OS cache for file @<rev>/data[blk]
frev, _ := f.bigfile.δFtail.LastRevOf(blk, at)
// store retrieved data back to OS cache for file @<rev>/file[blk]
blkrev, _ := f.δFtail.LastRevOf(blk, f.head.zconn.At())
frev := groot.revisionedFile(ctx, blkrev, f.zbf.POid())
st = fsconn.FileNotifyStoreCache(frev.Inode(), off, blkdata)
if st != fuse.OK {
// XXX log - dup wrt readBlk -> common func.
...
...
@@ -627,6 +632,18 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) error {
panic("TODO")
}
// mkrevfile makes sure inode of /@<rev>/bigfile/<fid> is known to kernel.
//
// We need node ID to be know to the kernel, when we need to store data into
// file's kernel cache.
//
// For kernel to know node IDmkrevfile has
//
// XXX why we go through kernel.lookup
func (root *Root) mkrevfile(ctx context.Context, rev zodb.Tid, fid zodb.Oid) (*BigFile, error) {
}
*/
// ----------------------------------------
...
...
@@ -960,7 +977,7 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) error {
_
=
revmax
/*
// XXX remmapping
// XXX remmapping
- only if head.rev == 0
// XXX -> own func?
// XXX locking
for _, mapping := range f.mappings {
...
...
@@ -1050,9 +1067,12 @@ func (h *Head) readAt() []byte {
// - Mount:
// .Root() -> root Inode of the fs
// .Connector() -> FileSystemConnector through which fs is mounted
//
var groot *Root
var
groot
*
Root
var
gfsconn
*
nodefs
.
FileSystemConnector
// file descriptor for opened root of the filesystem
var
grootf
*
os
.
File
// XXX -> fd
func
main
()
{
stdlog
.
SetPrefix
(
"wcfs: "
)
//log.CopyStandardLogTo("WARNING") // XXX -> "DEBUG" if -d ?
...
...
@@ -1116,7 +1136,7 @@ func main() {
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
//
groot = root // FIXME temp workaround (see ^^^)
groot
=
root
// FIXME temp workaround (see ^^^)
gfsconn
=
fsconn
// FIXME ----//----
// we require proper pagecache control (added to Linux 2.6.36 in 2010)
...
...
@@ -1139,5 +1159,22 @@ func main() {
_
=
autoexit
// serve client requests
done
:=
make
(
chan
struct
{})
go
func
()
{
fssrv
.
Serve
()
// XXX Serve returns no error
close
(
done
)
}()
err
=
fssrv
.
WaitMount
()
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
grootf
,
err
=
os
.
Open
(
mntpt
)
if
err
!=
nil
{
fssrv
.
Unmount
()
log
.
Fatal
(
err
)
}
<-
done
}
Kirill Smelkov
@kirr
mentioned in commit
e16e029a
·
Oct 27, 2021
mentioned in commit
e16e029a
mentioned in commit e16e029a7de3fde8b4a5cd4fe432e106617d3e02
Toggle commit list
Kirill Smelkov
@kirr
mentioned in commit
4430de41
·
Oct 28, 2021
mentioned in commit
4430de41
mentioned in commit 4430de41bfb5702980935c46ea8fee2774aaea40
Toggle commit list
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