Skip to content

Commit

Permalink
builder: correctly generate nid for v6 inodes
Browse files Browse the repository at this point in the history
The `nid` is not actually used yet, but we should still generate it
with correct value.

Fixes: #1301

Signed-off-by: Jiang Liu <[email protected]>
  • Loading branch information
jiangliu authored and imeoer committed May 28, 2023
1 parent 23c6110 commit 92e6340
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rafs/src/builder/core/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ impl Bootstrap {

Self::build_rafs(ctx, bootstrap_ctx, &mut self.tree)?;
if ctx.fs_version.is_v6() {
// Sort directory entries to keep them ordered.
Self::v6_update_dirents(&self.tree, bootstrap_ctx.offset);
let root_offset = self.tree.node.lock().unwrap().v6_offset;
Self::v6_update_dirents(&self.tree, root_offset);
}

Ok(())
Expand Down
2 changes: 2 additions & 0 deletions rafs/src/builder/core/v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ impl Node {
if self.is_dir() || self.is_symlink() {
self.v6_dirents_offset += meta_offset;
}
let nid = calculate_nid(self.v6_offset, meta_addr);
self.inode.set_ino(nid);

if self.is_dir() {
self.v6_dump_dir(ctx, f_bootstrap, meta_addr, meta_offset, &mut inode)?;
Expand Down

0 comments on commit 92e6340

Please sign in to comment.