overlay: add Supported() checker

This function is not called during plugin initialization (#2140),
but should be useful for downstream projects that uses overlayfs
snapshotter as a Go library.

Benchmark result on Ubuntu 17.10, GCE n1-standard-4:

BenchmarkOverlaySupportedOnExt4-4                    100          20490598 ns/op
BenchmarkOverlayUnsupportedOnFType0XFS-4           30000             39316 ns/op
BenchmarkOverlaySupportedOnFType1XFS-4               100          19287083 ns/op
BenchmarkOverlayUnsupportedOnFAT-4                   100          14217772 ns/op

i.e. the overhead is typically about 20 msec on this machine.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2018-02-26 20:56:16 +09:00
parent 2b6b99b4a1
commit 5cc915c26c
3 changed files with 178 additions and 1 deletions

View File

@@ -28,7 +28,7 @@ import (
)
// Unmount unmounts a given mountPoint and sets t.Error if it fails
func Unmount(t *testing.T, mountPoint string) {
func Unmount(t testing.TB, mountPoint string) {
t.Log("unmount", mountPoint)
err := mount.UnmountAll(mountPoint, umountflags)
assert.NilError(t, err)