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

.

parent c3d12e3c
...@@ -602,9 +602,7 @@ type BigFileDir struct { ...@@ -602,9 +602,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/)
// XXX read/write access protected by zheadMu δFtail *zdata.ΔFtail // read/write access protected by zheadMu.{R,W}
// δFmu sync.RWMutex // zheadMu.W | zheadMu.R + δFmu.X XXX kill δFmu
δFtail *zdata.ΔFtail
} }
// /(head|<rev>)/bigfile/<bigfileX> - served by BigFile. // /(head|<rev>)/bigfile/<bigfileX> - served by BigFile.
...@@ -859,9 +857,7 @@ retry: ...@@ -859,9 +857,7 @@ retry:
bfdir := head.bfdir bfdir := head.bfdir
// invalidate kernel cache for data in changed files // 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 δF, err := bfdir.δFtail.Update(δZ) // δF <- δZ |tracked
if err != nil { if err != nil {
return err return err
...@@ -1524,14 +1520,10 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr ...@@ -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)) // fmt.Printf("S: read #%d -> pin watchers (#%d)\n", blk, len(f.watchTab))
// update δFtail index XXX -> move upper into readBlk ? // 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..." // see "3) for */head/data the following invariant is maintained..."
bfdir := f.head.bfdir bfdir := f.head.bfdir
δFtail := bfdir.δFtail δ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? δ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. // 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) ...@@ -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 // 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 { if err != nil {
return nil, err return nil, err
} }
...@@ -2192,14 +2184,14 @@ func (root *Root) lookup(name string, fctx *fuse.Context) (_ *Head, err error) { ...@@ -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. // A ZBigFile corresponding to oid is activated and statted.
// //
// head.zconn must be locked. // head.zheadMu must be locked.
func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err error) { func (head *Head) bigfopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err error) {
zconn := head.zconn 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) // XXX better ctx = transaction.PutIntoContext(ctx, txn)
ctx, cancel := xcontext.Merge(ctx, zconn.TxnCtx) ctx, cancel := xcontext.Merge(ctx, zconn.TxnCtx)
...@@ -2254,9 +2246,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er ...@@ -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. // only head/ needs δFtail, f.δtail and watches.
if head.rev == 0 { if head.rev == 0 {
// see "3) for */head/data the following invariant is maintained..." // 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.δFtail.Track(f.zfile, -1, sizePath, blkCov, nil)
// head.bfdir.δFmu.Unlock()
f.watchTab = make(map[*Watch]struct{}) 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