Commit 5f7c757e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ef23c06e
......@@ -495,10 +495,12 @@ type BigFile struct {
head *Head
// ZBigFile top-level object. Kept activated during lifetime of current transaction.
// XXX kill "Kept activated ..."
zbf *ZBigFile
// zbf.Size(). It is constant during lifetime of current transaction.
zbfSize int64
blksize int64 // zbf.blksize
zbfSize int64 // zbf.Size() XXX -> .size
// tail change history of this file.
δFtail *ΔTailI64 // [](rev↑, []#blk)
......@@ -1215,7 +1217,7 @@ func (f *BigFile) getattr(out *fuse.Attr) {
// .Blksize
// FIXME lastChange should cover all bigfile data, not only ZBigFile itself
//mtime := f.δFtail[-1] || zbf.PSerial?
// XXX -> f.lastRev (initially serial, later ~ f.δFtail[-1])
lastChange := f.zbf.PSerial() // XXX activate (if zbf becomes not activated during txn)
mtime := lastChange.Time().Time
......@@ -1228,8 +1230,6 @@ func (f *BigFile) Read(_ nodefs.File, dest []byte, off int64, fctx *fuse.Context
f.head.zconnMu.RLock()
defer f.head.zconnMu.RUnlock()
zbf := f.zbf
// cap read request to file size
end := off + int64(len(dest)) // XXX overflow?
if end > f.zbfSize {
......@@ -1240,6 +1240,8 @@ func (f *BigFile) Read(_ nodefs.File, dest []byte, off int64, fctx *fuse.Context
return fuse.ReadResultData(nil), fuse.OK
}
zbf := f.zbf
// widen read request to be aligned with blksize granularity
// (we can load only whole ZBlk* blocks)
aoff := off - (off % zbf.blksize)
......@@ -1267,6 +1269,7 @@ func (f *BigFile) Read(_ nodefs.File, dest []byte, off int64, fctx *fuse.Context
err := wg.Wait()
if err != nil {
// XXX -> err2LogStatus
log.Errorf("%s", err) // XXX + /bigfile/XXX: read [a,b): -> ...
return nil, fuse.EIO
}
......
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