mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
applyLayer() use btrfs reflinks if availible
We use the new file copy helper which uses btrfs reflinks if availible.
This commit is contained in:
parent
cda8754013
commit
062a2b32e9
1 changed files with 7 additions and 3 deletions
10
image.go
10
image.go
|
@ -284,12 +284,16 @@ func (image *Image) applyLayer(layer, target string) error {
|
||||||
}
|
}
|
||||||
dstFile := os.NewFile(uintptr(fd), targetPath)
|
dstFile := os.NewFile(uintptr(fd), targetPath)
|
||||||
srcFile, err := os.Open(srcPath)
|
srcFile, err := os.Open(srcPath)
|
||||||
_, err = io.Copy(dstFile, srcFile)
|
if err != nil {
|
||||||
|
_ = dstFile.Close()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = CopyFile(dstFile, srcFile)
|
||||||
|
_ = dstFile.Close()
|
||||||
|
_ = srcFile.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_ = srcFile.Close()
|
|
||||||
_ = dstFile.Close()
|
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("Unknown type for file %s", srcPath)
|
return fmt.Errorf("Unknown type for file %s", srcPath)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue