Commit ce03e525 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Drop unused filesystems:

- LoggingFileSystem
- PathDebugFileSystem
- TimingFileSystem
parent 1b7a2c24
......@@ -18,7 +18,6 @@ var _ = log.Print
func main() {
// Scans the arg list and sets up flags
debug := flag.Bool("debug", false, "print debugging messages.")
latencies := flag.Bool("latencies", false, "record latencies.")
flag.Parse()
if flag.NArg() < 2 {
// TODO - where to get program name?
......@@ -31,13 +30,6 @@ func main() {
loopbackfs := fuse.NewLoopbackFileSystem(orig)
finalFs = loopbackfs
debugFs := fuse.NewFileSystemDebug()
if *latencies {
timing := fuse.NewTimingFileSystem(finalFs)
debugFs.AddTimingFileSystem(timing)
finalFs = timing
}
opts := &fuse.FileSystemOptions{
// These options are to be compatible with libfuse defaults,
// making benchmarking easier.
......@@ -46,26 +38,10 @@ func main() {
EntryTimeout: 1.0,
}
if *latencies {
debugFs.FileSystem = finalFs
finalFs = debugFs
}
conn := fuse.NewFileSystemConnector(fuse.NewPathNodeFs(finalFs), opts)
var finalRawFs fuse.RawFileSystem = conn
if *latencies {
rawTiming := fuse.NewTimingRawFileSystem(conn)
debugFs.AddRawTimingFileSystem(rawTiming)
finalRawFs = rawTiming
}
state := fuse.NewMountState(finalRawFs)
state := fuse.NewMountState(conn)
state.Debug = *debug
if *latencies {
state.SetRecordStatistics(true)
debugFs.AddMountState(state)
}
mountPoint := flag.Arg(0)
fmt.Println("Mounting")
......
......@@ -19,20 +19,16 @@ MANUAL_GOFILES=api.go \
inode.go \
latencymap.go \
lockingfs.go \
loggingfs.go \
loopback.go \
misc.go \
mount.go \
mountstate.go \
opcode.go \
pathfs.go \
pathdebug.go \
fsops.go \
readonlyfs.go \
request.go \
switchfs.go \
timingfs.go \
timingrawfs.go \
types.go \
version.go \
xattr.go \
......
......@@ -11,7 +11,6 @@ func TestRawFs(t *testing.T) {
var iface RawFileSystem
iface = new(DefaultRawFileSystem)
iface = new(TimingRawFileSystem)
_ = iface
}
......@@ -19,7 +18,6 @@ func TestRawFs(t *testing.T) {
func TestPathFs(t *testing.T) {
var iface FileSystem
iface = new(DefaultFileSystem)
iface = new(TimingFileSystem)
_ = iface
}
......
package fuse
import (
"log"
"os"
"fmt"
)
var _ = log.Print
var _ = fmt.Print
// LoggingFileSystem is a wrapper that prints out what a FileSystem is doing.
type LoggingFileSystem struct {
FileSystem
}
func NewLoggingFileSystem(fs FileSystem) *LoggingFileSystem {
t := new(LoggingFileSystem)
t.FileSystem = fs
return t
}
func (me *LoggingFileSystem) Print(name string, arg string) {
log.Printf("Op %s arg %s", name, arg)
}
func (me *LoggingFileSystem) GetAttr(name string, context *Context) (*os.FileInfo, Status) {
me.Print("GetAttr", name)
return me.FileSystem.GetAttr(name, context)
}
func (me *LoggingFileSystem) GetXAttr(name string, attr string, context *Context) ([]byte, Status) {
me.Print("GetXAttr", name)
return me.FileSystem.GetXAttr(name, attr, context)
}
func (me *LoggingFileSystem) SetXAttr(name string, attr string, data []byte, flags int, context *Context) Status {
me.Print("SetXAttr", name)
return me.FileSystem.SetXAttr(name, attr, data, flags, context)
}
func (me *LoggingFileSystem) ListXAttr(name string, context *Context) ([]string, Status) {
me.Print("ListXAttr", name)
return me.FileSystem.ListXAttr(name, context)
}
func (me *LoggingFileSystem) RemoveXAttr(name string, attr string, context *Context) Status {
me.Print("RemoveXAttr", name)
return me.FileSystem.RemoveXAttr(name, attr, context)
}
func (me *LoggingFileSystem) Readlink(name string, context *Context) (string, Status) {
me.Print("Readlink", name)
return me.FileSystem.Readlink(name, context)
}
func (me *LoggingFileSystem) Mknod(name string, mode uint32, dev uint32, context *Context) Status {
me.Print("Mknod", name)
return me.FileSystem.Mknod(name, mode, dev, context)
}
func (me *LoggingFileSystem) Mkdir(name string, mode uint32, context *Context) Status {
me.Print("Mkdir", name)
return me.FileSystem.Mkdir(name, mode, context)
}
func (me *LoggingFileSystem) Unlink(name string, context *Context) (code Status) {
me.Print("Unlink", name)
return me.FileSystem.Unlink(name, context)
}
func (me *LoggingFileSystem) Rmdir(name string, context *Context) (code Status) {
me.Print("Rmdir", name)
return me.FileSystem.Rmdir(name, context)
}
func (me *LoggingFileSystem) Symlink(value string, linkName string, context *Context) (code Status) {
me.Print("Symlink", linkName)
return me.FileSystem.Symlink(value, linkName, context)
}
func (me *LoggingFileSystem) Rename(oldName string, newName string, context *Context) (code Status) {
me.Print("Rename", oldName)
return me.FileSystem.Rename(oldName, newName, context)
}
func (me *LoggingFileSystem) Link(oldName string, newName string, context *Context) (code Status) {
me.Print("Link", newName)
return me.FileSystem.Link(oldName, newName, context)
}
func (me *LoggingFileSystem) Chmod(name string, mode uint32, context *Context) (code Status) {
me.Print("Chmod", name)
return me.FileSystem.Chmod(name, mode, context)
}
func (me *LoggingFileSystem) Chown(name string, uid uint32, gid uint32, context *Context) (code Status) {
me.Print("Chown", name)
return me.FileSystem.Chown(name, uid, gid, context)
}
func (me *LoggingFileSystem) Truncate(name string, offset uint64, context *Context) (code Status) {
me.Print("Truncate", name)
return me.FileSystem.Truncate(name, offset, context)
}
func (me *LoggingFileSystem) Open(name string, flags uint32, context *Context) (file File, code Status) {
me.Print("Open", name)
return me.FileSystem.Open(name, flags, context)
}
func (me *LoggingFileSystem) OpenDir(name string, context *Context) (stream chan DirEntry, status Status) {
me.Print("OpenDir", name)
return me.FileSystem.OpenDir(name, context)
}
func (me *LoggingFileSystem) OnMount(nodeFs *PathNodeFs) {
me.Print("OnMount", "")
me.FileSystem.OnMount(nodeFs)
}
func (me *LoggingFileSystem) OnUnmount() {
me.Print("OnUnmount", "")
me.FileSystem.OnUnmount()
}
func (me *LoggingFileSystem) Access(name string, mode uint32, context *Context) (code Status) {
me.Print("Access", name)
return me.FileSystem.Access(name, mode, context)
}
func (me *LoggingFileSystem) Create(name string, flags uint32, mode uint32, context *Context) (file File, code Status) {
me.Print("Create", name)
return me.FileSystem.Create(name, flags, mode, context)
}
func (me *LoggingFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64, context *Context) (code Status) {
me.Print("Utimens", name)
return me.FileSystem.Utimens(name, AtimeNs, CtimeNs, context)
}
......@@ -66,7 +66,6 @@ func NewTestCase(t *testing.T) *testCase {
var pfs FileSystem
pfs = NewLoopbackFileSystem(me.orig)
pfs = NewTimingFileSystem(pfs)
pfs = NewLockingFileSystem(pfs)
var rfs RawFileSystem
......@@ -78,7 +77,6 @@ func NewTestCase(t *testing.T) *testCase {
NegativeTimeout: 0.0,
})
rfs = me.connector
rfs = NewTimingRawFileSystem(rfs)
rfs = NewLockingRawFileSystem(rfs)
me.connector.Debug = true
......
package fuse
import (
"fmt"
"log"
"os"
"path/filepath"
"sort"
"strings"
"sync"
)
var _ = fmt.Println
var _ = log.Println
const (
DebugDir = ".debug"
)
type getter func() []byte
// FileSystemDebug exposes a .debug directory, exposing files for
// which a read hooks into a callback. This is useful for exporting
// metrics and debug information from the daemon.
//
// TODO - should use in-process mount instead?
type FileSystemDebug struct {
sync.RWMutex
callbacks map[string]getter
FileSystem
}
func NewFileSystemDebug() *FileSystemDebug {
return &FileSystemDebug{
callbacks: make(map[string]getter),
}
}
func (me *FileSystemDebug) Add(name string, callback getter) {
me.RWMutex.Lock()
defer me.RWMutex.Unlock()
me.callbacks[name] = callback
}
func (me *FileSystemDebug) Open(path string, flags uint32, context *Context) (fuseFile File, status Status) {
content := me.getContent(path)
if content != nil {
return NewDataFile(content), OK
}
return me.FileSystem.Open(path, flags, context)
}
var SeparatorString = string(filepath.Separator)
func (me *FileSystemDebug) getContent(path string) []byte {
comps := strings.Split(path, SeparatorString)
if comps[0] == DebugDir {
me.RWMutex.RLock()
defer me.RWMutex.RUnlock()
f := me.callbacks[comps[1]]
if f != nil {
return f()
}
}
return nil
}
func (me *FileSystemDebug) GetXAttr(name string, attr string, context *Context) ([]byte, Status) {
if strings.HasPrefix(name, DebugDir) {
return nil, ENODATA
}
return me.FileSystem.GetXAttr(name, attr, context)
}
func (me *FileSystemDebug) GetAttr(path string, context *Context) (*os.FileInfo, Status) {
if !strings.HasPrefix(path, DebugDir) {
return me.FileSystem.GetAttr(path, context)
}
if path == DebugDir {
return &os.FileInfo{
Mode: S_IFDIR | 0755,
}, OK
}
c := me.getContent(path)
if c != nil {
return &os.FileInfo{
Mode: S_IFREG | 0644,
Size: int64(len(c)),
}, OK
}
return nil, ENOENT
}
func FloatMapToBytes(m map[string]float64) []byte {
keys := make([]string, 0, len(m))
for k, _ := range m {
keys = append(keys, k)
}
sort.Strings(keys)
var r []string
for _, k := range keys {
r = append(r, fmt.Sprintf("%v %v", k, m[k]))
}
return []byte(strings.Join(r, "\n"))
}
// Ugh - generics.
func IntMapToBytes(m map[string]int) []byte {
keys := make([]string, 0, len(m))
for k, _ := range m {
keys = append(keys, k)
}
sort.Strings(keys)
var r []string
for _, k := range keys {
r = append(r, fmt.Sprintf("%v %v", k, m[k]))
}
return []byte(strings.Join(r, "\n"))
}
func (me *FileSystemDebug) OpenDir(name string, context *Context) (stream chan DirEntry, status Status) {
if name == DebugDir {
me.RWMutex.RLock()
defer me.RWMutex.RUnlock()
stream = make(chan DirEntry, len(me.callbacks))
for k, _ := range me.callbacks {
stream <- DirEntry{
Name: k,
Mode: S_IFREG,
}
}
close(stream)
return stream, OK
}
return me.FileSystem.OpenDir(name, context)
}
func (me *FileSystemDebug) AddMountState(state *MountState) {
me.Add("mountstate-latencies",
func() []byte { return FloatMapToBytes(state.Latencies()) })
me.Add("mountstate-opcounts",
func() []byte { return IntMapToBytes(state.OperationCounts()) })
me.Add("mountstate-bufferpool",
func() []byte { return []byte(state.BufferPoolStats()) })
}
func hotPaths(timing *TimingFileSystem) []byte {
hot := timing.HotPaths("GetAttr")
unique := len(hot)
top := 20
start := len(hot) - top
if start < 0 {
start = 0
}
return []byte(fmt.Sprintf("Unique GetAttr paths: %d\nTop %d GetAttr paths: %v",
unique, top, hot[start:]))
}
func (me *FileSystemDebug) AddTimingFileSystem(tfs *TimingFileSystem) {
me.Add("timingfs-latencies",
func() []byte { return FloatMapToBytes(tfs.Latencies()) })
me.Add("timingfs-opcounts",
func() []byte { return IntMapToBytes(tfs.OperationCounts()) })
me.Add("timingfs-hotpaths",
func() []byte { return hotPaths(tfs) })
}
func (me *FileSystemDebug) AddRawTimingFileSystem(tfs *TimingRawFileSystem) {
me.Add("rawtimingfs-latencies",
func() []byte { return FloatMapToBytes(tfs.Latencies()) })
}
package fuse
import (
"io/ioutil"
"path/filepath"
"os"
"testing"
)
func TestPathDebug(t *testing.T) {
debugFs := NewFileSystemDebug()
debugFs.FileSystem = &DefaultFileSystem{}
debugFs.Add("test-entry", func() []byte { return []byte("test-content") })
connector := NewFileSystemConnector(NewPathNodeFs(debugFs), nil)
mountPoint := MakeTempDir()
defer os.RemoveAll(mountPoint)
state := NewMountState(connector)
state.Mount(mountPoint, nil)
state.Debug = true
defer state.Unmount()
go state.Loop()
dir := filepath.Join(mountPoint, ".debug")
_, err := os.Lstat(dir)
CheckSuccess(err)
names, err := ioutil.ReadDir(dir)
CheckSuccess(err)
if len(names) != 1 || names[0].Name != "test-entry" {
t.Error("unexpected readdir out:", names)
}
c, err := ioutil.ReadFile(filepath.Join(dir, "test-entry"))
CheckSuccess(err)
if string(c) != "test-content" {
t.Error("unexpected content", c)
}
}
package fuse
import (
"time"
"log"
"os"
"fmt"
)
var _ = log.Print
var _ = fmt.Print
// TimingFileSystem is a wrapper to collect timings for a FileSystem
type TimingFileSystem struct {
FileSystem
*LatencyMap
}
func NewTimingFileSystem(fs FileSystem) *TimingFileSystem {
t := new(TimingFileSystem)
t.LatencyMap = NewLatencyMap()
t.FileSystem = fs
return t
}
func (me *TimingFileSystem) startTimer(name string, arg string) (closure func()) {
start := time.Nanoseconds()
return func() {
dt := (time.Nanoseconds() - start) / 1e6
me.LatencyMap.Add(name, arg, dt)
}
}
func (me *TimingFileSystem) OperationCounts() map[string]int {
return me.LatencyMap.Counts()
}
func (me *TimingFileSystem) Latencies() map[string]float64 {
return me.LatencyMap.Latencies(1e-3)
}
func (me *TimingFileSystem) HotPaths(operation string) (paths []string) {
return me.LatencyMap.TopArgs(operation)
}
func (me *TimingFileSystem) GetAttr(name string, context *Context) (*os.FileInfo, Status) {
defer me.startTimer("GetAttr", name)()
return me.FileSystem.GetAttr(name, context)
}
func (me *TimingFileSystem) GetXAttr(name string, attr string, context *Context) ([]byte, Status) {
defer me.startTimer("GetXAttr", name)()
return me.FileSystem.GetXAttr(name, attr, context)
}
func (me *TimingFileSystem) SetXAttr(name string, attr string, data []byte, flags int, context *Context) (code Status) {
defer me.startTimer("SetXAttr", name)()
return me.FileSystem.SetXAttr(name, attr, data, flags, context)
}
func (me *TimingFileSystem) ListXAttr(name string, context *Context) ([]string, Status) {
defer me.startTimer("ListXAttr", name)()
return me.FileSystem.ListXAttr(name, context)
}
func (me *TimingFileSystem) RemoveXAttr(name string, attr string, context *Context) (code Status) {
defer me.startTimer("RemoveXAttr", name)()
return me.FileSystem.RemoveXAttr(name, attr, context)
}
func (me *TimingFileSystem) Readlink(name string, context *Context) (string, Status) {
defer me.startTimer("Readlink", name)()
return me.FileSystem.Readlink(name, context)
}
func (me *TimingFileSystem) Mknod(name string, mode uint32, dev uint32, context *Context) (code Status) {
defer me.startTimer("Mknod", name)()
return me.FileSystem.Mknod(name, mode, dev, context)
}
func (me *TimingFileSystem) Mkdir(name string, mode uint32, context *Context) (code Status) {
defer me.startTimer("Mkdir", name)()
return me.FileSystem.Mkdir(name, mode, context)
}
func (me *TimingFileSystem) Unlink(name string, context *Context) (code Status) {
defer me.startTimer("Unlink", name)()
return me.FileSystem.Unlink(name, context)
}
func (me *TimingFileSystem) Rmdir(name string, context *Context) (code Status) {
defer me.startTimer("Rmdir", name)()
return me.FileSystem.Rmdir(name, context)
}
func (me *TimingFileSystem) Symlink(value string, linkName string, context *Context) (code Status) {
defer me.startTimer("Symlink", linkName)()
return me.FileSystem.Symlink(value, linkName, context)
}
func (me *TimingFileSystem) Rename(oldName string, newName string, context *Context) (code Status) {
defer me.startTimer("Rename", oldName)()
return me.FileSystem.Rename(oldName, newName, context)
}
func (me *TimingFileSystem) Link(oldName string, newName string, context *Context) (code Status) {
defer me.startTimer("Link", newName)()
return me.FileSystem.Link(oldName, newName, context)
}
func (me *TimingFileSystem) Chmod(name string, mode uint32, context *Context) (code Status) {
defer me.startTimer("Chmod", name)()
return me.FileSystem.Chmod(name, mode, context)
}
func (me *TimingFileSystem) Chown(name string, uid uint32, gid uint32, context *Context) (code Status) {
defer me.startTimer("Chown", name)()
return me.FileSystem.Chown(name, uid, gid, context)
}
func (me *TimingFileSystem) Truncate(name string, offset uint64, context *Context) (code Status) {
defer me.startTimer("Truncate", name)()
return me.FileSystem.Truncate(name, offset, context)
}
func (me *TimingFileSystem) Open(name string, flags uint32, context *Context) (file File, code Status) {
defer me.startTimer("Open", name)()
return me.FileSystem.Open(name, flags, context)
}
func (me *TimingFileSystem) OpenDir(name string, context *Context) (stream chan DirEntry, status Status) {
defer me.startTimer("OpenDir", name)()
return me.FileSystem.OpenDir(name, context)
}
func (me *TimingFileSystem) OnMount(nodeFs *PathNodeFs) {
defer me.startTimer("OnMount", "")()
me.FileSystem.OnMount(nodeFs)
}
func (me *TimingFileSystem) OnUnmount() {
defer me.startTimer("OnUnmount", "")()
me.FileSystem.OnUnmount()
}
func (me *TimingFileSystem) Access(name string, mode uint32, context *Context) (code Status) {
defer me.startTimer("Access", name)()
return me.FileSystem.Access(name, mode, context)
}
func (me *TimingFileSystem) Create(name string, flags uint32, mode uint32, context *Context) (file File, code Status) {
defer me.startTimer("Create", name)()
return me.FileSystem.Create(name, flags, mode, context)
}
func (me *TimingFileSystem) Utimens(name string, AtimeNs uint64, CtimeNs uint64, context *Context) (code Status) {
defer me.startTimer("Utimens", name)()
return me.FileSystem.Utimens(name, AtimeNs, CtimeNs, context)
}
package fuse
import (
"time"
)
// TimingRawFileSystem is a wrapper to collect timings for a RawFileSystem
type TimingRawFileSystem struct {
RawFileSystem
*LatencyMap
}
func NewTimingRawFileSystem(fs RawFileSystem) *TimingRawFileSystem {
t := new(TimingRawFileSystem)
t.RawFileSystem = fs
t.LatencyMap = NewLatencyMap()
return t
}
func (me *TimingRawFileSystem) startTimer(name string) (closure func()) {
start := time.Nanoseconds()
return func() {
dt := (time.Nanoseconds() - start) / 1e6
me.LatencyMap.Add(name, "", dt)
}
}
func (me *TimingRawFileSystem) Latencies() map[string]float64 {
return me.LatencyMap.Latencies(1e-3)
}
func (me *TimingRawFileSystem) Lookup(h *InHeader, name string) (out *EntryOut, code Status) {
defer me.startTimer("Lookup")()
return me.RawFileSystem.Lookup(h, name)
}
func (me *TimingRawFileSystem) Forget(h *InHeader, input *ForgetIn) {
defer me.startTimer("Forget")()
me.RawFileSystem.Forget(h, input)
}
func (me *TimingRawFileSystem) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status) {
defer me.startTimer("GetAttr")()
return me.RawFileSystem.GetAttr(header, input)
}
func (me *TimingRawFileSystem) Open(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status) {
defer me.startTimer("Open")()
return me.RawFileSystem.Open(header, input)
}
func (me *TimingRawFileSystem) SetAttr(header *InHeader, input *SetAttrIn) (out *AttrOut, code Status) {
defer me.startTimer("SetAttr")()
return me.RawFileSystem.SetAttr(header, input)
}
func (me *TimingRawFileSystem) Readlink(header *InHeader) (out []byte, code Status) {
defer me.startTimer("Readlink")()
return me.RawFileSystem.Readlink(header)
}
func (me *TimingRawFileSystem) Mknod(header *InHeader, input *MknodIn, name string) (out *EntryOut, code Status) {
defer me.startTimer("Mknod")()
return me.RawFileSystem.Mknod(header, input, name)
}
func (me *TimingRawFileSystem) Mkdir(header *InHeader, input *MkdirIn, name string) (out *EntryOut, code Status) {
defer me.startTimer("Mkdir")()
return me.RawFileSystem.Mkdir(header, input, name)
}
func (me *TimingRawFileSystem) Unlink(header *InHeader, name string) (code Status) {
defer me.startTimer("Unlink")()
return me.RawFileSystem.Unlink(header, name)
}
func (me *TimingRawFileSystem) Rmdir(header *InHeader, name string) (code Status) {
defer me.startTimer("Rmdir")()
return me.RawFileSystem.Rmdir(header, name)
}
func (me *TimingRawFileSystem) Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status) {
defer me.startTimer("Symlink")()
return me.RawFileSystem.Symlink(header, pointedTo, linkName)
}
func (me *TimingRawFileSystem) Rename(header *InHeader, input *RenameIn, oldName string, newName string) (code Status) {
defer me.startTimer("Rename")()
return me.RawFileSystem.Rename(header, input, oldName, newName)
}
func (me *TimingRawFileSystem) Link(header *InHeader, input *LinkIn, name string) (out *EntryOut, code Status) {
defer me.startTimer("Link")()
return me.RawFileSystem.Link(header, input, name)
}
func (me *TimingRawFileSystem) SetXAttr(header *InHeader, input *SetXAttrIn, attr string, data []byte) Status {
defer me.startTimer("SetXAttr")()
return me.RawFileSystem.SetXAttr(header, input, attr, data)
}
func (me *TimingRawFileSystem) GetXAttr(header *InHeader, attr string) (data []byte, code Status) {
defer me.startTimer("GetXAttr")()
return me.RawFileSystem.GetXAttr(header, attr)
}
func (me *TimingRawFileSystem) ListXAttr(header *InHeader) (data []byte, code Status) {
defer me.startTimer("ListXAttr")()
return me.RawFileSystem.ListXAttr(header)
}
func (me *TimingRawFileSystem) RemoveXAttr(header *InHeader, attr string) Status {
defer me.startTimer("RemoveXAttr")()
return me.RawFileSystem.RemoveXAttr(header, attr)
}
func (me *TimingRawFileSystem) Access(header *InHeader, input *AccessIn) (code Status) {
defer me.startTimer("Access")()
return me.RawFileSystem.Access(header, input)
}
func (me *TimingRawFileSystem) Create(header *InHeader, input *CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status) {
defer me.startTimer("Create")()
return me.RawFileSystem.Create(header, input, name)
}
func (me *TimingRawFileSystem) OpenDir(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status) {
defer me.startTimer("OpenDir")()
return me.RawFileSystem.OpenDir(header, input)
}
func (me *TimingRawFileSystem) Release(header *InHeader, input *ReleaseIn) {
defer me.startTimer("Release")()
me.RawFileSystem.Release(header, input)
}
func (me *TimingRawFileSystem) Read(header *InHeader, input *ReadIn, bp BufferPool) ([]byte, Status) {
defer me.startTimer("Read")()
return me.RawFileSystem.Read(header, input, bp)
}
func (me *TimingRawFileSystem) Write(header *InHeader, input *WriteIn, data []byte) (written uint32, code Status) {
defer me.startTimer("Write")()
return me.RawFileSystem.Write(header, input, data)
}
func (me *TimingRawFileSystem) Flush(header *InHeader, input *FlushIn) Status {
defer me.startTimer("Flush")()
return me.RawFileSystem.Flush(header, input)
}
func (me *TimingRawFileSystem) Fsync(header *InHeader, input *FsyncIn) (code Status) {
defer me.startTimer("Fsync")()
return me.RawFileSystem.Fsync(header, input)
}
func (me *TimingRawFileSystem) ReadDir(header *InHeader, input *ReadIn) (*DirEntryList, Status) {
defer me.startTimer("ReadDir")()
return me.RawFileSystem.ReadDir(header, input)
}
func (me *TimingRawFileSystem) ReleaseDir(header *InHeader, input *ReleaseIn) {
defer me.startTimer("ReleaseDir")()
me.RawFileSystem.ReleaseDir(header, input)
}
func (me *TimingRawFileSystem) FsyncDir(header *InHeader, input *FsyncIn) (code Status) {
defer me.startTimer("FsyncDir")()
return me.RawFileSystem.FsyncDir(header, input)
}
......@@ -193,7 +193,7 @@ func (me *AutoUnionFs) updateKnownFses() {
}
func (me *AutoUnionFs) Readlink(path string, context *fuse.Context) (out string, code fuse.Status) {
comps := strings.Split(path, fuse.SeparatorString)
comps := strings.Split(path, string(filepath.Separator))
if comps[0] == _STATUS && comps[1] == _ROOT {
return me.root, fuse.OK
}
......@@ -284,7 +284,7 @@ func (me *AutoUnionFs) GetAttr(path string, context *fuse.Context) (*os.FileInfo
}
return a, fuse.OK
}
comps := strings.Split(path, fuse.SeparatorString)
comps := strings.Split(path, string(filepath.Separator))
if len(comps) > 1 && comps[0] == _CONFIG {
fs := me.getUnionFs(comps[1])
......
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