Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17029428rwd; Mon, 26 Jun 2023 19:38:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ64WAb/R1JPqOZdWHz6YTgaJpXXu6iKchAu2uj//o1RB0VFV8jJkmNFU7itIx0HvJKbH7M7 X-Received: by 2002:a17:907:808:b0:977:ceab:3996 with SMTP id wv8-20020a170907080800b00977ceab3996mr26857780ejb.76.1687833492616; Mon, 26 Jun 2023 19:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687833492; cv=none; d=google.com; s=arc-20160816; b=XR3IoRUUU8tprc2RFfLr5P3CQui0M7mpVozpisT3Kh+IzAyyFJwDGjhkYbaErERVwP 3irM96r5I950Kr+v3M8Zoim59XGC9HavIIDnOvxGI110/z3+Uu9KYiDfhSqRjSQwiP6a OROveC8yygLE5s+O4W+LS+4+N9DJ4lSYYUxCXXGvw/bzdUv3GBW8aT5Whg6PIW4cqhDm lzncN+v01R8DIAj++hfrTF3dMUzuwIR1AXYsaWSpVKSFVBgl2Jwba8N/q0rmg3b9Swpq 7RJ1w2yEi7f2+KOFgD7HMy/sMwhJqDB9+DhpI2oqa7jD+dLqe9OjcYCiFYMyaVzQW/e4 pVXA== 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=IUHBqsvKJY2QGvYY+gOjIzovnbyCsZb7c98MDxb7lkY=; fh=mgmBitrUxEw7hKmFDB9V9MdVgRjD50ns5Z68OJIjdkk=; b=MgBoPNDFKqyLIfvK3YDL+7pRMyrFo0B0z76QMfdujEMCMOI+e3xqwwntFMPbhGdyJc ztrn873ShGyi5xMvkRM2WkMfxO5WYiPQZ8kLSO/sR+4x+7llQu175qd/pDgUosrlnC7F ePyuENTGsSlOe/O48pUsmHh733VUQ829RijVEKoD2+OVATNuMRAnb1/py5PpnxHomZTF rY8GY2c2ev0VcF3F/IrEtrngYB+HIVvxTw5foUmeWkoOjIK80EmeCsbU6XboNxWhQofG L5RQ22qDDY+Nws9yDhCxBqRyBtmscaUNks0cR+1uPFitJpoLM3S6UhWoYnljfwPUEh4v BLkQ== 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 jj22-20020a170907985600b009903666fcd1si2067914ejc.462.2023.06.26.19.37.47; Mon, 26 Jun 2023 19:38:12 -0700 (PDT) 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 S229628AbjF0CNL (ORCPT + 99 others); Mon, 26 Jun 2023 22:13:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjF0CNJ (ORCPT ); Mon, 26 Jun 2023 22:13:09 -0400 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C4E51720 for ; Mon, 26 Jun 2023 19:13:06 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R881e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0Vm3e3fb_1687831979; Received: from 30.97.48.228(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Vm3e3fb_1687831979) by smtp.aliyun-inc.com; Tue, 27 Jun 2023 10:13:00 +0800 Message-ID: Date: Tue, 27 Jun 2023 10:12:58 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [RFC 1/2] erofs: update on-disk format for xattr bloom filter To: Jingbo Xu , chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, alexl@redhat.com References: <20230621083209.116024-1-jefflexu@linux.alibaba.com> <20230621083209.116024-2-jefflexu@linux.alibaba.com> From: Gao Xiang In-Reply-To: <20230621083209.116024-2-jefflexu@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,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/6/21 16:32, Jingbo Xu wrote: > The xattr bloom filter feature is going to be introduced to speed up the > negative xattr lookup, e.g. system.posix_acl_[access|default] lookup > when running "ls -lR" workload. > > The number of common used xattr (n) is approximately 8, including > system.[posix_acl_access|posix_acl_default], security.[capability|selinux] > and security.[SMACK64|SMACK64TRANSMUTE|SMACK64EXEC|SMACK64MMAP]. Given the > number of bits of the bloom filter (m) is 32, the optimal value for the > number of the hash functions (k) is 2 (ln2 * m/n = 2.7). > > Signed-off-by: Jingbo Xu > --- > fs/erofs/erofs_fs.h | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h > index 2c7b16e340fe..9daea86cdb52 100644 > --- a/fs/erofs/erofs_fs.h > +++ b/fs/erofs/erofs_fs.h > @@ -13,6 +13,7 @@ > > #define EROFS_FEATURE_COMPAT_SB_CHKSUM 0x00000001 > #define EROFS_FEATURE_COMPAT_MTIME 0x00000002 > +#define EROFS_FEATURE_COMPAT_XATTR_BLOOM 0x00000003 #define EROFS_FEATURE_COMPAT_XATTR_BLOOM 0x00000004 > > /* > * Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should > @@ -200,7 +201,7 @@ struct erofs_inode_extended { > * for read-only fs, no need to introduce h_refcount > */ > struct erofs_xattr_ibody_header { > - __le32 h_reserved; > + __le32 h_map; /* bloom filter, bit value 1 indicates not-present */ `map` here is too ambiguous, could we rename it as "h_name_filter"? > __u8 h_shared_count; > __u8 h_reserved2[7]; > __le32 h_shared_xattrs[]; /* shared xattr id array */ > @@ -221,6 +222,11 @@ struct erofs_xattr_ibody_header { > #define EROFS_XATTR_LONG_PREFIX 0x80 > #define EROFS_XATTR_LONG_PREFIX_MASK 0x7f > > +#define EROFS_XATTR_BLOOM_BITS 32 > +#define EROFS_XATTR_BLOOM_MASK (EROFS_XATTR_BLOOM_BITS - 1) > +#define EROFS_XATTR_BLOOM_DEFAULT UINT32_MAX > +#define EROFS_XATTR_BLOOM_COUNTS 2 could we rename them as EROFS_XATTR_NAME_FILTER_xxx? Thanks, Gao Xiang