Commit 46329e84 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c3d12e3c
......@@ -602,9 +602,7 @@ type BigFileDir struct {
// δ tail of tracked BTree nodes of all BigFiles + -> which file
// (used only for head/, not revX/)
// XXX read/write access protected by zheadMu
// δFmu sync.RWMutex // zheadMu.W | zheadMu.R + δFmu.X XXX kill δFmu
δFtail *zdata.ΔFtail
δFtail *zdata.ΔFtail // read/write access protected by zheadMu.{R,W}
}
// /(head|<rev>)/bigfile/<bigfileX> - served by BigFile.
......@@ -859,9 +857,7 @@ retry:
bfdir := head.bfdir
// invalidate kernel cache for data in changed files
// NOTE no δFmu lock needed because zhead is WLocked
// δF, err := bfdir.δFtail.Update(δZ, zhead) // δF <- δZ |tracked
δF, err := bfdir.δFtail.Update(δZ) // δF <- δZ |tracked
if err != nil {
return err
......@@ -1524,14 +1520,10 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr
// fmt.Printf("S: read #%d -> pin watchers (#%d)\n", blk, len(f.watchTab))
// update δFtail index XXX -> move upper into readBlk ?
// (δFtail is just for δZ -> δF invalidation handling and is needed without isolation protocol)
// XXX ^^^ no - also need to query to send pins
// see "3) for */head/data the following invariant is maintained..."
bfdir := f.head.bfdir
δFtail := bfdir.δFtail
// bfdir.δFmu.Lock() // XXX locking correct? XXX -> better push down?
δFtail.Track(f.zfile, blk, treepath, blkcov, zblk) // XXX pass in zblk.rev here?
// bfdir.δFmu.Unlock()
// make sure that file[blk] on clients side stays as of @w.at state.
......@@ -2084,7 +2076,7 @@ func (bfdir *BigFileDir) lookup(out *fuse.Attr, name string, fctx *fuse.Context)
}
// not there - without bfdir lock proceed to open BigFile from ZODB
f, err = bfdir.head.bigopen(fctx, oid)
f, err = bfdir.head.bigfopen(fctx, oid)
if err != nil {
return nil, err
}
......@@ -2192,14 +2184,14 @@ func (root *Root) lookup(name string, fctx *fuse.Context) (_ *Head, err error) {
}
// bigopen opens BigFile corresponding to oid on head.zconn.
// bigfopen opens BigFile corresponding to oid on head.zconn.
//
// A ZBigFile corresponding to oid is activated and statted.
//
// head.zconn must be locked.
func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err error) {
// head.zheadMu must be locked.
func (head *Head) bigfopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err error) {
zconn := head.zconn
defer xerr.Contextf(&err, "bigopen %s @%s", oid, zconn.At())
defer xerr.Contextf(&err, "bigfopen %s @%s", oid, zconn.At())
// XXX better ctx = transaction.PutIntoContext(ctx, txn)
ctx, cancel := xcontext.Merge(ctx, zconn.TxnCtx)
......@@ -2254,9 +2246,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
// only head/ needs δFtail, f.δtail and watches.
if head.rev == 0 {
// see "3) for */head/data the following invariant is maintained..."
// head.bfdir.δFmu.Lock() // XXX locking ok?
head.bfdir.δFtail.Track(f.zfile, -1, sizePath, blkCov, nil)
// head.bfdir.δFmu.Unlock()
f.watchTab = make(map[*Watch]struct{})
}
......
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