• Han-Wen Nienhuys's avatar
    fs: support passthrough mode · e0a0b09a
    Han-Wen Nienhuys authored
    If a returned file implements the FilePassthroughFder interface, we
    try to register the file in the kernel.
    
    Implement this for loopbackFile, and test the behavior.
    
    For benchmarking, use a single reader. With multiple readers, contents
    are served out of kernel cache, and do not reflect FUSE performance. 
    
    Benchmark (CPU i5-8350U pinned at 2Ghz):
    
    $ go build -v && go test -run "abc" -bench '(Libfuse|FD)' --passthrough_hp ~/vc/libfuse/build/example/passthrough_hp -test.cpu=1
    BenchmarkGoFuseFDRead 	   27444	     45997 ns/op	1424.80 MB/s	      87 B/op	       1 allocs/op
    BenchmarkLibfuseHP    	   35377	     32198 ns/op	2035.43 MB/s	       0 B/op	       0 allocs/op
    
    $ go build -v && sudo go test -run "abc" -bench '(Libfuse|FD)' --passthrough_hp ~/vc/libfuse/build/example/passthrough_hp -test.cpu=1
    BenchmarkGoFuseFDRead 	   91788	     11902 ns/op	5506.23 MB/s	       3 B/op	       0 allocs/op
    BenchmarkLibfuseHP    	  100556	     11831 ns/op	5539.38 MB/s	       0 B/op	       0 allocs/op
    
    Change-Id: If8bde502a3450028f4d87ba61fa9c76ea3ea6c63
    e0a0b09a
api.go 25.7 KB