From 236dbc2e59f5b665f9fa30f3f7ba1fe6c8483b24 Mon Sep 17 00:00:00 2001 From: Burke Libbey Date: Thu, 7 May 2015 12:58:12 -0400 Subject: [PATCH 1/2] Remove Sync() call in NewTempArchive: This makes the "Buffering to disk" part of `docker push` 70% faster in my use-case (having already applied #12833). fsync'ing here serves no valuable purpose: if the drive's operation is interrupted, so it the program's, and this archive has no value other than the immediate and transient one. Signed-off-by: Burke Libbey --- pkg/archive/archive.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/pkg/archive/archive.go b/pkg/archive/archive.go index 4d8d260087..fbcaf2f403 100644 --- a/pkg/archive/archive.go +++ b/pkg/archive/archive.go @@ -794,9 +794,6 @@ func NewTempArchive(src Archive, dir string) (*TempArchive, error) { if _, err := io.Copy(f, src); err != nil { return nil, err } - if err = f.Sync(); err != nil { - return nil, err - } if _, err := f.Seek(0, 0); err != nil { return nil, err } From ec66daebc2087b9bab832c973f1bd7f8a6d1a5f4 Mon Sep 17 00:00:00 2001 From: Burke Libbey Date: Thu, 7 May 2015 14:42:17 -0400 Subject: [PATCH 2/2] Don't fsync on V2 registry push tempfile creation Signed-off-by: Burke Libbey --- graph/graph.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/graph/graph.go b/graph/graph.go index 9b2d7c2ee9..d4387b029b 100644 --- a/graph/graph.go +++ b/graph/graph.go @@ -254,9 +254,6 @@ func bufferToFile(f *os.File, src io.Reader) (int64, digest.Digest, error) { if err != nil { return 0, "", err } - if err = f.Sync(); err != nil { - return 0, "", err - } n, err := f.Seek(0, os.SEEK_CUR) if err != nil { return 0, "", err