Commit 5115f254 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b3c92399
...@@ -655,6 +655,10 @@ func (root *Root) zδhandle1(zevent zodb.CommitEvent) { ...@@ -655,6 +655,10 @@ func (root *Root) zδhandle1(zevent zodb.CommitEvent) {
return file.invalidateBlk(ctx, blk) return file.invalidateBlk(ctx, blk)
}) })
} }
// invalidate kernel cache for attributes
// XXX we need to do it only if we see topoligy (i.e. btree) change
wg.Go(file.invalidateAttr)
} }
err := wg.Wait() err := wg.Wait()
if err != nil { if err != nil {
...@@ -668,6 +672,7 @@ func (root *Root) zδhandle1(zevent zodb.CommitEvent) { ...@@ -668,6 +672,7 @@ func (root *Root) zδhandle1(zevent zodb.CommitEvent) {
// XXX dir.mu locking (not needed bcause zconnMu locked) // XXX dir.mu locking (not needed bcause zconnMu locked)
for _, file := range bfdir.fileTab { for _, file := range bfdir.fileTab {
file.zbf.PDeactivate() file.zbf.PDeactivate()
// XXX we need to reread size only for files in toinvalidate
file.zbfSize = -1 // just in case file.zbfSize = -1 // just in case
} }
...@@ -705,7 +710,7 @@ func (root *Root) zδhandle1(zevent zodb.CommitEvent) { ...@@ -705,7 +710,7 @@ func (root *Root) zδhandle1(zevent zodb.CommitEvent) {
} }
} }
// invalidateBlk invalidates 1 file block. XXX // invalidateBlk invalidates 1 file block in kernel cache.
// //
// see "4.4) for all file/blk to in invalidate we do" // see "4.4) for all file/blk to in invalidate we do"
// //
...@@ -746,6 +751,15 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) error { ...@@ -746,6 +751,15 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) error {
panic("TODO") panic("TODO")
} }
// invalidateAttr invalidates file attributes in kernel cache.
func (f *BigFile) invalidateAttr() error {
fsconn := gfsconn
st := fsconn.FileNotify(f.Inode(), -1, -1) // metadata only
// st != ok
_ = st
panic("TODO")
}
// mkrevfile makes sure inode ID of /@<rev>/bigfile/<fid> is known to kernel. // mkrevfile makes sure inode ID of /@<rev>/bigfile/<fid> is known to kernel.
// //
...@@ -1344,7 +1358,7 @@ func main() { ...@@ -1344,7 +1358,7 @@ func main() {
mkdir(root, "head", head) mkdir(root, "head", head)
mkdir(head, "bigfile", bfdir) mkdir(head, "bigfile", bfdir)
mkfile(head, "at", NewSmallFile(head.readAt)) // TODO mtime(at) = tidtime(at) mkfile(head, "at", NewSmallFile(head.readAt)) // TODO mtime(at) = tidtime(at)
// XXX ^^^ invalidate cache or direct io // XXX ^^^ invalidate cache or direct io XXX no FOPEN_KEEP_CACHE -> direct io
// for debugging/testing // for debugging/testing
_wcfs := newDefaultNode() _wcfs := newDefaultNode()
......
...@@ -204,6 +204,8 @@ def test_wcfs(): ...@@ -204,6 +204,8 @@ def test_wcfs():
s = b"hello world" s = b"hello world"
memcpy(vma, s) memcpy(vma, s)
print("\n\n\n")
#import time; time.sleep(2)
commit() commit()
wcsync() # sync wcfs to ZODB wcsync() # sync wcfs to ZODB
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment