Skip to content

Commit

Permalink
Merge pull request #1106 from jiangliu/rafs-entry-name-v2.1
Browse files Browse the repository at this point in the history
rafs: fix a bug in calculate offset for dirent name
  • Loading branch information
imeoer authored Feb 24, 2023
2 parents 9eccf9b + a8ef7ea commit c69a43e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rafs/src/metadata/direct_v6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,11 @@ impl OndiskInodeWrapper {
// Because the other blocks should be fully used, while the last may not.
let len = if div_round_up(self.size(), EROFS_BLOCK_SIZE) as usize == block_index + 1
{
(self.size() % EROFS_BLOCK_SIZE - s) as usize
if self.size() % EROFS_BLOCK_SIZE == 0 {
EROFS_BLOCK_SIZE as usize
} else {
(self.size() % EROFS_BLOCK_SIZE - s) as usize
}
} else {
(EROFS_BLOCK_SIZE - s) as usize
};
Expand Down

0 comments on commit c69a43e

Please sign in to comment.