Skip to content

Commit

Permalink
Merge pull request #573 from zyfjeff/fix-wrong-blob-index
Browse files Browse the repository at this point in the history
nydusd: fixed getting the wrong chunk due to using the wrong blob index
  • Loading branch information
changweige authored Jul 7, 2022
2 parents 484d6db + 118a287 commit 370b9cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rafs/src/metadata/direct_v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ impl RafsInode for OndiskInodeWrapper {
content_len = std::cmp::min(chunk_size, left);
let desc = self.make_chunk_io(c, 0, content_len, user_io);

if c.blob_index() as u32 != descs.bi_vec[0].blob.blob_index() {
if desc.blob.blob_index() as u32 != descs.bi_vec[0].blob.blob_index() {
vec.push(descs);
descs = BlobIoVec::new();
}
Expand Down
3 changes: 3 additions & 0 deletions rafs/src/metadata/layout/v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,9 @@ impl RafsV6InodeChunkAddr {
}
}

/// Note: for erofs, bump id by 1 since device id 0 is bootstrap.
/// The index in BlobInfo grows from 0, so when using this method to index the corresponding blob,
/// the index always needs to be minus 1
/// Get the blob index of the chunk.
pub fn blob_index(&self) -> u8 {
(u16::from_le(self.c_blob_addr_hi) & 0x00ff) as u8
Expand Down

0 comments on commit 370b9cc

Please sign in to comment.