Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rafs: fix a assertion failure in prefetch list generation #1165

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions rafs/src/builder/core/v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,19 +708,21 @@ impl Bootstrap {
Self::v6_align_to_4k(bootstrap_ctx)?;

// `Node` offset might be updated during above inodes dumping. So `get_prefetch_table` after it.
let prefetch_table = ctx
.prefetch
.get_v6_prefetch_table(&bootstrap_ctx.nodes, meta_addr);
if let Some(mut pt) = prefetch_table {
assert!(pt.len() * size_of::<u32>() <= prefetch_table_size as usize);
// Device slots are very close to extended super block.
ext_sb.set_prefetch_table_offset(prefetch_table_offset);
ext_sb.set_prefetch_table_size(prefetch_table_size);
bootstrap_ctx
.writer
.seek_offset(prefetch_table_offset as u64)
.context("failed seek prefetch table offset")?;
pt.store(bootstrap_ctx.writer.as_mut()).unwrap();
if prefetch_table_size > 0 {
let prefetch_table = ctx
.prefetch
.get_v6_prefetch_table(&bootstrap_ctx.nodes, meta_addr);
if let Some(mut pt) = prefetch_table {
assert!(pt.len() * size_of::<u32>() <= prefetch_table_size as usize);
// Device slots are very close to extended super block.
ext_sb.set_prefetch_table_offset(prefetch_table_offset);
ext_sb.set_prefetch_table_size(prefetch_table_size);
bootstrap_ctx
.writer
.seek_offset(prefetch_table_offset as u64)
.context("failed seek prefetch table offset")?;
pt.store(bootstrap_ctx.writer.as_mut()).unwrap();
}
}

// TODO: get rid of the chunk info array.
Expand Down