From 733285fea265af4fc91cf37916fada1a66cec470 Mon Sep 17 00:00:00 2001 From: Alistair Strachan Date: Thu, 5 May 2016 16:04:32 -0700 Subject: updater, minzip: Remove unnecessary O_SYNC flags. Remove O_SYNC from mzExtractRecursive() and PackageExtractFileFn(). These functions deal with extracting whole files from the update package onto a filesystem. If run on ext4 on a rotating disk, for example, the O_SYNC flag will cause serious performance problems and the extraction proecss can take over 30 minutes, with no obvious benefits. This API function already calls fsync(fd) after each file is extracted to ensure data and metadata is written to the underlying block device, so the O_SYNC calls should be superfluous and safely removable. This change does not affect the OTA patch paths or any modification of the bootloader partition or writes to other 'emmc' partitions. Signed-off-by: Alistair Strachan Change-Id: I9cbb98a98e6278bf5c0d7efaae340773d1fbfcd2 --- minzip/Zip.c | 2 +- updater/install.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/minzip/Zip.c b/minzip/Zip.c index 9f550f8b4..d557daa7f 100644 --- a/minzip/Zip.c +++ b/minzip/Zip.c @@ -968,7 +968,7 @@ bool mzExtractRecursive(const ZipArchive *pArchive, setfscreatecon(secontext); } - int fd = open(targetFile, O_CREAT|O_WRONLY|O_TRUNC|O_SYNC, + int fd = open(targetFile, O_CREAT|O_WRONLY|O_TRUNC, UNZIP_FILEMODE); if (secontext) { diff --git a/updater/install.cpp b/updater/install.cpp index 4f5268401..bab2fe166 100644 --- a/updater/install.cpp +++ b/updater/install.cpp @@ -559,7 +559,7 @@ Value* PackageExtractFileFn(const char* name, State* state, } { - int fd = TEMP_FAILURE_RETRY(ota_open(dest_path, O_WRONLY | O_CREAT | O_TRUNC | O_SYNC, + int fd = TEMP_FAILURE_RETRY(ota_open(dest_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)); if (fd == -1) { printf("%s: can't open %s for write: %s\n", name, dest_path, strerror(errno)); -- cgit v1.2.3