[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <144922ad-66a3-27e8-df85-4a58c175a630@linux.alibaba.com>
Date: Fri, 13 Jan 2023 15:41:21 +0800
From: Jingbo Xu <jefflexu@...ux.alibaba.com>
To: Gao Xiang <hsiangkao@...ux.alibaba.com>,
linux-erofs@...ts.ozlabs.org, Chao Yu <chao@...nel.org>,
Yue Hu <huyue2@...lpad.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] erofs: clean up erofs_iget()
On 1/13/23 2:52 PM, Gao Xiang wrote:
> Move inode hash function into inode.c and simplify erofs_iget().
>
> Signed-off-by: Gao Xiang <hsiangkao@...ux.alibaba.com>
> ---
> fs/erofs/inode.c | 40 +++++++++++++++++++++-------------------
> fs/erofs/internal.h | 9 ---------
> 2 files changed, 21 insertions(+), 28 deletions(-)
>
> diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
> index d3b8736fa124..57328691582e 100644
> --- a/fs/erofs/inode.c
> +++ b/fs/erofs/inode.c
> @@ -308,47 +308,49 @@ static int erofs_fill_inode(struct inode *inode)
> }
>
> /*
> - * erofs nid is 64bits, but i_ino is 'unsigned long', therefore
> - * we should do more for 32-bit platform to find the right inode.
> + * ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down
> + * so that it will fit.
> */
> -static int erofs_ilookup_test_actor(struct inode *inode, void *opaque)
> +static ino_t erofs_squash_ino(erofs_nid_t nid)
> {
> - const erofs_nid_t nid = *(erofs_nid_t *)opaque;
> + ino_t ino = (ino_t)nid;
> +
> + if (sizeof(ino_t) < sizeof(erofs_nid_t))
> + ino ^= nid >> (sizeof(erofs_nid_t) - sizeof(ino_t)) * 8;
Shouldn't we do:
ino ^= nid >> sizeof(ino_t) * 8
?
--
Thanks,
Jingbo
Powered by blists - more mailing lists