Commit bbab9e89 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8fd39879
......@@ -604,12 +604,12 @@ type BigFile struct {
// things read/computed from .zfile; constant during lifetime of current transaction.
// i.e. changed under zhead.W
blksize int64 // zfile.blksize
size int64 // zfile.Size()
rev zodb.Tid // last revision that modified zfile data
// XXX we can't know rev fully as some later blocks could be learnt only
// while populating δFtail lazily
// XXX or then it is not "constant during lifetime of current txn"
blksize int64 // zfile.blksize
size int64 // zfile.Size()
revApprox zodb.Tid // approx last revision that modified zfile data
// ( we can't know rev fully as some later blocks could be learnt only
// while populating δFtail lazily. For simplicity we don't delve into
// updating revApprox during lifetime of current transaction )
// inflight loadings of ZBigFile from ZODB.
// successful load results are kept here until blkdata is put into OS pagecache.
......@@ -946,9 +946,9 @@ retry:
bfdir.δFtail.Track(zfile, -1, sizePath, blkCov, nil)
}
// XXX we can miss a change to file if δblk is not yet tracked
// -> need to update file.rev at read time -> locking=XXX
file.rev = zhead.At()
// NOTE we can miss a change to file if δblk is not yet tracked
// that's why revision is only approximated
file.revApprox = zhead.At()
}
// notify .wcfs/zhead
......@@ -2194,12 +2194,10 @@ func (head *Head) bigfopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err e
return nil, err
}
blksize := zfile.BlkSize()
// XXX it should be revision of both ZBigFile and its data. But we
// NOTE file revision should be revision of both ZBigFile and its data. But we
// cannot get data revision without expensive scan of all ZBigFile's objects.
// -> approximate mtime initially with ZBigFile object mtime.
//
// XXX for @rev/... we can know initial mtime more exactly?
rev := zfile.PSerial()
revApprox := zfile.PSerial()
zfile.PDeactivate()
size, sizePath, blkCov, err := zfile.Size(ctx)
......@@ -2208,13 +2206,13 @@ func (head *Head) bigfopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err e
}
f := &BigFile{
fsNode: newFSNode(&fsOptions{Sticky: false}), // XXX + BigFile.OnForget -> del .head.bfdir.fileTab[]
head: head,
zfile: zfile,
blksize: blksize,
size: size,
rev: rev,
loading: make(map[int64]*blkLoadState),
fsNode: newFSNode(&fsOptions{Sticky: false}), // XXX + BigFile.OnForget -> del .head.bfdir.fileTab[]
head: head,
zfile: zfile,
blksize: blksize,
size: size,
revApprox: revApprox,
loading: make(map[int64]*blkLoadState),
}
// only head/ needs δFtail and watches.
......@@ -2280,7 +2278,7 @@ func (f *BigFile) getattr(out *fuse.Attr) {
out.Blksize = uint32(f.blksize) // NOTE truncating 64 -> 32
// .Blocks
mtime := f.rev.Time().Time
mtime := f.revApprox.Time().Time
out.SetTimes(/*atime=*/nil, /*mtime=*/&mtime, /*ctime=*/&mtime)
}
......@@ -2487,7 +2485,7 @@ func _main() (err error) {
// add entries to /
mkdir(root, "head", head)
mkdir(head, "bigfile", bfdir)
mkfile(head, "at", NewSmallFile(head.readAt)) // TODO mtime(at) = tidtime(at)
mkfile(head, "at", NewSmallFile(head.readAt)) // TODO mtime(at) = tidtime(at)
mkfile(head, "watch", wnode)
// for debugging/testing
......@@ -2537,7 +2535,7 @@ func _main() (err error) {
if errors.Cause(err) != context.Canceled {
log.Error(err)
log.Errorf("zwatcher failed -> switching filesystem to EIO mode (TODO)")
//panic("TODO: switch fs to EIO mode") // XXX
// TODO: switch fs to EIO mode
}
// wait for unmount
......
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