Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1943)

Unified Diff: download_action.cc

Issue 3471006: AU: Speed up updates by using buffered writes. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: update comment Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « download_action.h ('k') | file_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: download_action.cc
diff --git a/download_action.cc b/download_action.cc
index 5096703419fe06ce56da445fdd2307b6fade614c..9779f2af704686592b527cd11063ec2c8a3016d2 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -17,6 +17,9 @@ using std::vector;
namespace chromeos_update_engine {
+// Use a buffer to reduce the number of IOPS on SSD devices.
+const size_t kFileWriterBufferSize = 128 * 1024; // 128 KiB
+
DownloadAction::DownloadAction(HttpFetcher* http_fetcher)
: writer_(NULL),
http_fetcher_(http_fetcher),
@@ -41,8 +44,15 @@ void DownloadAction::PerformAction() {
if (install_plan_.is_full_update) {
kernel_file_writer_.reset(new DirectFileWriter);
rootfs_file_writer_.reset(new DirectFileWriter);
- split_file_writer_.reset(new SplitFileWriter(kernel_file_writer_.get(),
- rootfs_file_writer_.get()));
+ kernel_buffered_file_writer_.reset(
+ new BufferedFileWriter(kernel_file_writer_.get(),
+ kFileWriterBufferSize));
+ rootfs_buffered_file_writer_.reset(
+ new BufferedFileWriter(rootfs_file_writer_.get(),
+ kFileWriterBufferSize));
+ split_file_writer_.reset(
+ new SplitFileWriter(kernel_buffered_file_writer_.get(),
+ rootfs_buffered_file_writer_.get()));
split_file_writer_->SetFirstOpenArgs(
install_plan_.kernel_install_path.c_str(),
O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE,
« no previous file with comments | « download_action.h ('k') | file_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698