Commit bdd6be33 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a974edc9
......@@ -631,13 +631,22 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) error {
// /(head/<rev>)/bigfile/ -> Lookup receives client request to create (head|<rev>)/bigfile/<bigfileX>.
func (bfdir *BigFileDir) Lookup(out *fuse.Attr, name string, fctx *fuse.Context) (*nodefs.Inode, fuse.Status) {
inode, err := bfdir.lookup(out, name, fctx) // XXX reorder out?
f, err := bfdir.lookup(out, name, fctx) // XXX reorder out?
var inode *nodefs.Inode
if f != nil {
inode = f.Inode()
}
return inode, err2LogStatus(err)
}
func (bfdir *BigFileDir) lookup(out *fuse.Attr, name string, fctx *fuse.Context) (_ *nodefs.Inode, err error) {
func (bfdir *BigFileDir) lookup(out *fuse.Attr, name string, fctx *fuse.Context) (f *BigFile, err error) {
defer xerr.Contextf(&err, "/bigfile: lookup %q", name)
defer func() {
if f != nil {
f.getattr(out)
}
}()
oid, err := zodb.ParseOid(name)
if err != nil {
......@@ -650,8 +659,7 @@ func (bfdir *BigFileDir) lookup(out *fuse.Attr, name string, fctx *fuse.Context)
bfdir.mu.Unlock()
if already {
// XXX fill out
return f.Inode(), nil
return f, nil
}
// not there - without bfdir lock proceed to open BigFile from ZODB
......@@ -667,7 +675,7 @@ func (bfdir *BigFileDir) lookup(out *fuse.Attr, name string, fctx *fuse.Context)
if already {
bfdir.mu.Unlock()
f.Close()
return f2.Inode(), nil // XXX fill out
return f2, nil
}
bfdir.tab[oid] = f
......@@ -676,8 +684,7 @@ func (bfdir *BigFileDir) lookup(out *fuse.Attr, name string, fctx *fuse.Context)
// mkfile takes filesystem treeLock - do it outside bfdir.mu
mkfile(bfdir, name, f)
// XXX fill out
return f.Inode(), nil
return f, nil
}
// XXX do we need to support unlink? (probably no)
......@@ -812,9 +819,13 @@ func (f *BigFile) Close() error {
}
// /(head|<rev>)/bigfile/<bigfileX> -> Getattr serves stat.
func (f *BigFile) GetAttr(out *fuse.Attr, _ nodefs.File, fctx *fuse.Context) fuse.Status {
func (f *BigFile) GetAttr(out *fuse.Attr, _ nodefs.File, _ *fuse.Context) fuse.Status {
// XXX locking
f.getattr(out)
return fuse.OK
}
func (f *BigFile) getattr(out *fuse.Attr) {
out.Mode = fuse.S_IFREG | 0444
out.Size = uint64(f.zbfSize)
// .Blocks
......@@ -826,8 +837,6 @@ func (f *BigFile) GetAttr(out *fuse.Attr, _ nodefs.File, fctx *fuse.Context) fus
mtime := lastChange.Time().Time
out.SetTimes(/*atime=*/nil, /*mtime=*/&mtime, /*ctime=*/&mtime)
return fuse.OK
}
......
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