Update overlay2 to use naive diff for changes
| ... | ... |
@@ -754,16 +754,5 @@ func (d *Driver) Diff(id, parent string) (io.ReadCloser, error) {
|
| 754 | 754 |
// Changes produces a list of changes between the specified layer and its |
| 755 | 755 |
// parent layer. If parent is "", then all changes will be ADD changes. |
| 756 | 756 |
func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
|
| 757 |
- if useNaiveDiff(d.home) || !d.isParent(id, parent) {
|
|
| 758 |
- return d.naiveDiff.Changes(id, parent) |
|
| 759 |
- } |
|
| 760 |
- // Overlay doesn't have snapshots, so we need to get changes from all parent |
|
| 761 |
- // layers. |
|
| 762 |
- diffPath := d.getDiffPath(id) |
|
| 763 |
- layers, err := d.getLowerDirs(id) |
|
| 764 |
- if err != nil {
|
|
| 765 |
- return nil, err |
|
| 766 |
- } |
|
| 767 |
- |
|
| 768 |
- return archive.OverlayChanges(layers, diffPath) |
|
| 757 |
+ return d.naiveDiff.Changes(id, parent) |
|
| 769 | 758 |
} |
| ... | ... |
@@ -284,30 +284,3 @@ func clen(n []byte) int {
|
| 284 | 284 |
} |
| 285 | 285 |
return len(n) |
| 286 | 286 |
} |
| 287 |
- |
|
| 288 |
-// OverlayChanges walks the path rw and determines changes for the files in the path, |
|
| 289 |
-// with respect to the parent layers |
|
| 290 |
-func OverlayChanges(layers []string, rw string) ([]Change, error) {
|
|
| 291 |
- return changes(layers, rw, overlayDeletedFile, nil) |
|
| 292 |
-} |
|
| 293 |
- |
|
| 294 |
-func overlayDeletedFile(root, path string, fi os.FileInfo) (string, error) {
|
|
| 295 |
- if fi.Mode()&os.ModeCharDevice != 0 {
|
|
| 296 |
- s := fi.Sys().(*syscall.Stat_t) |
|
| 297 |
- if unix.Major(uint64(s.Rdev)) == 0 && unix.Minor(uint64(s.Rdev)) == 0 { // nolint: unconvert
|
|
| 298 |
- return path, nil |
|
| 299 |
- } |
|
| 300 |
- } |
|
| 301 |
- if fi.Mode()&os.ModeDir != 0 {
|
|
| 302 |
- opaque, err := system.Lgetxattr(filepath.Join(root, path), "trusted.overlay.opaque") |
|
| 303 |
- if err != nil {
|
|
| 304 |
- return "", err |
|
| 305 |
- } |
|
| 306 |
- if len(opaque) == 1 && opaque[0] == 'y' {
|
|
| 307 |
- return path, nil |
|
| 308 |
- } |
|
| 309 |
- } |
|
| 310 |
- |
|
| 311 |
- return "", nil |
|
| 312 |
- |
|
| 313 |
-} |