Commit 3f4b77d
committed
pkg/fileutils: add ReflinkOrCopy()
Add a function to copy via reflink if possible or fall back to the
normal io.Copy().
c/image uses this function internally[1] however I like to export this
and use it in podman and I think this package here in c/storage is the
most logical location for it. Note compared to the c/image version I am
calling unix.IoctlFileClone() directly instead of the raw syscall
function.
[1] https://github.com/containers/image/tree/main/internal/reflink
Signed-off-by: Paul Holzinger <[email protected]>1 parent 5a2ca6a commit 3f4b77d
2 files changed
+35
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
0 commit comments