Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp513744rwb; Fri, 13 Jan 2023 00:14:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXuUfMh//7tHY3QWRyoqXMgQb5VbJbhsgvvbCDHEEdYNzpQ5xdFlflc7boKTYEPPSgWoQDme X-Received: by 2002:a17:90a:3fc3:b0:228:e435:2828 with SMTP id u3-20020a17090a3fc300b00228e4352828mr9655929pjm.31.1673597677294; Fri, 13 Jan 2023 00:14:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673597677; cv=none; d=google.com; s=arc-20160816; b=Tc45LkraVCsWkaH06ec/R3+dZxL0FG2b10IIg0niOwWK7N2h+qQzF+FM7/omM1gQhG zIGLAUdfDYd8XRjFlRg9h6r7334p6+y6ACvJ6V2oQ33r/MGNyo3kFnJOmZDxsAwXZK1x B+FcwbIEu934Bwe/zK675y/KmBYG1ZKx+UAKmQuujyRolyx84q+yd8qSqT+DwJrHDqz3 hXxqW32FlhCCrZMGizhbvzicOCBqO1uDpquun+090zp2jHipt5Chhbn5PQqyOFASu0Eh 7FPXabagaWi15Jt3yKlnTmI+QVBNMa8ffIWyKJ6hYVIhqd407N8zcg5ck+1+tHJRMayj h3PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=fvVr+b1y0EW2MYUB1Iur3QIKp6S25Vk5sC8k4YrP2gk=; b=KtZRhbOEl6OYCiLN80oF9n7V+GUZudZX2mw5SXKZeDuPxatsa2HD7sELMP3f/w+9lk 7295lPl+liYhdOWcDkHTW4LINw+Icz5cQZqzk63FlgYvx0yP2zIsLTivTMazcjruBLof tiDJYdnCJejjaOJOj3q5MpR1gg9z5bmZLaGqFrCTwRcg69PVmsLeQz52aVYDi/M1RW3O ewSPx+rKY9CVVOcMie/jDk7Zp6JcEcpQetZJu3nbJK1E5Zqk0HjxlDmew1PuRC3KdZ7X iEPsmfxfTe6sqzS2b5XnvQHHjfWs9NZ0LdPylfkrnIce7QvatTOq1MNKoFdZ5DmJvGSS 9oAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw18-20020a17090b181200b00226e0a6c643si22459252pjb.51.2023.01.13.00.14.30; Fri, 13 Jan 2023 00:14:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238205AbjAMHq0 (ORCPT + 50 others); Fri, 13 Jan 2023 02:46:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234896AbjAMHqX (ORCPT ); Fri, 13 Jan 2023 02:46:23 -0500 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4948A61300 for ; Thu, 12 Jan 2023 23:46:21 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VZTolwy_1673595977; Received: from 30.97.48.201(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VZTolwy_1673595977) by smtp.aliyun-inc.com; Fri, 13 Jan 2023 15:46:18 +0800 Message-ID: Date: Fri, 13 Jan 2023 15:46:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH 1/2] erofs: clean up erofs_iget() To: Jingbo Xu , linux-erofs@lists.ozlabs.org, Chao Yu , Yue Hu Cc: LKML References: <20230113065226.68801-1-hsiangkao@linux.alibaba.com> <144922ad-66a3-27e8-df85-4a58c175a630@linux.alibaba.com> From: Xiang Gao In-Reply-To: <144922ad-66a3-27e8-df85-4a58c175a630@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> --- >> 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 > ? > >