Commit 69181fdb authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent facc6db8
...@@ -509,7 +509,7 @@ type Head struct { ...@@ -509,7 +509,7 @@ type Head struct {
// XXX protected by ... zheadMu ? // XXX protected by ... zheadMu ?
wlinkTab map[*WatchLink]struct{} wlinkTab map[*WatchLink]struct{}
// waiters for zconn.At to become ≥ their at. // waiters for zhead.At to become ≥ their at.
hwaitMu sync.Mutex // zheadMu.W | zheadMu.R + hwaitMu hwaitMu sync.Mutex // zheadMu.W | zheadMu.R + hwaitMu
hwait map[hwaiter]struct{} // set{(at, ready)} hwait map[hwaiter]struct{} // set{(at, ready)}
} }
...@@ -560,7 +560,7 @@ type BigFile struct { ...@@ -560,7 +560,7 @@ type BigFile struct {
// //
// Being a staging area for data to enter OS cache, loading has to be // Being a staging area for data to enter OS cache, loading has to be
// consulted/invalidated whenever wcfs logic needs to consult/invalidate OS cache. // consulted/invalidated whenever wcfs logic needs to consult/invalidate OS cache.
loadMu sync.Mutex // XXX doc zheadMu.W | ... ? loadMu sync.Mutex // zheadMu.W | zheadMu.R + loadMu
loading map[int64]*blkLoadState // #blk -> {... blkdata} loading map[int64]*blkLoadState // #blk -> {... blkdata}
// watches attached to this file. // watches attached to this file.
...@@ -891,7 +891,7 @@ type hwaiter struct { ...@@ -891,7 +891,7 @@ type hwaiter struct {
// zheadWait waits till head.zconn.At becomes ≥ at. // zheadWait waits till head.zconn.At becomes ≥ at.
// //
// It returns error either if db is down or ctx is canceled. XXX db -> wcfs? // It returns error either if wcfs is down or ctx is canceled.
func (head *Head) zheadWait(ctx context.Context, at zodb.Tid) (err error) { func (head *Head) zheadWait(ctx context.Context, at zodb.Tid) (err error) {
defer xerr.Contextf(&err, "wait zhead ≥ %s", at) defer xerr.Contextf(&err, "wait zhead ≥ %s", at)
...@@ -899,11 +899,13 @@ func (head *Head) zheadWait(ctx context.Context, at zodb.Tid) (err error) { ...@@ -899,11 +899,13 @@ func (head *Head) zheadWait(ctx context.Context, at zodb.Tid) (err error) {
panic("must be called only for head/, not @revX/") panic("must be called only for head/, not @revX/")
} }
// XXX check wcfs.down
// check if zhead is already ≥ at // check if zhead is already ≥ at
head.zheadMu.RLock() head.zheadMu.RLock()
if head.zconn.At() >= at { if head.zconn.At() >= at {
head.zheadMu.RUnlock() head.zheadMu.RUnlock()
return return nil
} }
// no - we have to wait for it // no - we have to wait for it
...@@ -1281,6 +1283,7 @@ retry: ...@@ -1281,6 +1283,7 @@ retry:
break break
} }
// zheadMu rlocked.
// zwatcher is not currently trying to pause OS cache uploads. // zwatcher is not currently trying to pause OS cache uploads.
// check if this block was already invalidated by zwatcher. // check if this block was already invalidated by zwatcher.
......
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