diff --git a/bzip.cc b/bzip.cc
index 4a41980..3ac15d8 100644
--- a/bzip.cc
+++ b/bzip.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "update_engine/gzip.h"
+#include "update_engine/bzip.h"
 #include <stdlib.h>
 #include <algorithm>
 #include <bzlib.h>
diff --git a/delta_diff_generator.cc b/delta_diff_generator.cc
index 4114c32..4181057 100644
--- a/delta_diff_generator.cc
+++ b/delta_diff_generator.cc
@@ -3,3 +3,863 @@
 // found in the LICENSE file.
 
 #include "update_engine/delta_diff_generator.h"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <algorithm>
+#include <set>
+#include <string>
+#include <utility>
+#include <vector>
+#include <bzlib.h>
+#include "chromeos/obsolete_logging.h"
+#include "update_engine/bzip.h"
+#include "update_engine/cycle_breaker.h"
+#include "update_engine/extent_mapper.h"
+#include "update_engine/file_writer.h"
+#include "update_engine/filesystem_iterator.h"
+#include "update_engine/graph_types.h"
+#include "update_engine/graph_utils.h"
+#include "update_engine/subprocess.h"
+#include "update_engine/topological_sort.h"
+#include "update_engine/update_metadata.pb.h"
+#include "update_engine/utils.h"
+
+using std::make_pair;
+using std::min;
+using std::set;
+using std::string;
+using std::vector;
+
+namespace chromeos_update_engine {
+
+typedef DeltaDiffGenerator::Block Block;
+
+namespace {
+const size_t kBlockSize = 4096;
+const char* const kBsdiffPath = "/usr/bin/bsdiff";
+const uint64 kVersionNumber = 1;
+const char* const kDeltaMagic = "CrAU";
+
+// Stores all Extents for a file into 'out'. Returns true on success.
+bool GatherExtents(const string& path,
+                   google::protobuf::RepeatedPtrField<Extent>* out) {
+  vector<Extent> extents;
+  TEST_AND_RETURN_FALSE(extent_mapper::ExtentsForFileFibmap(path, &extents));
+  DeltaDiffGenerator::StoreExtents(extents, out);
+  return true;
+}
+
+// Runs the bsdiff tool on two files and returns the resulting delta in
+// 'out'. Returns true on success.
+bool BsdiffFiles(const string& old_file,
+                 const string& new_file,
+                 vector<char>* out) {
+  const string kPatchFile = "/tmp/delta.patchXXXXXX";
+  string patch_file_path;
+
+  TEST_AND_RETURN_FALSE(
+      utils::MakeTempFile(kPatchFile, &patch_file_path, NULL));
+
+  vector<string> cmd;
+  cmd.push_back(kBsdiffPath);
+  cmd.push_back(old_file);
+  cmd.push_back(new_file);
+  cmd.push_back(patch_file_path);
+
+  int rc = 1;
+  vector<char> patch_file;
+  TEST_AND_RETURN_FALSE(Subprocess::SynchronousExec(cmd, &rc));
+  TEST_AND_RETURN_FALSE(rc == 0);
+  TEST_AND_RETURN_FALSE(utils::ReadFile(patch_file_path, out));
+  unlink(patch_file_path.c_str());
+  return true;
+}
+
+// The blocks vector contains a reader and writer for each block on the
+// filesystem that's being in-place updated. We populate the reader/writer
+// fields of blocks by calling this function.
+// For each block in 'operation' that is read or written, find that block
+// in 'blocks' and set the reader/writer field to the vertex passed.
+// 'graph' is not strictly necessary, but useful for printing out
+// error messages.
+bool AddInstallOpToBlocksVector(
+    const DeltaArchiveManifest_InstallOperation& operation,
+    vector<Block>* blocks,
+    const Graph& graph,
+    Vertex::Index vertex) {
+  LOG(INFO) << "AddInstallOpToBlocksVector(" << vertex << "), "
+            << graph[vertex].file_name;
+  // See if this is already present.
+  TEST_AND_RETURN_FALSE(operation.dst_extents_size() > 0);
+  
+  enum BlockField { READER = 0, WRITER, BLOCK_FIELD_COUNT };
+  for (int field = READER; field < BLOCK_FIELD_COUNT; field++) {
+    const int extents_size =
+        (field == READER) ? operation.src_extents_size() :
+        operation.dst_extents_size();
+    const char* past_participle = (field == READER) ? "read" : "written";
+    const google::protobuf::RepeatedPtrField<Extent>& extents =
+        (field == READER) ? operation.src_extents() : operation.dst_extents();
+    Vertex::Index Block::*access_type =
+        (field == READER) ? &Block::reader : &Block::writer;
+
+    for (int i = 0; i < extents_size; i++) {
+      const Extent& extent = extents.Get(i);
+      if (extent.start_block() == kSparseHole) {
+        // Hole in sparse file. skip
+        continue;
+      }
+      for (uint64_t block = extent.start_block();
+           block < (extent.start_block() + extent.num_blocks()); block++) {
+        LOG(INFO) << "ext: " << i << " block: " << block;
+        if ((*blocks)[block].*access_type != Vertex::kInvalidIndex) {
+          LOG(FATAL) << "Block " << block << " is already "
+                     << past_participle << " by "
+                     << (*blocks)[block].*access_type << "("
+                     << graph[(*blocks)[block].*access_type].file_name
+                     << ") and also " << vertex << "("
+                     << graph[vertex].file_name << ")";
+        }
+        (*blocks)[block].*access_type = vertex;
+      }
+    }
+  }
+  return true;
+}
+
+// For a given regular file which must exist at new_root + path, and may
+// exist at old_root + path, creates a new InstallOperation and adds it to
+// the graph. Also, populates the 'blocks' array as necessary.
+// Also, writes the data necessary to send the file down to the client
+// into data_fd, which has length *data_file_size. *data_file_size is
+// updated appropriately.
+// Returns true on success.
+bool DeltaReadFile(Graph* graph,
+                   vector<Block>* blocks,
+                   const string& old_root,
+                   const string& new_root,
+                   const string& path,  // within new_root
+                   int data_fd,
+                   off_t* data_file_size) {
+  vector<char> data;
+  DeltaArchiveManifest_InstallOperation operation;
+
+  TEST_AND_RETURN_FALSE(DeltaDiffGenerator::ReadFileToDiff(old_root + path,
+                                                           new_root + path,
+                                                           &data,
+                                                           &operation));
+
+  // Write the data
+  if (operation.type() != DeltaArchiveManifest_InstallOperation_Type_MOVE) {
+    operation.set_data_offset(*data_file_size);
+    operation.set_data_length(data.size());
+  }
+
+  TEST_AND_RETURN_FALSE(utils::WriteAll(data_fd, &data[0], data.size()));
+  *data_file_size += data.size();
+  
+  // Now, insert into graph and blocks vector
+  graph->resize(graph->size() + 1);
+  graph->back().op = operation;
+  CHECK(graph->back().op.has_type());
+  graph->back().file_name = path;
+  
+  TEST_AND_RETURN_FALSE(AddInstallOpToBlocksVector(graph->back().op,
+                                                   blocks,
+                                                   *graph,
+                                                   graph->size() - 1));
+  return true;
+}
+
+// For each regular file within new_root, creates a node in the graph,
+// determines the best way to compress it (REPLACE, REPLACE_BZ, COPY, BSDIFF),
+// and writes any necessary data to the end of data_fd.
+bool DeltaReadFiles(Graph* graph,
+                    vector<Block>* blocks,
+                    const string& old_root,
+                    const string& new_root,
+                    int data_fd,
+                    off_t* data_file_size) {
+  set<ino_t> visited_inodes;
+  for (FilesystemIterator fs_iter(new_root,
+                                  utils::SetWithValue<string>("/lost+found"));
+       !fs_iter.IsEnd(); fs_iter.Increment()) {
+    if (!S_ISREG(fs_iter.GetStat().st_mode))
+      continue;
+
+    // Make sure we visit each inode only once.
+    if (utils::SetContainsKey(visited_inodes, fs_iter.GetStat().st_ino))
+      continue;
+    visited_inodes.insert(fs_iter.GetStat().st_ino);
+    if (fs_iter.GetStat().st_size == 0)
+      continue;
+
+    LOG(INFO) << "Encoding file " << fs_iter.GetPartialPath();
+    
+    TEST_AND_RETURN_FALSE(DeltaReadFile(graph,
+                                        blocks,
+                                        old_root,
+                                        new_root,
+                                        fs_iter.GetPartialPath(),
+                                        data_fd,
+                                        data_file_size));
+  }
+  return true;
+}
+
+// Attempts to find block_count blocks to use as scratch space.
+// Returns true on success.
+// Right now we return exactly as many blocks as are required.
+// TODO(adlr): consider returning all scratch blocks,
+// even if there are extras, to make it easier for a scratch allocator
+// to find contiguous regions for specific scratch writes.
+bool FindScratchSpace(const vector<Block>& blocks,
+                      vector<Block>::size_type block_count,
+                      vector<Extent>* out) {
+  // Scan blocks for blocks that are neither read nor written.
+  // If we don't find enough of those, return false.
+  // TODO(adlr): return blocks that are written by
+  // operations that don't have incoming edges (and thus, can be
+  // deferred until all old blocks are read by other operations).
+  vector<Extent> ret;
+  vector<Block>::size_type blocks_found = 0;
+  for (vector<Block>::size_type i = 0;
+       i < blocks.size() && blocks_found < block_count; i++) {
+    if (blocks[i].reader == Vertex::kInvalidIndex &&
+        blocks[i].writer == Vertex::kInvalidIndex) {
+      graph_utils::AppendBlockToExtents(&ret, i);
+      blocks_found++;
+    }
+  }
+  if (blocks_found == block_count) {
+    LOG(INFO) << "returning " << blocks_found << " scratch blocks";
+    out->swap(ret);
+    return true;
+  }
+  return false;
+}
+
+// This class takes a collection of Extents and allows the client to
+// allocate space from these extents. The client must not request more
+// space then exists in the source extents. Space is allocated from the
+// beginning of the source extents on; no consideration is paid to
+// fragmentation.
+class LinearExtentAllocator {
+ public:
+  explicit LinearExtentAllocator(const vector<Extent>& extents)
+      : extents_(extents),
+        extent_index_(0),
+        extent_blocks_allocated_(0) {}
+  vector<Extent> Allocate(const uint64_t block_count) {
+    vector<Extent> ret;
+    for (uint64_t blocks = 0; blocks < block_count; blocks++) {
+      CHECK_LT(extent_index_, extents_.size());
+      CHECK_LT(extent_blocks_allocated_, extents_[extent_index_].num_blocks());
+      graph_utils::AppendBlockToExtents(
+          &ret,
+          extents_[extent_index_].start_block() + extent_blocks_allocated_);
+      extent_blocks_allocated_++;
+      if (extent_blocks_allocated_ >= extents_[extent_index_].num_blocks()) {
+        extent_blocks_allocated_ = 0;
+        extent_index_++;
+      }
+    }
+    return ret;
+  }
+ private:
+  const vector<Extent> extents_;
+  vector<Extent>::size_type extent_index_;  // current Extent
+  // number of blocks allocated from the current extent
+  uint64_t extent_blocks_allocated_;
+};
+
+// Reads blocks from image_path that are not yet marked as being written
+// in the blocks array. These blocks that remain are non-file-data blocks.
+// In the future we might consider intelligent diffing between this data
+// and data in the previous image, but for now we just bzip2 compress it
+// and include it in the update.
+// Creates a new node in the graph to write these blocks and writes the
+// appropriate blob to blobs_fd. Reads and updates blobs_length;
+bool ReadUnwrittenBlocks(const vector<Block>& blocks,
+                         int blobs_fd,
+                         off_t* blobs_length,
+                         const string& image_path,
+                         DeltaArchiveManifest_InstallOperation* out_op) {
+  int image_fd = open(image_path.c_str(), O_RDONLY, 000);
+  TEST_AND_RETURN_FALSE_ERRNO(image_fd >= 0);
+  ScopedFdCloser image_fd_closer(&image_fd);
+
+  string temp_file_path;
+  TEST_AND_RETURN_FALSE(utils::MakeTempFile("/tmp/CrAU_temp_data.XXXXXX",
+                                            &temp_file_path,
+                                            NULL));
+
+  FILE* file = fopen(temp_file_path.c_str(), "w");
+  TEST_AND_RETURN_FALSE(file);
+  int err = BZ_OK;
+  
+  BZFILE* bz_file = BZ2_bzWriteOpen(&err,
+                                    file,
+                                    9,  // max compression
+                                    0,  // verbosity
+                                    0);  // default work factor
+  TEST_AND_RETURN_FALSE(err == BZ_OK);
+  
+  vector<Extent> extents;
+  vector<Block>::size_type block_count = 0;
+  
+  LOG(INFO) << "Appending left over blocks to extents";
+  for (vector<Block>::size_type i = 0; i < blocks.size(); i++) {
+    if (blocks[i].writer != Vertex::kInvalidIndex)
+      continue;
+    graph_utils::AppendBlockToExtents(&extents, i);
+    block_count++;
+  }
+
+  // Code will handle 'buf' at any size that's a multiple of kBlockSize,
+  // so we arbitrarily set it to 1024 * kBlockSize.
+  vector<char> buf(1024 * kBlockSize);
+
+  LOG(INFO) << "Reading left over blocks";
+  vector<Block>::size_type blocks_copied_count = 0;
+
+  // For each extent in extents, write the data into BZ2_bzWrite which
+  // sends it to an output file.
+  // We use the temporary buffer 'buf' to hold the data, which may be
+  // smaller than the extent, so in that case we have to loop to get
+  // the extent's data (that's the inner while loop).
+  for (vector<Extent>::const_iterator it = extents.begin();
+       it != extents.end(); ++it) {
+    vector<Block>::size_type blocks_read = 0;
+    while (blocks_read < it->num_blocks()) {
+      const int copy_block_cnt =
+          min(buf.size() / kBlockSize,
+              static_cast<vector<char>::size_type>(
+                  it->num_blocks() - blocks_read));
+      ssize_t rc = pread(image_fd,
+                         &buf[0],
+                         copy_block_cnt * kBlockSize,
+                         (it->start_block() + blocks_read) * kBlockSize);
+      TEST_AND_RETURN_FALSE_ERRNO(rc >= 0);
+      TEST_AND_RETURN_FALSE(static_cast<size_t>(rc) ==
+                            copy_block_cnt * kBlockSize);
+      BZ2_bzWrite(&err, bz_file, &buf[0], copy_block_cnt * kBlockSize);
+      TEST_AND_RETURN_FALSE(err == BZ_OK);
+      blocks_read += copy_block_cnt;
+      blocks_copied_count += copy_block_cnt;
+      LOG(INFO) << "progress: " << ((float)blocks_copied_count)/block_count;
+    }
+  }
+  BZ2_bzWriteClose(&err, bz_file, 0, NULL, NULL);
+  TEST_AND_RETURN_FALSE(err == BZ_OK);
+  bz_file = NULL;
+  TEST_AND_RETURN_FALSE_ERRNO(0 == fclose(file));
+  file = NULL;
+  
+  vector<char> compressed_data;
+  LOG(INFO) << "Reading compressed data off disk";
+  TEST_AND_RETURN_FALSE(utils::ReadFile(temp_file_path, &compressed_data));
+  TEST_AND_RETURN_FALSE(unlink(temp_file_path.c_str()) == 0);
+  
+  // Add node to graph to write these blocks
+  out_op->set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+  out_op->set_data_offset(*blobs_length);
+  out_op->set_data_length(compressed_data.size());
+  *blobs_length += compressed_data.size();
+  out_op->set_dst_length(kBlockSize * block_count);
+  DeltaDiffGenerator::StoreExtents(extents, out_op->mutable_dst_extents());
+  
+  TEST_AND_RETURN_FALSE(utils::WriteAll(blobs_fd,
+                                        &compressed_data[0],
+                                        compressed_data.size()));
+  LOG(INFO) << "done with extra blocks";
+  return true;
+}
+
+// Writes the uint64 passed in in host-endian to the file as big-endian.
+// Returns true on success.
+bool WriteUint64AsBigEndian(FileWriter* writer, const uint64 value) {
+  uint64 value_be = htobe64(value);
+  TEST_AND_RETURN_FALSE(writer->Write(&value_be, sizeof(value_be)) ==
+                        sizeof(value_be));
+  return true;
+}
+
+// Adds each operation from the graph to the manifest in the order
+// specified by 'order'.
+void InstallOperationsToManifest(
+    const Graph& graph,
+    const vector<Vertex::Index>& order,
+    DeltaArchiveManifest* out_manifest) {
+  for (vector<Vertex::Index>::const_iterator it = order.begin();
+       it != order.end(); ++it) {
+    DeltaArchiveManifest_InstallOperation* op =
+        out_manifest->add_install_operations();
+    *op = graph[*it].op;
+  }
+}
+
+void CheckGraph(const Graph& graph) {
+  for (Graph::const_iterator it = graph.begin(); it != graph.end(); ++it) {
+    CHECK(it->op.has_type());
+  }
+}
+
+}  // namespace {}
+
+bool DeltaDiffGenerator::ReadFileToDiff(
+    const string& old_filename,
+    const string& new_filename,
+    vector<char>* out_data,
+    DeltaArchiveManifest_InstallOperation* out_op) {
+  // Read new data in
+  vector<char> new_data;
+  TEST_AND_RETURN_FALSE(utils::ReadFile(new_filename, &new_data));
+  
+  TEST_AND_RETURN_FALSE(!new_data.empty());
+  
+  vector<char> new_data_bz;
+  TEST_AND_RETURN_FALSE(BzipCompress(new_data, &new_data_bz));
+  CHECK(!new_data_bz.empty());
+
+  vector<char> data;  // Data blob that will be written to delta file.
+
+  DeltaArchiveManifest_InstallOperation operation;
+  size_t current_best_size = 0;
+  if (new_data.size() <= new_data_bz.size()) {
+    operation.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE);
+    current_best_size = new_data.size();
+    data = new_data;
+  } else {
+    operation.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+    current_best_size = new_data_bz.size();
+    data = new_data_bz;
+  }
+
+  // Do we have an original file to consider?
+  struct stat old_stbuf;
+  if (0 != stat(old_filename.c_str(), &old_stbuf)) {
+    // If stat-ing the old file fails, it should be because it doesn't exist.
+    TEST_AND_RETURN_FALSE(errno == ENOTDIR || errno == ENOENT);
+  } else {
+    // Read old data
+    vector<char> old_data;
+    TEST_AND_RETURN_FALSE(utils::ReadFile(old_filename, &old_data));
+    if (old_data == new_data) {
+      // No change in data.
+      operation.set_type(DeltaArchiveManifest_InstallOperation_Type_MOVE);
+      current_best_size = 0;
+      data.clear();
+    } else {
+      // Try bsdiff of old to new data
+      vector<char> bsdiff_delta;
+      TEST_AND_RETURN_FALSE(
+          BsdiffFiles(old_filename, new_filename, &bsdiff_delta));
+      CHECK_GT(bsdiff_delta.size(), 0);
+      if (bsdiff_delta.size() < current_best_size) {
+        operation.set_type(DeltaArchiveManifest_InstallOperation_Type_BSDIFF);
+        current_best_size = bsdiff_delta.size();
+        
+        data = bsdiff_delta;
+      }
+    }
+  }
+  
+  // Set parameters of the operations
+  CHECK_EQ(data.size(), current_best_size);
+  
+  if (operation.type() == DeltaArchiveManifest_InstallOperation_Type_MOVE ||
+      operation.type() == DeltaArchiveManifest_InstallOperation_Type_BSDIFF) {
+    TEST_AND_RETURN_FALSE(
+        GatherExtents(old_filename, operation.mutable_src_extents()));
+    operation.set_src_length(old_stbuf.st_size);
+  }
+
+  TEST_AND_RETURN_FALSE(
+      GatherExtents(new_filename, operation.mutable_dst_extents()));
+  operation.set_dst_length(new_data.size());
+  
+  out_data->swap(data);
+  *out_op = operation;
+  
+  return true;
+}
+
+void DeltaDiffGenerator::SubstituteBlocks(
+    DeltaArchiveManifest_InstallOperation* op,
+    const vector<Extent>& remove_extents,
+    const vector<Extent>& replace_extents) {
+  // First, expand out the blocks that op reads from
+  vector<uint64> read_blocks;
+  for (int i = 0; i < op->src_extents_size(); i++) {
+    const Extent& extent = op->src_extents(i);
+    if (extent.start_block() == kSparseHole) {
+      read_blocks.resize(read_blocks.size() + extent.num_blocks(), kSparseHole);
+    } else {
+      for (uint64 block = extent.start_block();
+           block < (extent.start_block() + extent.num_blocks()); block++) {
+        read_blocks.push_back(block);
+      }
+    }
+  }
+  {
+    // Expand remove_extents and replace_extents
+    vector<uint64> remove_extents_expanded;
+    for (vector<Extent>::const_iterator it = remove_extents.begin();
+         it != remove_extents.end(); ++it) {
+      const Extent& extent = *it;
+      for (uint64 block = extent.start_block();
+           block < (extent.start_block() + extent.num_blocks()); block++) {
+        remove_extents_expanded.push_back(block);
+      }
+    }
+    vector<uint64> replace_extents_expanded;
+    for (vector<Extent>::const_iterator it = replace_extents.begin();
+         it != replace_extents.end(); ++it) {
+      const Extent& extent = *it;
+      for (uint64 block = extent.start_block();
+           block < (extent.start_block() + extent.num_blocks()); block++) {
+        replace_extents_expanded.push_back(block);
+      }
+    }
+    CHECK_EQ(remove_extents_expanded.size(), replace_extents_expanded.size());
+    for (vector<uint64>::size_type i = 0;
+         i < replace_extents_expanded.size(); i++) {
+      vector<uint64>::size_type index = 0;
+      CHECK(utils::VectorIndexOf(read_blocks,
+                                 remove_extents_expanded[i],
+                                 &index));
+      CHECK(read_blocks[index] == remove_extents_expanded[i]);
+      read_blocks[index] = replace_extents_expanded[i];
+    }
+  }
+  // Convert read_blocks back to extents
+  op->clear_src_extents();
+  vector<Extent> new_extents;
+  for (vector<uint64>::const_iterator it = read_blocks.begin();
+       it != read_blocks.end(); ++it) {
+    graph_utils::AppendBlockToExtents(&new_extents, *it);
+  }
+  DeltaDiffGenerator::StoreExtents(new_extents, op->mutable_src_extents());
+}
+
+bool DeltaDiffGenerator::CutEdges(Graph* graph,
+                                  const vector<Block>& blocks,
+                                  const set<Edge>& edges) {
+  // First, find enough scratch space for the edges we'll be cutting.
+  vector<Block>::size_type blocks_required = 0;
+  for (set<Edge>::const_iterator it = edges.begin(); it != edges.end(); ++it) {
+    blocks_required += graph_utils::EdgeWeight(*graph, *it);
+  }
+  vector<Extent> scratch_extents;
+  LOG(INFO) << "requesting " << blocks_required << " blocks of scratch";
+  TEST_AND_RETURN_FALSE(
+      FindScratchSpace(blocks, blocks_required, &scratch_extents));
+  LinearExtentAllocator scratch_allocator(scratch_extents);
+  
+  uint64_t scratch_blocks_used = 0;
+  for (set<Edge>::const_iterator it = edges.begin();
+       it != edges.end(); ++it) {
+    vector<Extent> old_extents =
+        (*graph)[it->first].out_edges[it->second].extents;
+    // Choose some scratch space
+    scratch_blocks_used += graph_utils::EdgeWeight(*graph, *it);
+    LOG(INFO) << "using " << graph_utils::EdgeWeight(*graph, *it)
+              << " scratch blocks ("
+              << scratch_blocks_used << ")";
+    vector<Extent> scratch =
+        scratch_allocator.Allocate(graph_utils::EdgeWeight(*graph, *it));
+    // create vertex to copy original->scratch
+    graph->resize(graph->size() + 1);
+    
+    // make node depend on the copy operation
+    (*graph)[it->first].out_edges.insert(make_pair(graph->size() - 1,
+                                                   EdgeProperties()));
+
+    // Set src/dst extents and other proto variables for copy operation
+    graph->back().op.set_type(DeltaArchiveManifest_InstallOperation_Type_MOVE);
+    DeltaDiffGenerator::StoreExtents(
+        (*graph)[it->first].out_edges[it->second].extents,
+        graph->back().op.mutable_src_extents());
+    DeltaDiffGenerator::StoreExtents(scratch,
+                                     graph->back().op.mutable_dst_extents());
+    graph->back().op.set_src_length(
+        graph_utils::EdgeWeight(*graph, *it) * kBlockSize);
+    graph->back().op.set_dst_length(graph->back().op.src_length());
+
+    // make the dest node read from the scratch space
+    DeltaDiffGenerator::SubstituteBlocks(
+        &((*graph)[it->second].op),
+        (*graph)[it->first].out_edges[it->second].extents,
+        scratch);
+
+    // delete the old edge
+    CHECK_EQ(1, (*graph)[it->first].out_edges.erase(it->second));
+  }
+  return true;
+}
+
+// Stores all Extents in 'extents' into 'out'.
+void DeltaDiffGenerator::StoreExtents(
+    vector<Extent>& extents,
+    google::protobuf::RepeatedPtrField<Extent>* out) {
+  for (vector<Extent>::const_iterator it = extents.begin();
+       it != extents.end(); ++it) {
+    Extent* new_extent = out->Add();
+    *new_extent = *it;
+  }
+}
+
+// Creates all the edges for the graph. Writers of a block point to
+// readers of the same block. This is because for an edge A->B, B
+// must complete before A executes.
+void DeltaDiffGenerator::CreateEdges(Graph* graph,
+                                     const vector<Block>& blocks) {
+  for (vector<Block>::size_type i = 0; i < blocks.size(); i++) {
+    // Blocks with both a reader and writer get an edge
+    if (blocks[i].reader == Vertex::kInvalidIndex ||
+        blocks[i].writer == Vertex::kInvalidIndex)
+      continue;
+    // Don't have a node depend on itself
+    if (blocks[i].reader == blocks[i].writer)
+      continue;
+    // See if there's already an edge we can add onto
+    Vertex::EdgeMap::iterator edge_it =
+        (*graph)[blocks[i].writer].out_edges.find(blocks[i].reader);
+    if (edge_it == (*graph)[blocks[i].writer].out_edges.end()) {
+      // No existing edge. Create one
+      (*graph)[blocks[i].writer].out_edges.insert(
+          make_pair(blocks[i].reader, EdgeProperties()));
+      edge_it = (*graph)[blocks[i].writer].out_edges.find(blocks[i].reader);
+      CHECK_NE(edge_it, (*graph)[blocks[i].writer].out_edges.end());
+    }
+    graph_utils::AppendBlockToExtents(&edge_it->second.extents, i);
+  }
+}
+
+bool DeltaDiffGenerator::ReorderDataBlobs(
+    DeltaArchiveManifest* manifest,
+    const std::string& data_blobs_path,
+    const std::string& new_data_blobs_path) {
+  int in_fd = open(data_blobs_path.c_str(), O_RDONLY, 0);
+  TEST_AND_RETURN_FALSE_ERRNO(in_fd >= 0);
+  ScopedFdCloser in_fd_closer(&in_fd);
+  
+  DirectFileWriter writer;
+  TEST_AND_RETURN_FALSE(
+      writer.Open(new_data_blobs_path.c_str(),
+                  O_WRONLY | O_TRUNC | O_CREAT,
+                  0644) == 0);
+  ScopedFileWriterCloser writer_closer(&writer);
+  uint64 out_file_size = 0;
+  
+  for (int i = 0; i < manifest->install_operations_size(); i++) {
+    DeltaArchiveManifest_InstallOperation* op =
+        manifest->mutable_install_operations(i);
+    if (!op->has_data_offset())
+      continue;
+    CHECK(op->has_data_length());
+    vector<char> buf(op->data_length());
+    ssize_t rc = pread(in_fd, &buf[0], buf.size(), op->data_offset());
+    TEST_AND_RETURN_FALSE(rc == static_cast<ssize_t>(buf.size()));
+
+    op->set_data_offset(out_file_size);
+    TEST_AND_RETURN_FALSE(writer.Write(&buf[0], buf.size()) ==
+                          static_cast<ssize_t>(buf.size()));
+    out_file_size += buf.size();
+  }
+  return true;
+}
+
+bool DeltaDiffGenerator::GenerateDeltaUpdateFile(const string& old_root,
+                                                 const string& old_image,
+                                                 const string& new_root,
+                                                 const string& new_image,
+                                                 const string& output_path) {
+  struct stat old_image_stbuf;
+  TEST_AND_RETURN_FALSE_ERRNO(stat(old_image.c_str(), &old_image_stbuf) == 0);
+  struct stat new_image_stbuf;
+  TEST_AND_RETURN_FALSE_ERRNO(stat(new_image.c_str(), &new_image_stbuf) == 0);
+  LOG_IF(WARNING, new_image_stbuf.st_size != old_image_stbuf.st_size)
+      << "Old and new images are different sizes.";
+  LOG_IF(FATAL, new_image_stbuf.st_size % kBlockSize)
+      << "New image not a multiple of block size " << kBlockSize;
+  LOG_IF(FATAL, old_image_stbuf.st_size % kBlockSize)
+      << "Old image not a multiple of block size " << kBlockSize;
+
+  vector<Block> blocks(min(old_image_stbuf.st_size / kBlockSize,
+                           new_image_stbuf.st_size / kBlockSize));
+  LOG(INFO) << "blocks (orig): " << (uint32)(&blocks);
+  LOG(INFO) << "w:" << blocks[4097].writer;
+  LOG(INFO) << "invalid: " << Vertex::kInvalidIndex;
+  LOG(INFO) << "len: " << blocks.size();
+  for (vector<Block>::size_type i = 0; i < blocks.size(); i++) {
+    CHECK(blocks[i].reader == Vertex::kInvalidIndex);
+    CHECK(blocks[i].writer == Vertex::kInvalidIndex);
+  }
+  Graph graph;
+  CheckGraph(graph);
+  
+  const string kTempFileTemplate("/tmp/CrAU_temp_data.XXXXXX");
+  string temp_file_path;
+  off_t data_file_size = 0;
+
+  LOG(INFO) << "Reading files...";
+
+  DeltaArchiveManifest_InstallOperation final_op;
+  {
+    int fd;
+    TEST_AND_RETURN_FALSE(
+        utils::MakeTempFile(kTempFileTemplate, &temp_file_path, &fd));
+    TEST_AND_RETURN_FALSE(fd >= 0);
+    ScopedFdCloser fd_closer(&fd);
+  
+    TEST_AND_RETURN_FALSE(DeltaReadFiles(&graph,
+                                         &blocks,
+                                         old_root,
+                                         new_root,
+                                         fd,
+                                         &data_file_size));
+    CheckGraph(graph);
+                                         
+    // TODO(adlr): read all the rest of the blocks in
+    TEST_AND_RETURN_FALSE(ReadUnwrittenBlocks(blocks,
+                                              fd,
+                                              &data_file_size,
+                                              new_image,
+                                              &final_op));  
+  }
+  CheckGraph(graph);
+  
+  LOG(INFO) << "Creating edges...";
+  CreateEdges(&graph, blocks);
+  CheckGraph(graph);
+  
+  CycleBreaker cycle_breaker;
+  LOG(INFO) << "Finding cycles...";
+  set<Edge> cut_edges;
+  cycle_breaker.BreakCycles(graph, &cut_edges);
+  CheckGraph(graph);
+
+  // Calculate number of scratch blocks needed
+
+  LOG(INFO) << "Cutting cycles...";
+  TEST_AND_RETURN_FALSE(CutEdges(&graph, blocks, cut_edges));
+  CheckGraph(graph);
+
+  vector<Vertex::Index> final_order;
+  LOG(INFO) << "Ordering...";
+  TopologicalSort(graph, &final_order);
+  CheckGraph(graph);
+  
+  // Convert to protobuf Manifest object
+  DeltaArchiveManifest manifest;
+  CheckGraph(graph);
+  InstallOperationsToManifest(graph, final_order, &manifest);
+  {
+    // Write final operation
+    DeltaArchiveManifest_InstallOperation* op =
+        manifest.add_install_operations();
+    *op = final_op;
+    CHECK(op->has_type());
+    LOG(INFO) << "final op length: " << op->data_length();
+  }
+  CheckGraph(graph);
+  manifest.set_block_size(kBlockSize);
+  // TODO(adlr): set checksums
+
+  // Reorder the data blobs with the newly ordered manifest
+  string ordered_blobs_path;
+  TEST_AND_RETURN_FALSE(utils::MakeTempFile(
+      "/tmp/CrAU_temp_data.ordered.XXXXXX",
+      &ordered_blobs_path,
+      false));
+  TEST_AND_RETURN_FALSE(ReorderDataBlobs(&manifest,
+                                         temp_file_path,
+                                         ordered_blobs_path));
+
+  // Check that install op blobs are in order and that all blocks are written.
+  {
+    vector<uint32> written_count(blocks.size(), 0);
+    uint64 next_blob_offset = 0;
+    for (int i = 0; i < manifest.install_operations_size(); i++) {
+      const DeltaArchiveManifest_InstallOperation& op =
+          manifest.install_operations(i);
+      for (int j = 0; j < op.dst_extents_size(); j++) {
+        const Extent& extent = op.dst_extents(j);
+        for (uint64 block = extent.start_block();
+             block < (extent.start_block() + extent.num_blocks()); block++) {
+          written_count[block]++;
+        }
+      }
+      if (op.has_data_offset()) {
+        if (op.data_offset() != next_blob_offset) {
+          LOG(FATAL) << "bad blob offset! " << op.data_offset() << " != "
+                     << next_blob_offset;
+        }
+        next_blob_offset += op.data_length();
+      }
+    }
+    // check all blocks written to
+    for (vector<uint32>::size_type i = 0; i < written_count.size(); i++) {
+      if (written_count[i] == 0) {
+        LOG(FATAL) << "block " << i << " not written!";
+      }
+    }
+  }
+
+  // Serialize protobuf
+  string serialized_manifest;
+  
+  CheckGraph(graph);
+  TEST_AND_RETURN_FALSE(manifest.AppendToString(&serialized_manifest));
+  CheckGraph(graph);
+
+  LOG(INFO) << "Writing final delta file header...";
+  DirectFileWriter writer;
+  TEST_AND_RETURN_FALSE_ERRNO(writer.Open(output_path.c_str(),
+                                          O_WRONLY | O_CREAT | O_TRUNC,
+                                          0644) == 0);
+  ScopedFileWriterCloser writer_closer(&writer);
+  
+  // Write header
+  TEST_AND_RETURN_FALSE(writer.Write(kDeltaMagic, strlen(kDeltaMagic)) ==
+                        strlen(kDeltaMagic));
+  
+  // Write version number
+  TEST_AND_RETURN_FALSE(WriteUint64AsBigEndian(&writer, kVersionNumber));
+  
+  // Write protobuf length
+  TEST_AND_RETURN_FALSE(WriteUint64AsBigEndian(&writer,
+                                               serialized_manifest.size()));
+  
+  // Write protobuf
+  LOG(INFO) << "Writing final delta file protobuf... "
+            << serialized_manifest.size();
+  TEST_AND_RETURN_FALSE(writer.Write(serialized_manifest.data(),
+                                     serialized_manifest.size()) ==
+                        static_cast<ssize_t>(serialized_manifest.size()));
+  
+  // Append the data blobs
+  LOG(INFO) << "Writing final delta file data blobs...";
+  int blobs_fd = open(temp_file_path.c_str(), O_RDONLY, 0);
+  ScopedFdCloser blobs_fd_closer(&blobs_fd);
+  TEST_AND_RETURN_FALSE(blobs_fd >= 0);
+  for (;;) {
+    char buf[kBlockSize];
+    ssize_t rc = read(blobs_fd, buf, sizeof(buf));
+    if (0 == rc) {
+      // EOF
+      break;
+    }
+    TEST_AND_RETURN_FALSE_ERRNO(rc > 0);
+    TEST_AND_RETURN_FALSE(writer.Write(buf, rc) == rc);
+  }
+  
+  LOG(INFO) << "All done. Successfully created delta file.";
+  return true;
+}
+
+};  // namespace chromeos_update_engine
diff --git a/delta_diff_generator.h b/delta_diff_generator.h
index 6b232da..6e48519 100644
--- a/delta_diff_generator.h
+++ b/delta_diff_generator.h
@@ -1,15 +1,111 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__
 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_DIFF_GENERATOR_H__
 
+#include <string>
+#include <vector>
 #include "base/basictypes.h"
+#include "update_engine/graph_types.h"
+#include "update_engine/update_metadata.pb.h"
+
+// There is one function in DeltaDiffGenerator of importance to users
+// of the class: GenerateDeltaUpdateFile(). Before calling it,
+// the old and new images must be mounted. Call GenerateDeltaUpdateFile()
+// with both the mount-points of the images in addition to the paths of
+// the images (both old and new). A delta from old to new will be
+// generated and stored in output_path.
 
 namespace chromeos_update_engine {
 
 class DeltaDiffGenerator {
+ public:
+  // Represents a disk block on the install partition.
+  struct Block {
+    // During install, each block on the install partition will be written
+    // and some may be read (in all likelihood, many will be read).
+    // The reading and writing will be performed by InstallOperations,
+    // each of which has a corresponding vertex in a graph.
+    // A Block object tells which vertex will read or write this block
+    // at install time.
+    // Generally, there will be a vector of Block objects whose length
+    // is the number of blocks on the install partition.
+    Block() : reader(Vertex::kInvalidIndex), writer(Vertex::kInvalidIndex) {}
+    Vertex::Index reader;
+    Vertex::Index writer;
+  };
+
+  // This is the only function that external users of the class should call.
+  // old_image and new_image are paths to two image files. They should be
+  // mounted read-only at paths old_root and new_root respectively.
+  // output_path is the filename where the delta update should be written.
+  // Returns true on success.
+  static bool GenerateDeltaUpdateFile(const std::string& old_root,
+                                      const std::string& old_image,
+                                      const std::string& new_root,
+                                      const std::string& new_image,
+                                      const std::string& output_path);
+
+  // These functions are public so that the unit tests can access them:
+
+  // Reads old_filename (if it exists) and a new_filename and determines
+  // the smallest way to encode this file for the diff. It stores
+  // necessary data in out_data and fills in out_op.
+  // If there's no change in old and new files, it creates a MOVE
+  // operation. If there is a change, or the old file doesn't exist,
+  // the smallest of REPLACE, REPLACE_BZ, or BSDIFF wins.
+  // new_filename must contain at least one byte.
+  // Returns true on success.
+  static bool ReadFileToDiff(const std::string& old_filename,
+                             const std::string& new_filename,
+                             std::vector<char>* out_data,
+                             DeltaArchiveManifest_InstallOperation* out_op);
+
+  // Modifies blocks read by 'op' so that any blocks referred to by
+  // 'remove_extents' are replaced with blocks from 'replace_extents'.
+  // 'remove_extents' and 'replace_extents' must be the same number of blocks.
+  // Blocks will be substituted in the order listed in the vectors.
+  // E.g. if 'op' reads blocks 1, 2, 3, 4, 5, 6, 7, 8, remove_extents
+  // contains blocks 6, 2, 3, 5, and replace blocks contains
+  // 12, 13, 14, 15, then op will be changed to read from:
+  // 1, 13, 14, 4, 15, 12, 7, 8
+  static void SubstituteBlocks(DeltaArchiveManifest_InstallOperation* op,
+                               const std::vector<Extent>& remove_extents,
+                               const std::vector<Extent>& replace_extents);
+
+  // Cuts 'edges' from 'graph' according to the AU algorithm. This means
+  // for each edge A->B, remove the dependency that B occur before A.
+  // Do this by creating a new operation X that copies from the blocks
+  // specified by the edge's properties to temp space T. Modify B to read
+  // from T rather than the blocks in the edge. Modify A to depend on X,
+  // but not on B. Free space is found by looking in 'blocks'.
+  // Returns true on success.
+  static bool CutEdges(Graph* graph,
+                       const std::vector<Block>& blocks,
+                       const std::set<Edge>& edges);
+
+  // Stores all Extents in 'extents' into 'out'.
+  static void StoreExtents(std::vector<Extent>& extents,
+                           google::protobuf::RepeatedPtrField<Extent>* out);
+                           
+  // Creates all the edges for the graph. Writers of a block point to
+  // readers of the same block. This is because for an edge A->B, B
+  // must complete before A executes.
+  static void CreateEdges(Graph* graph, const std::vector<Block>& blocks);
+  
+  // Install operations in the manifest may reference data blobs, which
+  // are in data_blobs_path. This function creates a new data blobs file
+  // with the data blobs in the same order as the referencing install
+  // operations in the manifest. E.g. if manifest[0] has a data blob
+  // "X" at offset 1, manifest[1] has a data blob "Y" at offset 0,
+  // and data_blobs_path's file contains "YX", new_data_blobs_path
+  // will set to be a file that contains "XY".
+  static bool ReorderDataBlobs(DeltaArchiveManifest* manifest,
+                               const std::string& data_blobs_path,
+                               const std::string& new_data_blobs_path);
+
  private:
   // This should never be constructed
   DISALLOW_IMPLICIT_CONSTRUCTORS(DeltaDiffGenerator);
diff --git a/delta_diff_generator_unittest.cc b/delta_diff_generator_unittest.cc
index a5def92..644d9d8 100644
--- a/delta_diff_generator_unittest.cc
+++ b/delta_diff_generator_unittest.cc
@@ -8,21 +8,341 @@
 #include <unistd.h>
 #include <set>
 #include <string>
+#include <utility>
 #include <vector>
-#include "base/string_util.h"
 #include <gtest/gtest.h>
 #include "chromeos/obsolete_logging.h"
-#include "update_engine/decompressing_file_writer.h"
+#include "update_engine/cycle_breaker.h"
 #include "update_engine/delta_diff_generator.h"
-#include "update_engine/delta_diff_parser.h"
-#include "update_engine/gzip.h"
-#include "update_engine/mock_file_writer.h"
+#include "update_engine/graph_types.h"
+#include "update_engine/graph_utils.h"
 #include "update_engine/subprocess.h"
 #include "update_engine/test_utils.h"
 #include "update_engine/utils.h"
 
+using std::make_pair;
+using std::set;
+using std::string;
+using std::vector;
+
 namespace chromeos_update_engine {
 
-class DeltaDiffGeneratorTest : public ::testing::Test {};
+typedef DeltaDiffGenerator::Block Block;
+
+namespace {
+int64 BlocksInExtents(
+    const google::protobuf::RepeatedPtrField<Extent>& extents) {
+  int64 ret = 0;
+  for (int i = 0; i < extents.size(); i++) {
+    ret += extents.Get(i).num_blocks();
+  }
+  return ret;
+}
+}  // namespace {}
+
+class DeltaDiffGeneratorTest : public ::testing::Test {
+ protected:
+  const string old_path() { return "DeltaDiffGeneratorTest-old_path"; }
+  const string new_path() { return "DeltaDiffGeneratorTest-new_path"; }
+  virtual void TearDown() {
+    unlink(old_path().c_str());
+    unlink(new_path().c_str());
+  }
+};
+
+TEST_F(DeltaDiffGeneratorTest, RunAsRootMoveSmallTest) {
+  EXPECT_TRUE(utils::WriteFile(old_path().c_str(),
+                               reinterpret_cast<const char*>(kRandomString),
+                               sizeof(kRandomString)));
+  EXPECT_TRUE(utils::WriteFile(new_path().c_str(),
+                               reinterpret_cast<const char*>(kRandomString),
+                               sizeof(kRandomString)));
+  vector<char> data;
+  DeltaArchiveManifest_InstallOperation op;
+  EXPECT_TRUE(DeltaDiffGenerator::ReadFileToDiff(old_path(),
+                                                 new_path(),
+                                                 &data,
+                                                 &op));
+  EXPECT_TRUE(data.empty());
+
+  EXPECT_TRUE(op.has_type());
+  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_MOVE, op.type());
+  EXPECT_FALSE(op.has_data_offset());
+  EXPECT_FALSE(op.has_data_length());
+  EXPECT_EQ(1, op.src_extents_size());
+  EXPECT_EQ(sizeof(kRandomString), op.src_length());
+  EXPECT_EQ(1, op.dst_extents_size());
+  EXPECT_EQ(sizeof(kRandomString), op.dst_length());
+  EXPECT_EQ(BlocksInExtents(op.src_extents()),
+            BlocksInExtents(op.dst_extents()));
+  EXPECT_EQ(1, BlocksInExtents(op.dst_extents()));
+}
+
+TEST_F(DeltaDiffGeneratorTest, RunAsRootBsdiffSmallTest) {
+  EXPECT_TRUE(utils::WriteFile(old_path().c_str(),
+                               reinterpret_cast<const char*>(kRandomString),
+                               sizeof(kRandomString) - 1));
+  EXPECT_TRUE(utils::WriteFile(new_path().c_str(),
+                               reinterpret_cast<const char*>(kRandomString),
+                               sizeof(kRandomString)));
+  vector<char> data;
+  DeltaArchiveManifest_InstallOperation op;
+  EXPECT_TRUE(DeltaDiffGenerator::ReadFileToDiff(old_path(),
+                                                 new_path(),
+                                                 &data,
+                                                 &op));
+  EXPECT_FALSE(data.empty());
+
+  EXPECT_TRUE(op.has_type());
+  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_BSDIFF, op.type());
+  EXPECT_FALSE(op.has_data_offset());
+  EXPECT_FALSE(op.has_data_length());
+  EXPECT_EQ(1, op.src_extents_size());
+  EXPECT_EQ(sizeof(kRandomString) - 1, op.src_length());
+  EXPECT_EQ(1, op.dst_extents_size());
+  EXPECT_EQ(sizeof(kRandomString), op.dst_length());
+  EXPECT_EQ(BlocksInExtents(op.src_extents()),
+            BlocksInExtents(op.dst_extents()));
+  EXPECT_EQ(1, BlocksInExtents(op.dst_extents()));
+}
+
+TEST_F(DeltaDiffGeneratorTest, RunAsRootReplaceSmallTest) {
+  vector<char> new_data;
+  for (int i = 0; i < 2; i++) {
+    new_data.insert(new_data.end(),
+                    kRandomString,
+                    kRandomString + sizeof(kRandomString));
+    EXPECT_TRUE(utils::WriteFile(new_path().c_str(),
+                                 &new_data[0],
+                                 new_data.size()));
+    vector<char> data;
+    DeltaArchiveManifest_InstallOperation op;
+    EXPECT_TRUE(DeltaDiffGenerator::ReadFileToDiff(old_path(),
+                                                   new_path(),
+                                                   &data,
+                                                   &op));
+    EXPECT_FALSE(data.empty());
+
+    EXPECT_TRUE(op.has_type());
+    const DeltaArchiveManifest_InstallOperation_Type expected_type =
+        (i == 0 ? DeltaArchiveManifest_InstallOperation_Type_REPLACE :
+         DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+    EXPECT_EQ(expected_type, op.type());
+    EXPECT_FALSE(op.has_data_offset());
+    EXPECT_FALSE(op.has_data_length());
+    EXPECT_EQ(0, op.src_extents_size());
+    EXPECT_FALSE(op.has_src_length());
+    EXPECT_EQ(1, op.dst_extents_size());
+    EXPECT_EQ(new_data.size(), op.dst_length());
+    EXPECT_EQ(1, BlocksInExtents(op.dst_extents()));
+  }
+}
+
+namespace {
+void AppendExtent(vector<Extent>* vect, uint64 start, uint64 length) {
+  vect->resize(vect->size() + 1);
+  vect->back().set_start_block(start);
+  vect->back().set_num_blocks(length);
+}
+void OpAppendExtent(DeltaArchiveManifest_InstallOperation* op,
+                    uint64 start,
+                    uint64 length) {
+  Extent* extent = op->add_src_extents();
+  extent->set_start_block(start);
+  extent->set_num_blocks(length);
+}
+}
+
+TEST_F(DeltaDiffGeneratorTest, SubstituteBlocksTest) {
+  vector<Extent> remove_blocks;
+  AppendExtent(&remove_blocks, 3, 3);
+  AppendExtent(&remove_blocks, 7, 1);
+  vector<Extent> replace_blocks;
+  AppendExtent(&replace_blocks, 10, 2);
+  AppendExtent(&replace_blocks, 13, 2);
+  DeltaArchiveManifest_InstallOperation op;
+  OpAppendExtent(&op, 4, 3);
+  OpAppendExtent(&op, kSparseHole, 4);  // Sparse hole in file
+  OpAppendExtent(&op, 3, 1);
+  OpAppendExtent(&op, 7, 3);
+  
+  DeltaDiffGenerator::SubstituteBlocks(&op, remove_blocks, replace_blocks);
+  
+  EXPECT_EQ(7, op.src_extents_size());
+  EXPECT_EQ(11, op.src_extents(0).start_block());
+  EXPECT_EQ(1, op.src_extents(0).num_blocks());
+  EXPECT_EQ(13, op.src_extents(1).start_block());
+  EXPECT_EQ(1, op.src_extents(1).num_blocks());
+  EXPECT_EQ(6, op.src_extents(2).start_block());
+  EXPECT_EQ(1, op.src_extents(2).num_blocks());
+  EXPECT_EQ(kSparseHole, op.src_extents(3).start_block());
+  EXPECT_EQ(4, op.src_extents(3).num_blocks());
+  EXPECT_EQ(10, op.src_extents(4).start_block());
+  EXPECT_EQ(1, op.src_extents(4).num_blocks());
+  EXPECT_EQ(14, op.src_extents(5).start_block());
+  EXPECT_EQ(1, op.src_extents(5).num_blocks());
+  EXPECT_EQ(8, op.src_extents(6).start_block());
+  EXPECT_EQ(2, op.src_extents(6).num_blocks());
+}
+
+TEST_F(DeltaDiffGeneratorTest, CutEdgesTest) {
+  Graph graph;
+  vector<Block> blocks(9);
+  
+  // Create nodes in graph
+  {
+    graph.resize(graph.size() + 1);
+    graph.back().op.set_type(DeltaArchiveManifest_InstallOperation_Type_MOVE);
+    // Reads from blocks 3, 5, 7
+    vector<Extent> extents;
+    graph_utils::AppendBlockToExtents(&extents, 3);
+    graph_utils::AppendBlockToExtents(&extents, 5);
+    graph_utils::AppendBlockToExtents(&extents, 7);
+    DeltaDiffGenerator::StoreExtents(extents,
+                                     graph.back().op.mutable_src_extents());
+    blocks[3].reader = graph.size() - 1;
+    blocks[5].reader = graph.size() - 1;
+    blocks[7].reader = graph.size() - 1;
+    
+    // Writes to blocks 1, 2, 4
+    extents.clear();
+    graph_utils::AppendBlockToExtents(&extents, 1);
+    graph_utils::AppendBlockToExtents(&extents, 2);
+    graph_utils::AppendBlockToExtents(&extents, 4);
+    DeltaDiffGenerator::StoreExtents(extents,
+                                     graph.back().op.mutable_dst_extents());
+    blocks[1].writer = graph.size() - 1;
+    blocks[2].writer = graph.size() - 1;
+    blocks[4].writer = graph.size() - 1;
+  }
+  {
+    graph.resize(graph.size() + 1);
+    graph.back().op.set_type(DeltaArchiveManifest_InstallOperation_Type_MOVE);
+    // Reads from blocks 1, 2, 4
+    vector<Extent> extents;
+    graph_utils::AppendBlockToExtents(&extents, 1);
+    graph_utils::AppendBlockToExtents(&extents, 2);
+    graph_utils::AppendBlockToExtents(&extents, 4);
+    DeltaDiffGenerator::StoreExtents(extents,
+                                     graph.back().op.mutable_src_extents());
+    blocks[1].reader = graph.size() - 1;
+    blocks[2].reader = graph.size() - 1;
+    blocks[4].reader = graph.size() - 1;
+    
+    // Writes to blocks 3, 5, 6
+    extents.clear();
+    graph_utils::AppendBlockToExtents(&extents, 3);
+    graph_utils::AppendBlockToExtents(&extents, 5);
+    graph_utils::AppendBlockToExtents(&extents, 6);
+    DeltaDiffGenerator::StoreExtents(extents,
+                                     graph.back().op.mutable_dst_extents());
+    blocks[3].writer = graph.size() - 1;
+    blocks[5].writer = graph.size() - 1;
+    blocks[6].writer = graph.size() - 1;
+  }
+  
+  // Create edges
+  DeltaDiffGenerator::CreateEdges(&graph, blocks);
+  
+  // Find cycles
+  CycleBreaker cycle_breaker;
+  set<Edge> cut_edges;
+  cycle_breaker.BreakCycles(graph, &cut_edges);
+
+  EXPECT_EQ(1, cut_edges.size());
+  EXPECT_TRUE(cut_edges.end() != cut_edges.find(make_pair<Vertex::Index>(1,
+                                                                         0)));
+
+  EXPECT_TRUE(DeltaDiffGenerator::CutEdges(&graph, blocks, cut_edges));
+  
+  EXPECT_EQ(3, graph.size());
+  
+  // Check new node in graph:
+  EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_MOVE,
+            graph.back().op.type());
+  EXPECT_EQ(2, graph.back().op.src_extents_size());
+  EXPECT_EQ(2, graph.back().op.dst_extents_size());
+  EXPECT_EQ(0, graph.back().op.dst_extents(0).start_block());
+  EXPECT_EQ(1, graph.back().op.dst_extents(0).num_blocks());
+  EXPECT_EQ(8, graph.back().op.dst_extents(1).start_block());
+  EXPECT_EQ(1, graph.back().op.dst_extents(1).num_blocks());
+  EXPECT_TRUE(graph.back().out_edges.empty());
+  
+  // Check that old node reads from new blocks
+  EXPECT_EQ(3, graph[0].op.src_extents_size());
+  EXPECT_EQ(0, graph[0].op.src_extents(0).start_block());
+  EXPECT_EQ(1, graph[0].op.src_extents(0).num_blocks());
+  EXPECT_EQ(8, graph[0].op.src_extents(1).start_block());
+  EXPECT_EQ(1, graph[0].op.src_extents(1).num_blocks());
+  EXPECT_EQ(7, graph[0].op.src_extents(2).start_block());
+  EXPECT_EQ(1, graph[0].op.src_extents(2).num_blocks());
+
+  // And that the old dst extents haven't changed
+  EXPECT_EQ(2, graph[0].op.dst_extents_size());
+  EXPECT_EQ(1, graph[0].op.dst_extents(0).start_block());
+  EXPECT_EQ(2, graph[0].op.dst_extents(0).num_blocks());
+  EXPECT_EQ(4, graph[0].op.dst_extents(1).start_block());
+  EXPECT_EQ(1, graph[0].op.dst_extents(1).num_blocks());
+  
+  // Ensure it only depends on the next node
+  EXPECT_EQ(1, graph[0].out_edges.size());
+  EXPECT_TRUE(graph[0].out_edges.end() != graph[0].out_edges.find(1));
+  
+  // Check second node has unchanged extents
+  EXPECT_EQ(2, graph[1].op.src_extents_size());
+  EXPECT_EQ(1, graph[1].op.src_extents(0).start_block());
+  EXPECT_EQ(2, graph[1].op.src_extents(0).num_blocks());
+  EXPECT_EQ(4, graph[1].op.src_extents(1).start_block());
+  EXPECT_EQ(1, graph[1].op.src_extents(1).num_blocks());
+
+  EXPECT_EQ(2, graph[1].op.dst_extents_size());
+  EXPECT_EQ(3, graph[1].op.dst_extents(0).start_block());
+  EXPECT_EQ(1, graph[1].op.dst_extents(0).num_blocks());
+  EXPECT_EQ(5, graph[1].op.dst_extents(1).start_block());
+  EXPECT_EQ(2, graph[1].op.dst_extents(1).num_blocks());
+  
+  // Ensure it only depends on the next node
+  EXPECT_EQ(1, graph[1].out_edges.size());
+  EXPECT_TRUE(graph[1].out_edges.end() != graph[1].out_edges.find(2));
+}
+
+TEST_F(DeltaDiffGeneratorTest, ReorderBlobsTest) {
+  string orig_blobs;
+  EXPECT_TRUE(
+      utils::MakeTempFile("ReorderBlobsTest.orig.XXXXXX", &orig_blobs, NULL));
+
+  string orig_data = "abcd";
+  EXPECT_TRUE(
+      utils::WriteFile(orig_blobs.c_str(), orig_data.data(), orig_data.size()));
+
+  string new_blobs;
+  EXPECT_TRUE(
+      utils::MakeTempFile("ReorderBlobsTest.new.XXXXXX", &new_blobs, NULL));
+  
+  DeltaArchiveManifest manifest;
+  DeltaArchiveManifest_InstallOperation* op =
+      manifest.add_install_operations();
+  op->set_data_offset(1);
+  op->set_data_length(3);
+  op = manifest.add_install_operations();
+  op->set_data_offset(0);
+  op->set_data_length(1);
+  
+  EXPECT_TRUE(DeltaDiffGenerator::ReorderDataBlobs(&manifest,
+                                                   orig_blobs,
+                                                   new_blobs));
+                                                   
+  string new_data;
+  EXPECT_TRUE(utils::ReadFileToString(new_blobs, &new_data));
+  EXPECT_EQ("bcda", new_data);
+  EXPECT_EQ(2, manifest.install_operations_size());
+  EXPECT_EQ(0, manifest.install_operations(0).data_offset());
+  EXPECT_EQ(3, manifest.install_operations(0).data_length());
+  EXPECT_EQ(3, manifest.install_operations(1).data_offset());
+  EXPECT_EQ(1, manifest.install_operations(1).data_length());
+  
+  unlink(orig_blobs.c_str());
+  unlink(new_blobs.c_str());
+}
 
 }  // namespace chromeos_update_engine
diff --git a/extent_mapper.cc b/extent_mapper.cc
index ed528fd..4af5f5d 100755
--- a/extent_mapper.cc
+++ b/extent_mapper.cc
@@ -16,6 +16,8 @@
 
 #include <linux/fs.h>
 
+#include "update_engine/graph_types.h"
+#include "update_engine/graph_utils.h"
 #include "update_engine/utils.h"
 
 using std::string;
@@ -31,7 +33,6 @@
 
 bool ExtentsForFileFibmap(const std::string& path, std::vector<Extent>* out) {
   CHECK(out);
-  // TODO(adlr): verify path is a file
   struct stat stbuf;
   int rc = stat(path.c_str(), &stbuf);
   TEST_AND_RETURN_FALSE_ERRNO(rc == 0);
@@ -53,32 +54,23 @@
   current.set_num_blocks(0);
 
   for (int i = 0; i < block_count; i++) {
-    unsigned int block = i;
-    rc = ioctl(fd, FIBMAP, &block);
+    unsigned int block32 = i;
+    rc = ioctl(fd, FIBMAP, &block32);
     TEST_AND_RETURN_FALSE_ERRNO(rc == 0);
     
-    // Add next block to extents
-    if (current.num_blocks() == 0) {
-      // We're starting a new extent
-      current.set_start_block(block);
-      current.set_num_blocks(1);
-      continue;
-    }
-    if ((current.start_block() + current.num_blocks()) == block) {
-      // We're continuing the last extent
-      current.set_num_blocks(current.num_blocks() + 1);
-      continue;
-    }
-    // We're starting a new extent and keeping the current one
-    out->push_back(current);
-    current.set_start_block(block);
-    current.set_num_blocks(1);
-    continue;
+    const uint64 block = (block32 == 0 ? kSparseHole : block32);
+    
+    graph_utils::AppendBlockToExtents(out, block);
   }
-  
-  if (current.num_blocks() > 0)
-    out->push_back(current);
+  return true;
+}
 
+bool GetFilesystemBlockSize(const std::string& path, uint32* out_blocksize) {
+  int fd = open(path.c_str(), O_RDONLY, 0);
+  TEST_AND_RETURN_FALSE_ERRNO(fd >= 0);
+  ScopedFdCloser fd_closer(&fd);
+  int rc = ioctl(fd, FIGETBSZ, out_blocksize);
+  TEST_AND_RETURN_FALSE_ERRNO(rc != -1);
   return true;
 }
 
diff --git a/extent_mapper.h b/extent_mapper.h
index acdd418..b15cf4a 100755
--- a/extent_mapper.h
+++ b/extent_mapper.h
@@ -7,14 +7,27 @@
 
 #include <string>
 #include <vector>
+#include "base/basictypes.h"
 #include "update_engine/update_metadata.pb.h"
 
 namespace chromeos_update_engine {
 
 namespace extent_mapper {
 
+// Uses the FIBMAP ioctl to get all blocks used by a file and return them
+// as extents. Blocks are relative to the start of the filesystem. If
+// there is a sparse "hole" in the file, the blocks for that will be
+// represented by an extent whose start block is kSpareseHole.
+// The resulting extents are stored in 'out'. Keep in mind that while
+// the blocksize of a filesystem is often 4096 bytes, that is not always
+// the case, so one should consult GetFilesystemBlockSize(), too.
+// Returns true on success.
 bool ExtentsForFileFibmap(const std::string& path, std::vector<Extent>* out);
 
+// Puts the blocksize of the filesystem, as used by the FIBMAP ioctl, into
+// out_blocksize by using the FIGETBSZ ioctl. Returns true on success.
+bool GetFilesystemBlockSize(const std::string& path, uint32* out_blocksize);
+
 }  // namespace extent_mapper
 
 }  // namespace chromeos_update_engine
diff --git a/extent_mapper_unittest.cc b/extent_mapper_unittest.cc
index 6962004..dc69437 100644
--- a/extent_mapper_unittest.cc
+++ b/extent_mapper_unittest.cc
@@ -11,6 +11,7 @@
 #include <gtest/gtest.h>
 #include "base/basictypes.h"
 #include "update_engine/extent_mapper.h"
+#include "update_engine/graph_types.h"
 #include "update_engine/utils.h"
 
 using std::set;
@@ -27,8 +28,11 @@
   // In lieu of this, we do a weak test: make sure the extents of the unittest
   // executable are consistent and they match with the size of the file.
   const string kFilename = "/proc/self/exe";
-  const off_t kBlockSize = 4096;
   
+  uint32 block_size = 0;
+  EXPECT_TRUE(extent_mapper::GetFilesystemBlockSize(kFilename, &block_size));
+  EXPECT_GT(block_size, 0);
+    
   vector<Extent> extents;
   
   ASSERT_TRUE(extent_mapper::ExtentsForFileFibmap(kFilename, &extents));
@@ -48,7 +52,41 @@
   
   struct stat stbuf;
   EXPECT_EQ(0, stat(kFilename.c_str(), &stbuf));
-  EXPECT_EQ(blocks.size(), (stbuf.st_size + kBlockSize - 1)/kBlockSize);
+  EXPECT_EQ(blocks.size(), (stbuf.st_size + block_size - 1)/block_size);
+}
+
+TEST(ExtentMapperTest, RunAsRootSparseFileTest) {
+  // Create sparse file with one real block, then two sparse ones, then a real
+  // block at the end.
+  const char tmp_name_template[] =
+      "/tmp/ExtentMapperTest.RunAsRootSparseFileTest.XXXXXX";
+  char buf[sizeof(tmp_name_template)];
+  strncpy(buf, tmp_name_template, sizeof(buf));
+  COMPILE_ASSERT(sizeof(buf) > 8, buf_size_incorrect);
+  ASSERT_EQ('\0', buf[sizeof(buf) - 1]);
+
+  int fd = mkstemp(buf);
+  ASSERT_GE(fd, 0);
+
+  uint32 block_size = 0;
+  EXPECT_TRUE(extent_mapper::GetFilesystemBlockSize(buf, &block_size));
+  EXPECT_GT(block_size, 0);
+  
+  EXPECT_EQ(1, pwrite(fd, "x", 1, 0));
+  EXPECT_EQ(1, pwrite(fd, "x", 1, 3 * block_size));
+  close(fd);
+  
+  vector<Extent> extents;
+  EXPECT_TRUE(extent_mapper::ExtentsForFileFibmap(buf, &extents));
+  unlink(buf);
+  EXPECT_EQ(3, extents.size());
+  EXPECT_EQ(1, extents[0].num_blocks());
+  EXPECT_EQ(2, extents[1].num_blocks());
+  EXPECT_EQ(1, extents[2].num_blocks());
+  EXPECT_NE(kSparseHole, extents[0].start_block());
+  EXPECT_EQ(kSparseHole, extents[1].start_block());
+  EXPECT_NE(kSparseHole, extents[2].start_block());
+  EXPECT_NE(extents[2].start_block(), extents[0].start_block());
 }
 
 }  // namespace chromeos_update_engine
diff --git a/extent_writer.cc b/extent_writer.cc
index 1ae565b..9f6fbf0 100644
--- a/extent_writer.cc
+++ b/extent_writer.cc
@@ -6,25 +6,12 @@
 #include <errno.h>
 #include <unistd.h>
 #include <algorithm>
+#include "update_engine/utils.h"
 
 using std::min;
 
 namespace chromeos_update_engine {
 
-namespace {
-// Returns true on success.
-bool WriteAll(int fd, const void *buf, size_t count) {
-  const char* c_buf = reinterpret_cast<const char*>(buf);
-  ssize_t bytes_written = 0;
-  while (bytes_written < static_cast<ssize_t>(count)) {
-    ssize_t rc = write(fd, c_buf + bytes_written, count - bytes_written);
-    TEST_AND_RETURN_FALSE_ERRNO(rc >= 0);
-    bytes_written += rc;
-  }
-  return true;
-}
-}
-
 bool DirectExtentWriter::Write(const void* bytes, size_t count) {
   if (count == 0)
     return true;
@@ -48,7 +35,7 @@
       TEST_AND_RETURN_FALSE_ERRNO(lseek64(fd_, offset, SEEK_SET) !=
                                   static_cast<off64_t>(-1));
       TEST_AND_RETURN_FALSE(
-          WriteAll(fd_, c_bytes + bytes_written, bytes_to_write));
+          utils::WriteAll(fd_, c_bytes + bytes_written, bytes_to_write));
     }
     bytes_written += bytes_to_write;
     extent_bytes_written_ += bytes_to_write;
diff --git a/filesystem_copier_action_unittest.cc b/filesystem_copier_action_unittest.cc
index 1e024f1..86c15ac 100644
--- a/filesystem_copier_action_unittest.cc
+++ b/filesystem_copier_action_unittest.cc
@@ -137,8 +137,8 @@
   g_main_loop_unref(loop);
 
   EXPECT_EQ(0, System(string("losetup -d ") + dev));
-  EXPECT_EQ(0, System(string("umount ") + TestDir() + "/mnt/some_dir/mnt"));
-  EXPECT_EQ(0, System(string("umount ") + TestDir() + "/mnt"));
+  EXPECT_EQ(0, System(string("umount -d ") + TestDir() + "/mnt/some_dir/mnt"));
+  EXPECT_EQ(0, System(string("umount -d ") + TestDir() + "/mnt"));
   EXPECT_EQ(0, unlink(a_image.c_str()));
   EXPECT_EQ(0, unlink(b_image.c_str()));
 
@@ -168,7 +168,7 @@
   EXPECT_TRUE(utils::ReadFileToString(TestDir() + "/mnt/hello", &file_data));
   EXPECT_EQ("hello\n", file_data);
   EXPECT_EQ("/some/target", Readlink(TestDir() + "/mnt/sym"));
-  EXPECT_EQ(0, System(string("umount ") + TestDir() + "/mnt"));
+  EXPECT_EQ(0, System(string("umount -d ") + TestDir() + "/mnt"));
 
   EXPECT_EQ(0, unlink(out_image.c_str()));
   EXPECT_EQ(0, rmdir((TestDir() + "/mnt").c_str()));
diff --git a/filesystem_iterator_unittest.cc b/filesystem_iterator_unittest.cc
index 82b8d3f..da14b87 100644
--- a/filesystem_iterator_unittest.cc
+++ b/filesystem_iterator_unittest.cc
@@ -57,8 +57,8 @@
                              expected_paths_vector.end());
   VerifyAllPaths(kMountPath, expected_paths);
   
-  EXPECT_EQ(0, System(string("umount ") + kMountPath + "/some_dir/mnt"));
-  EXPECT_EQ(0, System(string("umount ") + kMountPath));
+  EXPECT_EQ(0, System(string("umount -d ") + kMountPath + "/some_dir/mnt"));
+  EXPECT_EQ(0, System(string("umount -d ") + kMountPath));
   EXPECT_EQ(0, System(string("rm -f ") + first_image + " " + sub_image));
 }
 
diff --git a/generate_delta_main.cc b/generate_delta_main.cc
index 551c6ef..2f21b2a 100644
--- a/generate_delta_main.cc
+++ b/generate_delta_main.cc
@@ -8,13 +8,23 @@
 #include <unistd.h>
 #include <set>
 #include <string>
+#include <gflags/gflags.h>
 #include <glib.h>
+#include "base/command_line.h"
 #include "chromeos/obsolete_logging.h"
 #include "update_engine/delta_diff_generator.h"
 #include "update_engine/subprocess.h"
 #include "update_engine/update_metadata.pb.h"
 #include "update_engine/utils.h"
 
+DEFINE_string(old_dir, "",
+              "Directory where the old rootfs is loop mounted read-only");
+DEFINE_string(new_dir, "",
+              "Directory where the new rootfs is loop mounted read-only");
+DEFINE_string(old_image, "", "Path to the old rootfs");
+DEFINE_string(new_image, "", "Path to the new rootfs");
+DEFINE_string(out_file, "", "Path to output file");
+
 // This file contains a simple program that takes an old path, a new path,
 // and an output file as arguments and the path to an output file and
 // generates a delta that can be sent to Chrome OS clients.
@@ -26,11 +36,6 @@
 
 namespace {
 
-void usage(const char* argv0) {
-  printf("usage: %s old_dir new_dir out_file\n", argv0);
-  exit(1);
-}
-
 bool IsDir(const char* path) {
   struct stat stbuf;
   TEST_AND_RETURN_FALSE_ERRNO(lstat(path, &stbuf) == 0);
@@ -39,21 +44,27 @@
 
 int Main(int argc, char** argv) {
   g_thread_init(NULL);
+  google::ParseCommandLineFlags(&argc, &argv, true);
+  CommandLine::Init(argc, argv);
   Subprocess::Init();
-  if (argc != 4) {
-    usage(argv[0]);
-  }
-  logging::InitLogging("",
+  logging::InitLogging("delta_generator.log",
                        logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
                        logging::DONT_LOCK_LOG_FILE,
                        logging::APPEND_TO_OLD_LOG_FILE);
-  const char* old_dir = argv[1];
-  const char* new_dir = argv[2];
-  if ((!IsDir(old_dir)) || (!IsDir(new_dir))) {
-    usage(argv[0]);
+  if (FLAGS_old_dir.empty() || FLAGS_new_dir.empty() ||
+      FLAGS_old_image.empty() || FLAGS_new_image.empty() ||
+      FLAGS_out_file.empty()) {
+    LOG(FATAL) << "Missing required argument(s)";
+  }
+  if ((!IsDir(FLAGS_old_dir.c_str())) || (!IsDir(FLAGS_new_dir.c_str()))) {
+    LOG(FATAL) << "old_dir or new_dir not directory";
   }
   
-  // TODO(adlr): generate delta file
+  DeltaDiffGenerator::GenerateDeltaUpdateFile(FLAGS_old_dir,
+                                              FLAGS_old_image,
+                                              FLAGS_new_dir,
+                                              FLAGS_new_image,
+                                              FLAGS_out_file);
 
   return 0;
 }
diff --git a/graph_types.h b/graph_types.h
index afb7f64..109616a 100644
--- a/graph_types.h
+++ b/graph_types.h
@@ -7,6 +7,7 @@
 
 #include <map>
 #include <set>
+#include <string>
 #include <utility>
 #include <vector>
 #include "base/basictypes.h"
@@ -22,7 +23,7 @@
 };
 
 struct Vertex {
-  Vertex() : index(-1), lowlink(-1), op(NULL) {}
+  Vertex() : index(-1), lowlink(-1) {}
   typedef std::map<std::vector<Vertex>::size_type, EdgeProperties> EdgeMap;
   EdgeMap out_edges;
 
@@ -38,7 +39,8 @@
   std::vector<Vertex>::size_type lowlink;
 
   // Other Vertex properties:
-  DeltaArchiveManifest_InstallOperation* op;
+  DeltaArchiveManifest_InstallOperation op;
+  std::string file_name;
 
   typedef std::vector<Vertex>::size_type Index;
   static const Vertex::Index kInvalidIndex = -1;
@@ -48,6 +50,8 @@
 
 typedef std::pair<Vertex::Index, Vertex::Index> Edge;
 
+const uint64 kSparseHole = kuint64max;
+
 }  // namespace chromeos_update_engine
 
 #endif  // CHROMEOS_PLATFORM_UPDATE_ENGINE_GRAPH_TYPES_H__
diff --git a/graph_utils.cc b/graph_utils.cc
index 79d5733..dd3cdcf 100644
--- a/graph_utils.cc
+++ b/graph_utils.cc
@@ -17,7 +17,8 @@
       graph[edge.first].out_edges.find(edge.second)->second.extents;
   for (vector<Extent>::const_iterator it = extents.begin();
        it != extents.end(); ++it) {
-    weight += it->num_blocks();
+    if (it->start_block() != kSparseHole)
+      weight += it->num_blocks();
   }
   return weight;
 }
@@ -25,7 +26,15 @@
 void AppendBlockToExtents(vector<Extent>* extents, uint64 block) {
   if (!extents->empty()) {
     Extent& extent = extents->back();
-    if (extent.start_block() + extent.num_blocks() == block) {
+    if (block == kSparseHole) {
+      if (extent.start_block() == kSparseHole) {
+        // Extend sparse hole extent
+        extent.set_num_blocks(extent.num_blocks() + 1);
+        return;
+      } else {
+        // Create new extent below outer 'if'
+      }
+    } else if (extent.start_block() + extent.num_blocks() == block) {
       extent.set_num_blocks(extent.num_blocks() + 1);
       return;
     }
diff --git a/postinstall_runner_action_unittest.cc b/postinstall_runner_action_unittest.cc
index 5bb515f..7c1993e 100644
--- a/postinstall_runner_action_unittest.cc
+++ b/postinstall_runner_action_unittest.cc
@@ -87,7 +87,7 @@
   ASSERT_TRUE(WriteFileString(mountpoint + "/postinst", script));
   ASSERT_EQ(0, System(string("chmod a+x ") + mountpoint + "/postinst"));
 
-  ASSERT_EQ(0, System(string("umount ") + mountpoint));
+  ASSERT_EQ(0, System(string("umount -d ") + mountpoint));
 
   ASSERT_EQ(0, System(string("rm -f ") + cwd + "/postinst_called"));
 
diff --git a/subprocess.cc b/subprocess.cc
index 299d758..89b6cad 100644
--- a/subprocess.cc
+++ b/subprocess.cc
@@ -80,7 +80,7 @@
 
 bool Subprocess::SynchronousExec(const std::vector<std::string>& cmd,
                                  int* return_code) {
-  GError *err;
+  GError *err = NULL;
   scoped_array<char *> argv(new char*[cmd.size() + 1]);
   for (unsigned int i = 0; i < cmd.size(); i++) {
     argv[i] = strdup(cmd[i].c_str());
@@ -100,6 +100,8 @@
                               return_code,
                               &err);
   FreeArgv(argv.get());
+  if (err)
+    LOG(INFO) << "err is: " << err->code << ", " << err->message;
   return success;
 }
 
diff --git a/test_utils.cc b/test_utils.cc
index 6c1e35b..1c2f895 100644
--- a/test_utils.cc
+++ b/test_utils.cc
@@ -204,7 +204,7 @@
   EXPECT_EQ(0, System(StringPrintf("ln -s /some/target %s/sym", kMountPath)));
   EXPECT_EQ(0, System(StringPrintf("ln %s/some_dir/test %s/testlink",
                                    kMountPath, kMountPath)));
-  EXPECT_EQ(0, System(StringPrintf("umount %s", kMountPath)));
+  EXPECT_EQ(0, System(StringPrintf("umount -d %s", kMountPath)));
   
   if (out_paths) {
     out_paths->clear();
diff --git a/topological_sort.cc b/topological_sort.cc
index 2e34144..8422849 100644
--- a/topological_sort.cc
+++ b/topological_sort.cc
@@ -5,6 +5,7 @@
 #include "update_engine/topological_sort.h"
 #include <set>
 #include <vector>
+#include "base/logging.h"
 
 using std::set;
 using std::vector;
@@ -26,6 +27,8 @@
     TopologicalSortVisit(graph, visited_nodes, nodes, it->first);
   }
   // Visit this node.
+  LOG(INFO) << graph[node].file_name << " " << graph[node].op.type() << " "
+            << graph[node].op.data_length();
   nodes->push_back(node);
 }
 }  // namespace {}
diff --git a/utils.cc b/utils.cc
index 69a59cc..e1ed874 100644
--- a/utils.cc
+++ b/utils.cc
@@ -35,6 +35,17 @@
   return true;
 }
 
+bool WriteAll(int fd, const void *buf, size_t count) {
+  const char* c_buf = static_cast<const char*>(buf);
+  ssize_t bytes_written = 0;
+  while (bytes_written < static_cast<ssize_t>(count)) {
+    ssize_t rc = write(fd, c_buf + bytes_written, count - bytes_written);
+    TEST_AND_RETURN_FALSE_ERRNO(rc >= 0);
+    bytes_written += rc;
+  }
+  return true;
+}
+
 bool ReadFile(const std::string& path, std::vector<char>* out) {
   CHECK(out);
   FILE* fp = fopen(path.c_str(), "r");
@@ -114,7 +125,7 @@
     return true;
   if (!S_ISDIR(stbuf.st_mode)) {
     TEST_AND_RETURN_FALSE_ERRNO((unlink(path.c_str()) == 0) ||
-                                 (errno == ENOENT));
+                                (errno == ENOENT));
     // success or path disappeared before we could unlink.
     return true;
   }
@@ -136,7 +147,7 @@
           !strcmp(dir_entry_p->d_name, ".."))
         continue;
       TEST_AND_RETURN_FALSE(RecursiveUnlinkDir(path + "/" +
-                                                dir_entry_p->d_name));
+                                               dir_entry_p->d_name));
     }
     TEST_AND_RETURN_FALSE(err == 0);
   }
@@ -201,6 +212,27 @@
   return path;
 }
 
+bool MakeTempFile(const std::string& filename_template,
+                  std::string* filename,
+                  int* fd) {
+  DCHECK(filename || fd);
+  vector<char> buf(filename_template.size() + 1);
+  memcpy(&buf[0], filename_template.data(), filename_template.size());
+  buf[filename_template.size()] = '\0';
+  
+  int mkstemp_fd = mkstemp(&buf[0]);
+  TEST_AND_RETURN_FALSE_ERRNO(mkstemp_fd >= 0);
+  if (filename) {
+    *filename = &buf[0];
+  }
+  if (fd) {
+    *fd = mkstemp_fd;
+  } else {
+    close(mkstemp_fd);
+  }
+  return true;
+}
+
 bool StringHasSuffix(const std::string& str, const std::string& suffix) {
   if (suffix.size() > str.size())
     return false;
diff --git a/utils.h b/utils.h
index 22a1ce8..298fb03 100644
--- a/utils.h
+++ b/utils.h
@@ -20,6 +20,10 @@
 // exists. Returns true on success, false otherwise.
 bool WriteFile(const char* path, const char* data, int data_len);
 
+// Calls write() repeatedly until all count bytes at buf are written to
+// fd or an error occurs. Returns true on success.
+bool WriteAll(int fd, const void *buf, size_t count);
+
 // Returns the entire contents of the file at path. Returns true on success.
 bool ReadFile(const std::string& path, std::vector<char>* out);
 bool ReadFileToString(const std::string& path, std::string* out);
@@ -41,6 +45,16 @@
 // THAT YOUR PROCESS WILL BE THE ONLY THING WRITING FILES IN THIS DIRECTORY.
 std::string TempFilename(std::string path);
 
+// Calls mkstemp() with the template passed. Returns the filename in the
+// out param filename. If fd is non-NULL, the file fd returned by mkstemp
+// is not close()d and is returned in the out param 'fd'. However, if
+// fd is NULL, the fd from mkstemp() will be closed.
+// The last six chars of the template must be XXXXXX.
+// Returns true on success.
+bool MakeTempFile(const std::string& filename_template,
+                  std::string* filename,
+                  int* fd);
+
 // Deletes a directory and all its contents synchronously. Returns true
 // on success. This may be called with a regular file--it will just unlink it.
 // This WILL cross filesystem boundaries.
@@ -86,6 +100,20 @@
   return std::find(vect.begin(), vect.end(), value) != vect.end(); 
 }
 
+template<typename T>
+bool VectorIndexOf(const std::vector<T>& vect, const T& value,
+                   typename std::vector<T>::size_type* out_index) {
+  typename std::vector<T>::const_iterator it = std::find(vect.begin(),
+                                                         vect.end(),
+                                                         value);
+  if (it == vect.end()) {
+    return false;
+  } else {
+    *out_index = it - vect.begin();
+    return true;
+  }
+}
+
 // Returns the currently booted device. "/dev/sda1", for example.
 // This will not interpret LABEL= or UUID=. You'll need to use findfs
 // or something with equivalent funcionality to interpret those.
