Commit 6ce6b134 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 5d838496
...@@ -281,7 +281,7 @@ package main ...@@ -281,7 +281,7 @@ package main
// FIXME no - we can build it but not in full - since we consider only zobj in live cache. // FIXME no - we can build it but not in full - since we consider only zobj in live cache.
// FIXME and even if we consider all δ'ed zobj, building complete set of // FIXME and even if we consider all δ'ed zobj, building complete set of
// file.δtail requires to first do complete scan of file.blktab // file.δtail requires to first do complete scan of file.blktab
// which is prohibitively expensive. // which is prohibitively expensive. XXX -> no, we'll do the scan
// //
// 4.4) for all file/blk to invalidate we do: // 4.4) for all file/blk to invalidate we do:
// //
...@@ -537,8 +537,11 @@ type BigFile struct { ...@@ -537,8 +537,11 @@ type BigFile struct {
size int64 // zfile.Size() size int64 // zfile.Size()
rev zodb.Tid // last revision that modified zfile data rev zodb.Tid // last revision that modified zfile data
// // tail change history of this file. // tail change history of this file.
// δtail *ΔTailI64 // [](rev↑, []#blk) XXX kill //
// XXX computationally expensive to start - see "Invalidations to wcfs
// clients are delayed ..." in notes.txt
δtail *ΔTailI64 // [](rev↑, []#blk)
// inflight loadings of ZBigFile from ZODB. // inflight loadings of ZBigFile from ZODB.
// successful load results are kept here until blkdata is put into OS pagecache. // successful load results are kept here until blkdata is put into OS pagecache.
...@@ -812,14 +815,15 @@ retry: ...@@ -812,14 +815,15 @@ retry:
δF := bfdir.δFtail.Update(δZ) δF := bfdir.δFtail.Update(δZ)
//fmt.Printf("xfiles: %v\n", xfiles) //fmt.Printf("xfiles: %v\n", xfiles)
for file, δfile := range δF.Change { for file, δfile := range δF.Change {
// XXX use δfile blocks
_ = δfile
finv, ok := toinvalidate[file] finv, ok := toinvalidate[file]
if !ok { if !ok {
finv = &fileInvalidate{} // XXX init blkmap? finv = &fileInvalidate{} // XXX init blkmap?
toinvalidate[file] = finv toinvalidate[file] = finv
} }
// XXX use δfile blocks -> finv.blkmap
finv.size = true finv.size = true
file.δtail.Append(δF.Rev, δfile.Elements())
} }
//fmt.Printf("\n\nzδhandle: toinvalidate (#%d):\n", len(toinvalidate)) //fmt.Printf("\n\nzδhandle: toinvalidate (#%d):\n", len(toinvalidate))
...@@ -898,6 +902,7 @@ retry: ...@@ -898,6 +902,7 @@ retry:
} }
// XXX δFtail.ForgetPast(...) // XXX δFtail.ForgetPast(...)
// XXX for f in toinvalidate: f.δtail.ForgetPast(...)
} }
// invalidateBlk invalidates 1 file block in kernel cache. // invalidateBlk invalidates 1 file block in kernel cache.
...@@ -1367,20 +1372,18 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T ...@@ -1367,20 +1372,18 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
return fmt.Errorf("at is too far away back from head/at") return fmt.Errorf("at is too far away back from head/at")
} }
// XXX register w to f early, so that READs going in parallel to us // TODO register w to f here early, so that READs going in parallel to us
// preparing and processing initial pins, also sends pin for read // preparing and processing initial pins, also sends pin for read
// blocks. If we don't we can miss to send pin for a freshly read which // blocks. If we don't we can miss to send pin for a freshly read which
// could have revision > w.at . // could have revision > w.at .
toPin := map[int64]zodb.Tid{} // blk -> @rev toPin := map[int64]zodb.Tid{} // blk -> @rev
// XXX locking ok? // XXX locking
bfdir.δFmu.RLock()
defer bfdir.δFmu.RUnlock()
// pin all tracked file blocks that were changed (at, head] range // pin all tracked file blocks that were changed (at, head] range
for _, δfile := range bfdir.δFtail.SliceByFileRev(f, at, head.zconn.At()) { for _, δfile := range f.δtail.SliceByRev(at, head.zconn.At()) {
for blk := range δfile.Change { for _, blk := range δfile.Changev {
_, already := toPin[blk] _, already := toPin[blk]
if already { if already {
continue continue
...@@ -1737,7 +1740,6 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er ...@@ -1737,7 +1740,6 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
return nil, err return nil, err
} }
// zconn.Incref()
f := &BigFile{ f := &BigFile{
fsNode: newFSNode(&fsOptions{Sticky: false}), // XXX + BigFile.OnForget -> del .head.bfdir.fileTab[] fsNode: newFSNode(&fsOptions{Sticky: false}), // XXX + BigFile.OnForget -> del .head.bfdir.fileTab[]
head: head, head: head,
...@@ -1745,17 +1747,19 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er ...@@ -1745,17 +1747,19 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
blksize: blksize, blksize: blksize,
size: size, size: size,
rev: rev, rev: rev,
// // XXX this is needed only for head/
// δtail: NewΔTailI64(zconn.At()),
loading: make(map[int64]*blkLoadState), loading: make(map[int64]*blkLoadState),
} }
// only head/ needs δFtail. // only head/ needs f.δtail
// only head/ needs δFtail & f.δtail.
if head.rev == 0 { if head.rev == 0 {
head.bfdir.δFmu.Lock() // XXX locking ok? head.bfdir.δFmu.Lock() // XXX locking ok?
head.bfdir.δFtail.Track(f, treePath) head.bfdir.δFtail.Track(f, treePath)
head.bfdir.δFmu.Unlock() head.bfdir.δFmu.Unlock()
f.δtail = NewΔTailI64(zconn.At())
} }
return f, nil return f, nil
......
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