mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiang Gao <hsiangkao@linux.alibaba.com>
To: Jingbo Xu <jefflexu@linux.alibaba.com>,
	linux-erofs@lists.ozlabs.org, Chao Yu <chao@kernel.org>,
	Yue Hu <huyue2@coolpad.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] erofs: clean up erofs_iget()
Date: Fri, 13 Jan 2023 15:46:16 +0800	[thread overview]
Message-ID: <feaaaa52-1464-644f-2942-aaf53b6c783a@linux.alibaba.com> (raw)
In-Reply-To: <144922ad-66a3-27e8-df85-4a58c175a630@linux.alibaba.com>



On 2023/1/13 15:41, Jingbo Xu wrote:
> 
> 
> 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@linux.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
Actually I copied it from fuse, for 64-bit erofs_nid_t it has no difference
though. I will also update it as your suggestion in v2.

Thanks,
Gao Xiang


> ?
> 
> 

  reply	other threads:[~2023-01-13  7:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13  6:52 Gao Xiang
2023-01-13  6:52 ` [PATCH 2/2] erofs: remove linux/buffer_head.h dependency Gao Xiang
2023-01-13  7:44   ` Yue Hu
2023-01-13  8:04   ` Jingbo Xu
2023-01-13  7:38 ` [PATCH 1/2] erofs: clean up erofs_iget() Yue Hu
2023-01-13  7:41 ` Jingbo Xu
2023-01-13  7:46   ` Xiang Gao [this message]
2023-01-14  8:21 ` Jingbo Xu
2023-02-14 13:38 ` Chao Yu

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=feaaaa52-1464-644f-2942-aaf53b6c783a@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=huyue2@coolpad.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®