diff options
| author | Zhan Xusheng <zhanxusheng@xiaomi.com> | 2026-06-22 16:11:36 +0800 |
|---|---|---|
| committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2026-06-22 18:50:36 +0800 |
| commit | 803d09a554055aba160a62abd1e4b1260b899dc1 (patch) | |
| tree | cc9dda475878227f23c94ea6fa22380006c36f61 | |
| parent | c37460cd9b2fcb61ec66b7eb4fde737e65ec2a56 (diff) | |
erofs: handle 48-bit blocks_hi for compressed inodes
Combine i_nb.blocks_hi with i_u.blocks_lo when computing
inode->i_blocks for compressed inodes, mirroring the startblk_hi
handling for unencoded inodes a few lines above. Also evaluate
the shift in u64 to avoid truncation.
Fixes: efb2aef569b3 ("erofs: add encoded extent on-disk definition")
Fixes: 1d191b4ca51d ("erofs: implement encoded extent metadata")
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
| -rw-r--r-- | fs/erofs/inode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c index 1df38b7c82a7..45afe5c50de8 100644 --- a/fs/erofs/inode.c +++ b/fs/erofs/inode.c @@ -191,8 +191,9 @@ static int erofs_read_inode(struct inode *inode) err = -EFSCORRUPTED; goto err_out; } else { - inode->i_blocks = le32_to_cpu(copied.i_u.blocks_lo) << - (sb->s_blocksize_bits - 9); + inode->i_blocks = (le32_to_cpu(copied.i_u.blocks_lo) | + ((u64)le16_to_cpu(copied.i_nb.blocks_hi) << 32)) << + (sb->s_blocksize_bits - 9); } if (vi->datalayout == EROFS_INODE_CHUNK_BASED) { |
