From a1dced2b52f1fc124ec54f93aee39c2280f0bb56 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Mon, 1 Apr 2019 08:51:18 -0700 Subject: Use fsync instead of sync during first boot 1) fsync the specific copied file instead of sync whole file system 2) boost prio/ioprio for CFQ since cpppreopt is on critical path 3) change to foreground group Before CL: 03-29 21:49:31.450 1 1 I init : Service 'cppreopts' (pid 1662) exited with status 0 waiting took 55.175999 seconds 03-29 21:49:31.808 1440 1440 I PackageManager: cppreopts took 55591 ms After CL: 04-01 15:47:43.841 1 1 I init : Service 'cppreopts' (pid 1871) exited with status 0 waiting took 2.007000 seconds 04-01 15:47:45.343 1549 1549 I PackageManager: cppreopts took 3709 ms Bug: 129542240 Test: boot Change-Id: Ia9bacabe798764084790b077abc80ae60401f9c1 --- cppreopts/cppreopts.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 cppreopts/cppreopts.sh (limited to 'cppreopts/cppreopts.sh') diff --git a/cppreopts/cppreopts.sh b/cppreopts/cppreopts.sh old mode 100644 new mode 100755 index a3545e17..3416e675 --- a/cppreopts/cppreopts.sh +++ b/cppreopts/cppreopts.sh @@ -28,11 +28,12 @@ function do_copy() { log -p w -t cppreopts "Unable to copy file ${source_file} to ${temp_dest_name}!" else log -p i -t cppreopts "Copied file from ${source_file} to ${temp_dest_name}" - sync + fsync ${temp_dest_name} if ! mv ${temp_dest_name} ${dest_name} ; then log -p w -t cppreopts "Unable to rename temporary file from ${temp_dest_name} to ${dest_name}" rm ${temp_dest_name} || log -p w -t cppreopts "Unable to remove temporary file ${temp_dest_name}" else + fsync ${dest_name} log -p i -t cppreopts "Renamed temporary file from ${temp_dest_name} to ${dest_name}" fi fi -- cgit v1.2.3