OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include <base/string_util.h> | 9 #include <base/string_util.h> |
10 #include <et/com_err.h> | 10 #include <et/com_err.h> |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // until the end of the inode table. | 213 // until the end of the inode table. |
214 for (dgrp_t bg = 0; bg < fs_old->group_desc_count; bg++) { | 214 for (dgrp_t bg = 0; bg < fs_old->group_desc_count; bg++) { |
215 struct ext2_group_desc* group_desc = &fs_old->group_desc[bg]; | 215 struct ext2_group_desc* group_desc = &fs_old->group_desc[bg]; |
216 __u32 num_metadata_blocks = (group_desc->bg_inode_table + | 216 __u32 num_metadata_blocks = (group_desc->bg_inode_table + |
217 fs_old->inode_blocks_per_group) - | 217 fs_old->inode_blocks_per_group) - |
218 (bg * fs_old->super->s_blocks_per_group); | 218 (bg * fs_old->super->s_blocks_per_group); |
219 __u32 bg_start_block = bg * fs_old->super->s_blocks_per_group; | 219 __u32 bg_start_block = bg * fs_old->super->s_blocks_per_group; |
220 | 220 |
221 // Due to bsdiff slowness, we're going to break each block group down | 221 // Due to bsdiff slowness, we're going to break each block group down |
222 // into metadata chunks and feed them to bsdiff. | 222 // into metadata chunks and feed them to bsdiff. |
223 __u32 num_chunks = 4; | 223 __u32 num_chunks = 10; |
224 __u32 blocks_per_chunk = num_metadata_blocks / num_chunks; | 224 __u32 blocks_per_chunk = num_metadata_blocks / num_chunks; |
225 __u32 curr_block = bg_start_block; | 225 __u32 curr_block = bg_start_block; |
226 for (__u32 chunk = 0; chunk < num_chunks; chunk++) { | 226 for (__u32 chunk = 0; chunk < num_chunks; chunk++) { |
227 Extent extent; | 227 Extent extent; |
228 if (chunk < num_chunks - 1) { | 228 if (chunk < num_chunks - 1) { |
229 extent = ExtentForRange(curr_block, blocks_per_chunk); | 229 extent = ExtentForRange(curr_block, blocks_per_chunk); |
230 } else { | 230 } else { |
231 extent = ExtentForRange(curr_block, | 231 extent = ExtentForRange(curr_block, |
232 bg_start_block + num_metadata_blocks - | 232 bg_start_block + num_metadata_blocks - |
233 curr_block); | 233 curr_block); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 blocks, | 473 blocks, |
474 fs_old, | 474 fs_old, |
475 fs_new, | 475 fs_new, |
476 data_fd, | 476 data_fd, |
477 data_file_size)); | 477 data_file_size)); |
478 | 478 |
479 return true; | 479 return true; |
480 } | 480 } |
481 | 481 |
482 }; // namespace chromeos_update_engine | 482 }; // namespace chromeos_update_engine |
OLD | NEW |