Re: [PATCH v2] erofs: handle 48-bit blocks_hi for compressed inodes
Gao Xiang <[email protected]> Mon, 22 Jun 2026 16:36:38 +0800
| Newsgroups | org.ozlabs.lists.linux-erofs,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 2026/6/22 16:11, Zhan Xusheng wrote:
> 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")
> Signed-off-by: Zhan Xusheng <[email protected]>
> ---
> v2:
> - Fix the Fixes: tag to efb2aef569b3 ("erofs: add encoded extent
> on-disk definition"), the commit that introduced blocks_hi for
> compressed inodes (Gao Xiang)
> - Reorder to "blocks_lo | (blocks_hi << 32)" with explicit parentheses
> and shorter lines (Gao Xiang)
>
> fs/erofs/inode.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
> index a188c570087a..dc0e3d6bb2b1 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)) <<
I will change this line to
((u64)le16_to_cpu(copied.i_nb.blocks_hi) << 32)) <<
to avoid overly long lines (since such alignment is not strictly necessary
but overly long lines should be avoided), otherwise it looks good to me,
Reviewed-by: Gao Xiang <[email protected]>
Thanks,
Gao Xiang