Commit 09b49b68 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e53af11f
...@@ -525,7 +525,7 @@ type BigFileDir struct { ...@@ -525,7 +525,7 @@ type BigFileDir struct {
// δ tail of tracked BTree nodes of all BigFiles + -> which file // δ tail of tracked BTree nodes of all BigFiles + -> which file
// (used only for head/, not revX/) // (used only for head/, not revX/)
δFmu sync.RWMutex // XXX doc zheadMu.W | ... ? δFmu sync.RWMutex // XXX zheadMu.W | zheadMu.R + δFmu.X ?
δFtail *ΔFtail δFtail *ΔFtail
} }
...@@ -694,7 +694,8 @@ func traceZWatch(format string, argv ...interface{}) { ...@@ -694,7 +694,8 @@ func traceZWatch(format string, argv ...interface{}) {
// see "4) when we receive an invalidation message from ZODB ..." // see "4) when we receive an invalidation message from ZODB ..."
func (root *Root) zwatcher(ctx context.Context, zwatchq chan zodb.Event) (err error) { func (root *Root) zwatcher(ctx context.Context, zwatchq chan zodb.Event) (err error) {
defer xerr.Contextf(&err, "zwatch %s", root.zstor.URL()) defer xerr.Contextf(&err, "zwatch %s", root.zstor.URL())
// XXX error -> always EIO for data operations // XXX error -> always EIO for data operations
// XXX unmount -> stop
traceZWatch(">>>") traceZWatch(">>>")
var zevent zodb.Event var zevent zodb.Event
...@@ -768,72 +769,12 @@ retry: ...@@ -768,72 +769,12 @@ retry:
zhead := head.zconn zhead := head.zconn
bfdir := head.bfdir bfdir := head.bfdir
/*
// δZ = (tid↑, []oid)
for _, oid := range δZ.Changev {
// XXX zhead.Cache() lock/unlock
obj := zhead.Cache().Get(oid)
if obj == nil {
//fmt.Printf("%s: not in cache\n", oid)
continue // nothing to do - see invariant
}
//fmt.Printf("%s: in cache (%s)\n", oid, typeOf(obj))
switch obj := obj.(type) {
default:
continue // object not related to any bigfile
// XXX kill Tree/Bucket here (-> ΔFtail)
case *btree.LOBTree:
btreeChangev = append(btreeChangev, obj.POid())
case *btree.LOBucket:
btreeChangev = append(btreeChangev, obj.POid())
case zBlk: // ZBlk*
// blkBoundTo locking: no other bindZFile are running,
// since we write-locked head.zheadMu and bindZFile is
// run when loading objects - thus when head.zheadMu is
// read-locked.
//
// bfdir locking: similarly not needed, since we are
// exclusively holding head lock.
for zfile, objBlk := range obj.blkBoundTo() {
file, ok := bfdir.fileTab[zfile.POid()]
if !ok {
// even though zfile is in ZODB cache, the
// filesystem already forgot about this file.
continue
}
finv, ok := toinvalidate[file]
if !ok {
finv = &fileInvalidate{blkmap: SetI64{}}
toinvalidate[file] = finv
}
finv.blkmap.Update(objBlk)
}
case *ZBigFile:
// XXX check that .blksize and .blktab (it is only
// persistent reference) do not change.
// XXX shutdown fs with ^^^ message.
panic("ZBigFile changed")
}
// make sure obj won't be garbage-collected until we finish handling it.
runtime.KeepAlive(obj)
}
*/
// invalidate kernel cache for data in changed files // invalidate kernel cache for data in changed files
// XXX no indexMu lock needed because head is Locked // XXX no δFmu lock needed because head is Locked
δF := bfdir.δFtail.Update(δZ, zhead) δF := bfdir.δFtail.Update(δZ, zhead)
if false { if false {
fmt.Printf("\n\nS: zδhandle: δF (#%d):\n", len(δF.ByFile)) fmt.Printf("\n\nS: handleδZ: δF (#%d):\n", len(δF.ByFile))
for file, δfile := range δF.ByFile { for file, δfile := range δF.ByFile {
blkv := δfile.Blocks.Elements() blkv := δfile.Blocks.Elements()
sort.Slice(blkv, func(i, j int) bool { sort.Slice(blkv, func(i, j int) bool {
...@@ -1221,6 +1162,8 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) (err erro ...@@ -1221,6 +1162,8 @@ func (f *BigFile) readBlk(ctx context.Context, blk int64, dest []byte) (err erro
// and thus would trigger DB access again. // and thus would trigger DB access again.
// //
// XXX if direct-io: don't touch pagecache // XXX if direct-io: don't touch pagecache
// XXX upload parts only not covered by currrent read (not to e.g. wait for page lock)
// XXX skip upload completely if read is wide to cover whole blksize
go f.uploadBlk(blk, loading) go f.uploadBlk(blk, loading)
return nil return nil
...@@ -2296,7 +2239,7 @@ func main() { ...@@ -2296,7 +2239,7 @@ func main() {
}) })
// XXX place = ok? // XXX place = ok?
// XXX ctx = ok? // XXX ctx = ok? XXX -> joined ctx for fs.Serve + zwatcher ?
// XXX wait for zwatcher shutdown + log from it error // XXX wait for zwatcher shutdown + log from it error
go root.zwatcher(ctx, zwatchq) go root.zwatcher(ctx, zwatchq)
......
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