Open partitions with O_DSYNC flag only if the update is periodic.

Currently when updating we always open the target partition with flag O_DSYNC
(CL:562552), but this makes all infrastructure operations like 'cros flash',
provisioning, force update, paygen, etc much slower. This changes the update
engine to only add O_DSYNC flag if an update is triggered by periodic checks
(not interactively forced). This means if the user clicks on 'check for update'
it will be an interactive update and O_DSYNC will not be used. This change keeps
the AOSP partitions open without O_DSYNC flag. This CL uses non-interactive mode
for all unit tests but currently there are no integration test like provisioning
for triggering periodic updates.

Currently 'parrot' board canaries (only board with rotating HDD) is failing due
to timeouts related to slow updates. This CL potentially will clear that problem.

TEST=cros_workon_make --test, installed an image with/out the O_DSYCN flag and
measured the 'cros flash' time.
BUG=chromium:738027

Change-Id: If45fcf5e798b9c9353e09021ad812c859d983a65
Reviewed-on: https://chromium-review.googlesource.com/567360
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
11 files changed
tree: 39a5e3c3b8166289074bfb814f9cad8c8f186371
  1. binder_bindings/
  2. client_library/
  3. common/
  4. dbus_bindings/
  5. init/
  6. payload_consumer/
  7. payload_generator/
  8. sample_images/
  9. scripts/
  10. update_manager/
  11. update_payload_key/
  12. .gitignore
  13. Android.mk
  14. binder_service_android.cc
  15. binder_service_android.h
  16. binder_service_brillo.cc
  17. binder_service_brillo.h
  18. boot_control_android.cc
  19. boot_control_android.h
  20. boot_control_chromeos.cc
  21. boot_control_chromeos.h
  22. boot_control_chromeos_unittest.cc
  23. boot_control_recovery.cc
  24. boot_control_recovery.h
  25. boot_control_recovery_stub.cc
  26. certificate_checker.cc
  27. certificate_checker.h
  28. certificate_checker_unittest.cc
  29. chrome_browser_proxy_resolver.cc
  30. chrome_browser_proxy_resolver.h
  31. chrome_browser_proxy_resolver_unittest.cc
  32. common_service.cc
  33. common_service.h
  34. common_service_unittest.cc
  35. connection_manager.cc
  36. connection_manager.h
  37. connection_manager_android.cc
  38. connection_manager_android.h
  39. connection_manager_interface.h
  40. connection_manager_unittest.cc
  41. connection_utils.cc
  42. connection_utils.h
  43. daemon.cc
  44. daemon.h
  45. daemon_state_android.cc
  46. daemon_state_android.h
  47. daemon_state_interface.h
  48. dbus_connection.cc
  49. dbus_connection.h
  50. dbus_service.cc
  51. dbus_service.h
  52. dbus_test_utils.h
  53. fake_file_writer.h
  54. fake_p2p_manager.h
  55. fake_p2p_manager_configuration.h
  56. fake_shill_proxy.cc
  57. fake_shill_proxy.h
  58. fake_system_state.cc
  59. fake_system_state.h
  60. generate_pc_file.sh
  61. hardware_android.cc
  62. hardware_android.h
  63. hardware_chromeos.cc
  64. hardware_chromeos.h
  65. hardware_chromeos_unittest.cc
  66. image_properties.h
  67. image_properties_android.cc
  68. image_properties_chromeos.cc
  69. image_properties_chromeos_unittest.cc
  70. libcurl_http_fetcher.cc
  71. libcurl_http_fetcher.h
  72. libupdate_engine-client-test.pc.in
  73. libupdate_engine-client.pc.in
  74. local_coverage_rate
  75. main.cc
  76. metrics.cc
  77. metrics.h
  78. metrics_utils.cc
  79. metrics_utils.h
  80. metrics_utils_unittest.cc
  81. mock_certificate_checker.h
  82. mock_connection_manager.h
  83. mock_file_writer.h
  84. mock_omaha_request_params.h
  85. mock_p2p_manager.h
  86. mock_payload_state.h
  87. mock_power_manager.h
  88. mock_proxy_resolver.h
  89. mock_update_attempter.h
  90. MODULE_LICENSE_APACHE2
  91. network_selector.h
  92. network_selector_android.cc
  93. network_selector_android.h
  94. network_selector_interface.h
  95. network_selector_stub.cc
  96. network_selector_stub.h
  97. NOTICE
  98. omaha_request_action.cc
  99. omaha_request_action.h
  100. omaha_request_action_unittest.cc
  101. omaha_request_params.cc
  102. omaha_request_params.h
  103. omaha_request_params_unittest.cc
  104. omaha_response.h
  105. omaha_response_handler_action.cc
  106. omaha_response_handler_action.h
  107. omaha_response_handler_action_unittest.cc
  108. omaha_utils.cc
  109. omaha_utils.h
  110. omaha_utils_unittest.cc
  111. OWNERS
  112. p2p_manager.cc
  113. p2p_manager.h
  114. p2p_manager_unittest.cc
  115. parcelable_update_engine_status.cc
  116. parcelable_update_engine_status.h
  117. payload_state.cc
  118. payload_state.h
  119. payload_state_interface.h
  120. payload_state_unittest.cc
  121. power_manager_android.cc
  122. power_manager_android.h
  123. power_manager_chromeos.cc
  124. power_manager_chromeos.h
  125. power_manager_interface.h
  126. PRESUBMIT.cfg
  127. PREUPLOAD.cfg
  128. proxy_resolver.cc
  129. proxy_resolver.h
  130. proxy_resolver_unittest.cc
  131. pylintrc
  132. real_system_state.cc
  133. real_system_state.h
  134. run_unittests
  135. sample_omaha_v3_response.xml
  136. service_delegate_android_interface.h
  137. service_observer_interface.h
  138. shill_proxy.cc
  139. shill_proxy.h
  140. shill_proxy_interface.h
  141. sideload_main.cc
  142. system_state.h
  143. tar_bunzip2.gypi
  144. test_http_server.cc
  145. test_subprocess.cc
  146. testrunner.cc
  147. unittest_key.pem
  148. unittest_key2.pem
  149. update_attempter.cc
  150. update_attempter.h
  151. update_attempter_android.cc
  152. update_attempter_android.h
  153. update_attempter_unittest.cc
  154. update_engine-client.gyp
  155. update_engine.conf
  156. update_engine.gyp
  157. update_engine.rc
  158. update_engine_client.cc
  159. update_engine_client_android.cc
  160. update_metadata.proto
  161. update_status_utils.cc
  162. update_status_utils.h
  163. UpdateEngine.conf
  164. utils_android.cc
  165. utils_android.h
  166. WATCHLISTS