mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>, Gao Xiang <xiang@kernel.org>
Cc: Chao Yu <chao@kernel.org>,
	linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	Zhan Xusheng <zhanxusheng@xiaomi.com>
Subject: Re: [PATCH] erofs: handle 48-bit blocks_hi for compressed inodes
Date: Mon, 22 Jun 2026 15:43:04 +0800	[thread overview]
Message-ID: <5cccd50c-cb18-4fb3-bce0-77bed389d00f@linux.alibaba.com> (raw)
In-Reply-To: <20260622073410.2934415-1-zhanxusheng@xiaomi.com>

Hi Xusheng,

On 2026/6/22 15:34, 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: 2e1473d5195f ("erofs: implement 48-bit block addressing for unencoded inodes")

It's not the right fix, it should be efb2aef569b3 since
the pcluster layout only allows 32-bit addresssing for now.

> Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
> ---
>   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..cf2f00e13cae 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 = ((u64)le16_to_cpu(copied.i_nb.blocks_hi) << 32 |
> +				   le32_to_cpu(copied.i_u.blocks_lo)) <<
> +				  (sb->s_blocksize_bits - 9);

I hope it could be:
		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);

to explicitly use "()" and avoid overly long lines.

Thanks,
Gao Xiang

>   	}
>   
>   	if (vi->datalayout == EROFS_INODE_CHUNK_BASED) {


  reply	other threads:[~2026-06-22  7:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22  7:34 Zhan Xusheng
2026-06-22  7:43 ` Gao Xiang [this message]
2026-06-22  8:11   ` [PATCH v2] " Zhan Xusheng
2026-06-22  8:36     ` Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5cccd50c-cb18-4fb3-bce0-77bed389d00f@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiang@kernel.org \
    --cc=zhanxusheng1024@gmail.com \
    --cc=zhanxusheng@xiaomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®