Skip to content

Commit

Permalink
rafs: avoid a debug_assert related to v5 amplify io
Browse files Browse the repository at this point in the history
A debug_assert() may get triggered by RAFS v5 amplify io related code,
it's caused by a bug in RafsSuper::amplify_io().

Signed-off-by: Jiang Liu <[email protected]>
  • Loading branch information
jiangliu committed Apr 30, 2023
1 parent 3873e81 commit 88a1385
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions rafs/src/builder/core/v5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ impl Bootstrap {

// Set super block
let mut super_block = RafsV5SuperBlock::new();
let inodes_count = bootstrap_ctx.inode_map.len() as u64;
super_block.set_inodes_count(inodes_count);
super_block.set_inodes_count(inode_table_entries as u64);
super_block.set_inode_table_offset(super_block_size as u64);
super_block.set_inode_table_entries(inode_table_entries);
super_block.set_blob_table_offset(blob_table_offset as u64);
Expand Down
6 changes: 3 additions & 3 deletions rafs/src/metadata/md_v5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ impl RafsSuper {
if let Ok(ni) = self.get_inode(next_ino, false) {
if ni.is_reg() {
let next_size = ni.size();
let next_size = if next_size < window_size {
let next_size = if next_size == 0 {
continue;
} else if next_size < window_size {
next_size
} else if window_size >= self.meta.chunk_size as u64 {
window_size / self.meta.chunk_size as u64 * self.meta.chunk_size as u64
} else if next_size == 0 {
continue;
} else {
break;
};
Expand Down

0 comments on commit 88a1385

Please sign in to comment.