Commit 424beee4 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 501b7b27
...@@ -498,9 +498,9 @@ type BigFile struct { ...@@ -498,9 +498,9 @@ type BigFile struct {
zbf *ZBigFile zbf *ZBigFile
// things read/computed from .zbf; constant during lifetime of current transaction. // things read/computed from .zbf; constant during lifetime of current transaction.
blksize int64 // zbf.blksize blksize int64 // zbf.blksize
zbfSize int64 // zbf.Size() XXX -> .size size int64 // zbf.Size()
rev zodb.Tid // last revision that modified file data rev zodb.Tid // last revision that modified zbf data
// tail change history of this file. // tail change history of this file.
δFtail *ΔTailI64 // [](rev↑, []#blk) δFtail *ΔTailI64 // [](rev↑, []#blk)
...@@ -802,12 +802,12 @@ retry: ...@@ -802,12 +802,12 @@ retry:
// XXX -> parallel? // XXX -> parallel?
// XXX locking // XXX locking
for file := range toinvalidate { for file := range toinvalidate {
zbfSize, treePath, err := file.zbf.Size(ctx) size, treePath, err := file.zbf.Size(ctx)
if err != nil { if err != nil {
panic(err) // XXX panic(err) // XXX
} }
file.zbfSize = zbfSize file.size = size
bfdir.indexLooked.Add(file, treePath) bfdir.indexLooked.Add(file, treePath)
file.rev = zhead.At() file.rev = zhead.At()
...@@ -1141,7 +1141,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er ...@@ -1141,7 +1141,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
rev := zbf.PSerial() rev := zbf.PSerial()
zbf.PDeactivate() zbf.PDeactivate()
zbfSize, treePath, err := zbf.Size(ctx) size, treePath, err := zbf.Size(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -1152,7 +1152,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er ...@@ -1152,7 +1152,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
head: head, head: head,
zbf: zbf, zbf: zbf,
blksize: blksize, blksize: blksize,
zbfSize: zbfSize, size: size,
rev: rev, rev: rev,
// XXX this is needed only for head/ // XXX this is needed only for head/
...@@ -1208,7 +1208,7 @@ func (f *BigFile) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.S ...@@ -1208,7 +1208,7 @@ func (f *BigFile) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.S
func (f *BigFile) getattr(out *fuse.Attr) { func (f *BigFile) getattr(out *fuse.Attr) {
out.Mode = fuse.S_IFREG | 0444 out.Mode = fuse.S_IFREG | 0444
out.Size = uint64(f.zbfSize) out.Size = uint64(f.size)
// .Blocks // .Blocks
// .Blksize // .Blksize
...@@ -1224,8 +1224,8 @@ func (f *BigFile) Read(_ nodefs.File, dest []byte, off int64, fctx *fuse.Context ...@@ -1224,8 +1224,8 @@ func (f *BigFile) Read(_ nodefs.File, dest []byte, off int64, fctx *fuse.Context
// cap read request to file size // cap read request to file size
end := off + int64(len(dest)) // XXX overflow? end := off + int64(len(dest)) // XXX overflow?
if end > f.zbfSize { if end > f.size {
end = f.zbfSize end = f.size
} }
if end <= off { if end <= off {
// XXX off >= size -> EINVAL? (but when size=0 kernel issues e.g. [0 +4K) read) // XXX off >= size -> EINVAL? (but when size=0 kernel issues e.g. [0 +4K) read)
......
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