Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support darwin clonefile #223

Merged
merged 2 commits into from May 17, 2023

Conversation

dmcgowan
Copy link
Member

Adds clonefile support on copy for Darwin.

Added benchmark to show it is working

goos: darwin
goarch: amd64
pkg: github.com/containerd/continuity/fs
cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
                  │   before.txt    │              after.txt              │
                  │     sec/op      │   sec/op     vs base                │
LargeCopy100MB-16    92802.9µ ± 11%   412.2µ ± 3%  -99.56% (p=0.000 n=10)
LargeCopy1GB-16     894137.8µ ± 11%   409.6µ ± 3%  -99.95% (p=0.000 n=10)
geomean                288.1m         410.9µ       -99.86%

                  │   before.txt   │              after.txt               │
                  │      B/op      │     B/op      vs base                │
LargeCopy100MB-16   38.913Ki ±  6%   3.961Ki ± 0%  -89.82% (p=0.000 n=10)
LargeCopy1GB-16     45.193Ki ± 18%   3.961Ki ± 0%  -91.24% (p=0.000 n=10)
geomean              41.94Ki         3.961Ki       -90.55%

                  │ before.txt │             after.txt              │
                  │ allocs/op  │ allocs/op   vs base                │
LargeCopy100MB-16   41.00 ± 0%   35.00 ± 0%  -14.63% (p=0.000 n=10)
LargeCopy1GB-16     42.50 ± 4%   35.00 ± 0%  -17.65% (p=0.000 n=10)
geomean             41.74        35.00       -16.15%

Signed-off-by: Derek McGowan <derek@mcg.dev>

package fs

var copyFile = openAndCopyFile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not wild about a var here vs func copyFile(target, source string) error { return openAndCopyFile(target, source) } but since it's private it's a very minor concern.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah me either, it just seemed cleaner though. If there is an argument to be made that var is slower, then will update.

@@ -0,0 +1,38 @@
//go:build darwin || freebsd || openbsd || netbsd || solaris
// +build darwin freebsd openbsd netbsd solaris
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems wrong

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, those must have been ignored anyway, removed

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build tags seem wrong, LGTM other than that

Signed-off-by: Derek McGowan <derek@mcg.dev>
@AkihiroSuda
Copy link
Member

Let's release v0.4.0 after merging this

@AkihiroSuda AkihiroSuda merged commit 21eb927 into containerd:main May 17, 2023
12 checks passed
@AkihiroSuda
Copy link
Member

@slonopotamus
Copy link

Nice! This makes native containerd snapshotter actually usable on macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

fs.CopyFile should use clonefile(2) on macOS when VOL_CAP_INT_CLONE is available
5 participants