From 84e702126ac4f017e12150532bfaed675dee2927 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Fri, 25 Jun 2021 11:33:18 +0200 Subject: fusefrontend: implement recursive diriv caching The new contrib/maxlen.bash showed that we have exponential runtime with respect to directory depth. The new recursive diriv caching is a lot smarter as it caches intermediate lookups. maxlen.bash now completes in a few seconds. xfstests results same as https://github.com/rfjakob/fuse-xfstests/blob/2d158e4c82be85c15269af77498e353f928f4fab/screenlog.0 : Failures: generic/035 generic/062 generic/080 generic/093 generic/099 generic/215 generic/285 generic/319 generic/426 generic/444 generic/467 generic/477 generic/523 Failed 13 of 580 tests benchmark.bash results are identical: $ ./benchmark.bash Testing gocryptfs at /tmp/benchmark.bash.BdQ: gocryptfs v2.0.1-17-g6b09bc0; go-fuse v2.1.1-0.20210611132105-24a1dfe6b4f8; 2021-06-25 go1.16.5 linux/amd64 /tmp/benchmark.bash.BdQ.mnt is a mountpoint WRITE: 262144000 bytes (262 MB, 250 MiB) copied, 0,4821 s, 544 MB/s READ: 262144000 bytes (262 MB, 250 MiB) copied, 0,266061 s, 985 MB/s UNTAR: 8,280 MD5: 4,564 LS: 1,745 RM: 2,244 --- internal/fusefrontend/node.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'internal/fusefrontend/node.go') diff --git a/internal/fusefrontend/node.go b/internal/fusefrontend/node.go index 8370a22..dd446a3 100644 --- a/internal/fusefrontend/node.go +++ b/internal/fusefrontend/node.go @@ -52,7 +52,7 @@ func (n *Node) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut) return f.(fs.FileGetattrer).Getattr(ctx, out) } - dirfd, cName, errno := n.prepareAtSyscall("") + dirfd, cName, errno := n.prepareAtSyscallMyself() if errno != 0 { return } @@ -106,7 +106,7 @@ func (n *Node) Unlink(ctx context.Context, name string) (errno syscall.Errno) { // // Symlink-safe through openBackingDir() + Readlinkat(). func (n *Node) Readlink(ctx context.Context) (out []byte, errno syscall.Errno) { - dirfd, cName, errno := n.prepareAtSyscall("") + dirfd, cName, errno := n.prepareAtSyscallMyself() if errno != 0 { return } @@ -123,7 +123,7 @@ func (n *Node) Setattr(ctx context.Context, f fs.FileHandle, in *fuse.SetAttrIn, return f2.Setattr(ctx, in, out) } - dirfd, cName, errno := n.prepareAtSyscall("") + dirfd, cName, errno := n.prepareAtSyscallMyself() if errno != 0 { return } @@ -271,7 +271,7 @@ func (n *Node) Link(ctx context.Context, target fs.InodeEmbedder, name string, o defer syscall.Close(dirfd) n2 := toNode(target) - dirfd2, cName2, errno := n2.prepareAtSyscall("") + dirfd2, cName2, errno := n2.prepareAtSyscallMyself() if errno != 0 { return } -- cgit v1.2.3