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

.

parent 5d838496
......@@ -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 and even if we consider all δ'ed zobj, building complete set of
// 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:
//
......@@ -537,8 +537,11 @@ type BigFile struct {
size int64 // zfile.Size()
rev zodb.Tid // last revision that modified zfile data
// // tail change history of this file.
// δtail *ΔTailI64 // [](rev↑, []#blk) XXX kill
// tail change history of this file.
//
// 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.
// successful load results are kept here until blkdata is put into OS pagecache.
......@@ -812,14 +815,15 @@ retry:
δF := bfdir.δFtail.Update(δZ)
//fmt.Printf("xfiles: %v\n", xfiles)
for file, δfile := range δF.Change {
// XXX use δfile blocks
_ = δfile
finv, ok := toinvalidate[file]
if !ok {
finv = &fileInvalidate{} // XXX init blkmap?
toinvalidate[file] = finv
}
// XXX use δfile blocks -> finv.blkmap
finv.size = true
file.δtail.Append(δF.Rev, δfile.Elements())
}
//fmt.Printf("\n\nzδhandle: toinvalidate (#%d):\n", len(toinvalidate))
......@@ -898,6 +902,7 @@ retry:
}
// XXX δFtail.ForgetPast(...)
// XXX for f in toinvalidate: f.δtail.ForgetPast(...)
}
// 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
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
// blocks. If we don't we can miss to send pin for a freshly read which
// could have revision > w.at .
toPin := map[int64]zodb.Tid{} // blk -> @rev
// XXX locking ok?
bfdir.δFmu.RLock()
defer bfdir.δFmu.RUnlock()
// XXX locking
// pin all tracked file blocks that were changed (at, head] range
for _, δfile := range bfdir.δFtail.SliceByFileRev(f, at, head.zconn.At()) {
for blk := range δfile.Change {
for _, δfile := range f.δtail.SliceByRev(at, head.zconn.At()) {
for _, blk := range δfile.Changev {
_, already := toPin[blk]
if already {
continue
......@@ -1737,7 +1740,6 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
return nil, err
}
// zconn.Incref()
f := &BigFile{
fsNode: newFSNode(&fsOptions{Sticky: false}), // XXX + BigFile.OnForget -> del .head.bfdir.fileTab[]
head: head,
......@@ -1745,17 +1747,19 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
blksize: blksize,
size: size,
rev: rev,
// // XXX this is needed only for head/
// δtail: NewΔTailI64(zconn.At()),
loading: make(map[int64]*blkLoadState),
}
// only head/ needs δFtail.
// only head/ needs f.δtail
// only head/ needs δFtail & f.δtail.
if head.rev == 0 {
head.bfdir.δFmu.Lock() // XXX locking ok?
head.bfdir.δFtail.Track(f, treePath)
head.bfdir.δFmu.Unlock()
f.δtail = NewΔTailI64(zconn.At())
}
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