* [PATCH v5 0/2] erofs: introduce xattr name bloom filter
@ 2023-07-21 10:49 Jingbo Xu
2023-07-21 10:49 ` [PATCH v5 1/2] erofs: update on-disk format for xattr name filter Jingbo Xu
2023-07-21 10:49 ` [PATCH v5 2/2] erofs: boost negative xattr lookup with bloom filter Jingbo Xu
0 siblings, 2 replies; 6+ messages in thread
From: Jingbo Xu @ 2023-07-21 10:49 UTC (permalink / raw)
To: hsiangkao, chao, huyue2, linux-erofs; +Cc: linux-kernel, alexl
changes since v4:
- patch 2: polish commit message; declare erofs_inode.xattr_name_filter
as unsigned int instead of unsigned long; rename `bit` to `hashbit`;
use bitwise and instead of test_bit() to test the hashbit (Gao Xiang)
changes since v3:
- patch 1: add "Reviewed-by" tag (Gao Xiang)
- patch 2: make CONFIG_EROFS_FS_XATTR select CONFIG_XXHASH (Gao Xiang)
changes since v2:
- patch 1: polish the commit message; introduce xattr_filter_reserved in
on-disk superblock; remove EROFS_XATTR_FILTER_MASK (Gao Xiang)
changes since RFC:
- the number of hash functions is 1, and now it's implemented as:
xxh32(name, strlen(name), EROFS_XATTR_FILTER_SEED + index),
where the constant magic number EROFS_XATTR_FILTER_SEED [*] is used to
give a better spread for the mapping. (Alexander Larsson)
Refer to patch 1 for more details.
- fix the value of EROFS_FEATURE_COMPAT_XATTR_BLOOM; rename
EROFS_XATTR_BLOOM_* to EROFS_XATTR_FILTER_* (Gao Xiang)
- pass all tests in erofs-utils (MKFS_OPTIONS="--xattr-filter" make
check)
[*] https://lore.kernel.org/all/74a8a369-c3b0-b338-fa8f-fdd7c252efaf@linux.alibaba.com/
RFC: https://lore.kernel.org/all/20230621083209.116024-1-jefflexu@linux.alibaba.com/
v2: https://lore.kernel.org/all/20230705070427.92579-1-jefflexu@linux.alibaba.com/
v3: https://lore.kernel.org/all/20230712115123.33712-1-jefflexu@linux.alibaba.com/
v4: https://lore.kernel.org/all/20230714031034.53210-1-jefflexu@linux.alibaba.com/
Jingbo Xu (2):
erofs: update on-disk format for xattr name filter
erofs: boost negative xattr lookup with bloom filter
fs/erofs/Kconfig | 1 +
fs/erofs/erofs_fs.h | 10 ++++++++--
fs/erofs/internal.h | 3 +++
fs/erofs/super.c | 1 +
fs/erofs/xattr.c | 14 ++++++++++++++
5 files changed, 27 insertions(+), 2 deletions(-)
--
2.19.1.6.gb485710b
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v5 1/2] erofs: update on-disk format for xattr name filter
2023-07-21 10:49 [PATCH v5 0/2] erofs: introduce xattr name bloom filter Jingbo Xu
@ 2023-07-21 10:49 ` Jingbo Xu
2023-07-21 10:49 ` [PATCH v5 2/2] erofs: boost negative xattr lookup with bloom filter Jingbo Xu
1 sibling, 0 replies; 6+ messages in thread
From: Jingbo Xu @ 2023-07-21 10:49 UTC (permalink / raw)
To: hsiangkao, chao, huyue2, linux-erofs; +Cc: linux-kernel, alexl
The xattr name 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.
There are some commonly used extended attributes (n) and the total
number of these is approximately 30.
trusted.overlay.opaque
trusted.overlay.redirect
trusted.overlay.origin
trusted.overlay.impure
trusted.overlay.nlink
trusted.overlay.upper
trusted.overlay.metacopy
trusted.overlay.protattr
user.overlay.opaque
user.overlay.redirect
user.overlay.origin
user.overlay.impure
user.overlay.nlink
user.overlay.upper
user.overlay.metacopy
user.overlay.protattr
security.evm
security.ima
security.selinux
security.SMACK64
security.SMACK64IPIN
security.SMACK64IPOUT
security.SMACK64EXEC
security.SMACK64TRANSMUTE
security.SMACK64MMAP
security.apparmor
security.capability
system.posix_acl_access
system.posix_acl_default
user.mime_type
Given the number of bits of the bloom filter (m) is 32, the optimal
value for the number of the hash functions (k) is 1 (ln2 * m/n = 0.74).
The single hash function is implemented as:
xxh32(name, strlen(name), EROFS_XATTR_FILTER_SEED + index)
where `index` represents the index of corresponding predefined short name
prefix, while `name` represents the name string after stripping the above
predefined name prefix.
The constant magic number EROFS_XATTR_FILTER_SEED, i.e. 0x25BBE08F, is
used to give a better spread when mapping these 30 extended attributes
into 32-bit bloom filter as:
bit 0: security.ima
bit 1:
bit 2: trusted.overlay.nlink
bit 3:
bit 4: user.overlay.nlink
bit 5: trusted.overlay.upper
bit 6: user.overlay.origin
bit 7: trusted.overlay.protattr
bit 8: security.apparmor
bit 9: user.overlay.protattr
bit 10: user.overlay.opaque
bit 11: security.selinux
bit 12: security.SMACK64TRANSMUTE
bit 13: security.SMACK64
bit 14: security.SMACK64MMAP
bit 15: user.overlay.impure
bit 16: security.SMACK64IPIN
bit 17: trusted.overlay.redirect
bit 18: trusted.overlay.origin
bit 19: security.SMACK64IPOUT
bit 20: trusted.overlay.opaque
bit 21: system.posix_acl_default
bit 22:
bit 23: user.mime_type
bit 24: trusted.overlay.impure
bit 25: security.SMACK64EXEC
bit 26: user.overlay.redirect
bit 27: user.overlay.upper
bit 28: security.evm
bit 29: security.capability
bit 30: system.posix_acl_access
bit 31: trusted.overlay.metacopy, user.overlay.metacopy
h_name_filter is introduced to the on-disk per-inode xattr header to
place the corresponding xattr name filter, where bit value 1 indicates
non-existence for compatibility.
This feature is indicated by EROFS_FEATURE_COMPAT_XATTR_FILTER
compatible feature bit.
Reserve one byte in on-disk superblock as the on-disk format for xattr
name filter may change in the future. With this flag we don't need
bothering these compatible bits again at that time.
Suggested-by: Alexander Larsson <alexl@redhat.com>
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
fs/erofs/erofs_fs.h | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/erofs/erofs_fs.h b/fs/erofs/erofs_fs.h
index 2c7b16e340fe..e2944f4a6ff9 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_FILTER 0x00000004
/*
* Any bits that aren't in EROFS_ALL_FEATURE_INCOMPAT should
@@ -81,7 +82,8 @@ struct erofs_super_block {
__u8 xattr_prefix_count; /* # of long xattr name prefixes */
__le32 xattr_prefix_start; /* start of long xattr prefixes */
__le64 packed_nid; /* nid of the special packed inode */
- __u8 reserved2[24];
+ __u8 xattr_filter_reserved; /* reserved for xattr name filter */
+ __u8 reserved2[23];
};
/*
@@ -200,7 +202,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_name_filter; /* bit value 1 indicates not-present */
__u8 h_shared_count;
__u8 h_reserved2[7];
__le32 h_shared_xattrs[]; /* shared xattr id array */
@@ -221,6 +223,10 @@ struct erofs_xattr_ibody_header {
#define EROFS_XATTR_LONG_PREFIX 0x80
#define EROFS_XATTR_LONG_PREFIX_MASK 0x7f
+#define EROFS_XATTR_FILTER_BITS 32
+#define EROFS_XATTR_FILTER_DEFAULT UINT32_MAX
+#define EROFS_XATTR_FILTER_SEED 0x25BBE08F
+
/* xattr entry (for both inline & shared xattrs) */
struct erofs_xattr_entry {
__u8 e_name_len; /* length of name */
--
2.19.1.6.gb485710b
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v5 2/2] erofs: boost negative xattr lookup with bloom filter
2023-07-21 10:49 [PATCH v5 0/2] erofs: introduce xattr name bloom filter Jingbo Xu
2023-07-21 10:49 ` [PATCH v5 1/2] erofs: update on-disk format for xattr name filter Jingbo Xu
@ 2023-07-21 10:49 ` Jingbo Xu
2023-07-22 7:05 ` Gao Xiang
1 sibling, 1 reply; 6+ messages in thread
From: Jingbo Xu @ 2023-07-21 10:49 UTC (permalink / raw)
To: hsiangkao, chao, huyue2, linux-erofs; +Cc: linux-kernel, alexl
Optimise the negative xattr lookup with bloom filter.
The bit value for the bloom filter map has a reverse semantics for
compatibility. That is, the bit value of 0 indicates existence, while
the bit value of 1 indicates the absence of corresponding xattr.
The initial version is _only_ enabled when xattr_filter_reserved is
zero. The filter map internals may change in the future, in which case
the reserved flag will be set non-zero and we don't need bothering the
compatible bits again at that time. For now disable the optimization if
this reserved flag is non-zero.
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
---
fs/erofs/Kconfig | 1 +
fs/erofs/internal.h | 3 +++
fs/erofs/super.c | 1 +
fs/erofs/xattr.c | 14 ++++++++++++++
4 files changed, 19 insertions(+)
diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
index f259d92c9720..f49669def828 100644
--- a/fs/erofs/Kconfig
+++ b/fs/erofs/Kconfig
@@ -38,6 +38,7 @@ config EROFS_FS_DEBUG
config EROFS_FS_XATTR
bool "EROFS extended attributes"
depends on EROFS_FS
+ select XXHASH
default y
help
Extended attributes are name:value pairs associated with inodes by
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 36e32fa542f0..3c1f89d8421b 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -151,6 +151,7 @@ struct erofs_sb_info {
u32 xattr_prefix_start;
u8 xattr_prefix_count;
struct erofs_xattr_prefix_item *xattr_prefixes;
+ unsigned int xattr_filter_reserved;
#endif
u16 device_id_mask; /* valid bits of device id to be used */
@@ -251,6 +252,7 @@ EROFS_FEATURE_FUNCS(fragments, incompat, INCOMPAT_FRAGMENTS)
EROFS_FEATURE_FUNCS(dedupe, incompat, INCOMPAT_DEDUPE)
EROFS_FEATURE_FUNCS(xattr_prefixes, incompat, INCOMPAT_XATTR_PREFIXES)
EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM)
+EROFS_FEATURE_FUNCS(xattr_filter, compat, COMPAT_XATTR_FILTER)
/* atomic flag definitions */
#define EROFS_I_EA_INITED_BIT 0
@@ -270,6 +272,7 @@ struct erofs_inode {
unsigned char inode_isize;
unsigned int xattr_isize;
+ unsigned int xattr_name_filter;
unsigned int xattr_shared_count;
unsigned int *xattr_shared_xattrs;
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 9d6a3c6158bd..72122323300e 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -388,6 +388,7 @@ static int erofs_read_superblock(struct super_block *sb)
sbi->xattr_blkaddr = le32_to_cpu(dsb->xattr_blkaddr);
sbi->xattr_prefix_start = le32_to_cpu(dsb->xattr_prefix_start);
sbi->xattr_prefix_count = dsb->xattr_prefix_count;
+ sbi->xattr_filter_reserved = dsb->xattr_filter_reserved;
#endif
sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact));
sbi->root_nid = le16_to_cpu(dsb->root_nid);
diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
index 40178b6e0688..e9b9ed6b28d2 100644
--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -5,6 +5,7 @@
* Copyright (C) 2021-2022, Alibaba Cloud
*/
#include <linux/security.h>
+#include <linux/xxhash.h>
#include "xattr.h"
struct erofs_xattr_iter {
@@ -87,6 +88,7 @@ static int erofs_init_inode_xattrs(struct inode *inode)
}
ih = it.kaddr + erofs_blkoff(sb, it.pos);
+ vi->xattr_name_filter = le32_to_cpu(ih->h_name_filter);
vi->xattr_shared_count = ih->h_shared_count;
vi->xattr_shared_xattrs = kmalloc_array(vi->xattr_shared_count,
sizeof(uint), GFP_KERNEL);
@@ -392,7 +394,10 @@ int erofs_getxattr(struct inode *inode, int index, const char *name,
void *buffer, size_t buffer_size)
{
int ret;
+ uint32_t hashbit;
struct erofs_xattr_iter it;
+ struct erofs_inode *vi = EROFS_I(inode);
+ struct erofs_sb_info *sbi = EROFS_SB(inode->i_sb);
if (!name)
return -EINVAL;
@@ -401,6 +406,15 @@ int erofs_getxattr(struct inode *inode, int index, const char *name,
if (ret)
return ret;
+ /* reserved flag is non-zero if there's any change of on-disk format */
+ if (erofs_sb_has_xattr_filter(sbi) && !sbi->xattr_filter_reserved) {
+ hashbit = xxh32(name, strlen(name),
+ EROFS_XATTR_FILTER_SEED + index);
+ hashbit &= EROFS_XATTR_FILTER_BITS - 1;
+ if (vi->xattr_name_filter & (1U << hashbit))
+ return -ENOATTR;
+ }
+
it.index = index;
it.name = (struct qstr)QSTR_INIT(name, strlen(name));
if (it.name.len > EROFS_NAME_LEN)
--
2.19.1.6.gb485710b
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5 2/2] erofs: boost negative xattr lookup with bloom filter
2023-07-21 10:49 ` [PATCH v5 2/2] erofs: boost negative xattr lookup with bloom filter Jingbo Xu
@ 2023-07-22 7:05 ` Gao Xiang
2023-07-22 7:33 ` Jingbo Xu
0 siblings, 1 reply; 6+ messages in thread
From: Gao Xiang @ 2023-07-22 7:05 UTC (permalink / raw)
To: Jingbo Xu; +Cc: linux-erofs, linux-kernel
On Fri, Jul 21, 2023 at 06:49:23PM +0800, Jingbo Xu wrote:
> Optimise the negative xattr lookup with bloom filter.
>
> The bit value for the bloom filter map has a reverse semantics for
> compatibility. That is, the bit value of 0 indicates existence, while
> the bit value of 1 indicates the absence of corresponding xattr.
>
> The initial version is _only_ enabled when xattr_filter_reserved is
> zero. The filter map internals may change in the future, in which case
> the reserved flag will be set non-zero and we don't need bothering the
> compatible bits again at that time. For now disable the optimization if
> this reserved flag is non-zero.
>
> Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
> ---
> fs/erofs/Kconfig | 1 +
> fs/erofs/internal.h | 3 +++
> fs/erofs/super.c | 1 +
> fs/erofs/xattr.c | 14 ++++++++++++++
> 4 files changed, 19 insertions(+)
>
> diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
> index f259d92c9720..f49669def828 100644
> --- a/fs/erofs/Kconfig
> +++ b/fs/erofs/Kconfig
> @@ -38,6 +38,7 @@ config EROFS_FS_DEBUG
> config EROFS_FS_XATTR
> bool "EROFS extended attributes"
> depends on EROFS_FS
> + select XXHASH
> default y
> help
> Extended attributes are name:value pairs associated with inodes by
> diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
> index 36e32fa542f0..3c1f89d8421b 100644
> --- a/fs/erofs/internal.h
> +++ b/fs/erofs/internal.h
> @@ -151,6 +151,7 @@ struct erofs_sb_info {
> u32 xattr_prefix_start;
> u8 xattr_prefix_count;
> struct erofs_xattr_prefix_item *xattr_prefixes;
> + unsigned int xattr_filter_reserved;
> #endif
> u16 device_id_mask; /* valid bits of device id to be used */
>
> @@ -251,6 +252,7 @@ EROFS_FEATURE_FUNCS(fragments, incompat, INCOMPAT_FRAGMENTS)
> EROFS_FEATURE_FUNCS(dedupe, incompat, INCOMPAT_DEDUPE)
> EROFS_FEATURE_FUNCS(xattr_prefixes, incompat, INCOMPAT_XATTR_PREFIXES)
> EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM)
> +EROFS_FEATURE_FUNCS(xattr_filter, compat, COMPAT_XATTR_FILTER)
>
> /* atomic flag definitions */
> #define EROFS_I_EA_INITED_BIT 0
> @@ -270,6 +272,7 @@ struct erofs_inode {
> unsigned char inode_isize;
> unsigned int xattr_isize;
>
> + unsigned int xattr_name_filter;
> unsigned int xattr_shared_count;
> unsigned int *xattr_shared_xattrs;
>
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index 9d6a3c6158bd..72122323300e 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -388,6 +388,7 @@ static int erofs_read_superblock(struct super_block *sb)
> sbi->xattr_blkaddr = le32_to_cpu(dsb->xattr_blkaddr);
> sbi->xattr_prefix_start = le32_to_cpu(dsb->xattr_prefix_start);
> sbi->xattr_prefix_count = dsb->xattr_prefix_count;
> + sbi->xattr_filter_reserved = dsb->xattr_filter_reserved;
> #endif
> sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact));
> sbi->root_nid = le16_to_cpu(dsb->root_nid);
> diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
> index 40178b6e0688..e9b9ed6b28d2 100644
> --- a/fs/erofs/xattr.c
> +++ b/fs/erofs/xattr.c
> @@ -5,6 +5,7 @@
> * Copyright (C) 2021-2022, Alibaba Cloud
> */
> #include <linux/security.h>
> +#include <linux/xxhash.h>
> #include "xattr.h"
>
> struct erofs_xattr_iter {
> @@ -87,6 +88,7 @@ static int erofs_init_inode_xattrs(struct inode *inode)
> }
>
> ih = it.kaddr + erofs_blkoff(sb, it.pos);
> + vi->xattr_name_filter = le32_to_cpu(ih->h_name_filter);
> vi->xattr_shared_count = ih->h_shared_count;
> vi->xattr_shared_xattrs = kmalloc_array(vi->xattr_shared_count,
> sizeof(uint), GFP_KERNEL);
> @@ -392,7 +394,10 @@ int erofs_getxattr(struct inode *inode, int index, const char *name,
> void *buffer, size_t buffer_size)
> {
> int ret;
> + uint32_t hashbit;
Why using `uint32_t` here rather than `unsigned int`? We don't use
`uint32_t` in the kernel codebase.
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 2/2] erofs: boost negative xattr lookup with bloom filter
2023-07-22 7:05 ` Gao Xiang
@ 2023-07-22 7:33 ` Jingbo Xu
2023-07-22 7:46 ` Gao Xiang
0 siblings, 1 reply; 6+ messages in thread
From: Jingbo Xu @ 2023-07-22 7:33 UTC (permalink / raw)
To: linux-erofs, linux-kernel
On 7/22/23 3:05 PM, Gao Xiang wrote:
> On Fri, Jul 21, 2023 at 06:49:23PM +0800, Jingbo Xu wrote:
>> Optimise the negative xattr lookup with bloom filter.
>>
>> The bit value for the bloom filter map has a reverse semantics for
>> compatibility. That is, the bit value of 0 indicates existence, while
>> the bit value of 1 indicates the absence of corresponding xattr.
>>
>> The initial version is _only_ enabled when xattr_filter_reserved is
>> zero. The filter map internals may change in the future, in which case
>> the reserved flag will be set non-zero and we don't need bothering the
>> compatible bits again at that time. For now disable the optimization if
>> this reserved flag is non-zero.
>>
>> Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
>> ---
>> fs/erofs/Kconfig | 1 +
>> fs/erofs/internal.h | 3 +++
>> fs/erofs/super.c | 1 +
>> fs/erofs/xattr.c | 14 ++++++++++++++
>> 4 files changed, 19 insertions(+)
>>
>> diff --git a/fs/erofs/Kconfig b/fs/erofs/Kconfig
>> index f259d92c9720..f49669def828 100644
>> --- a/fs/erofs/Kconfig
>> +++ b/fs/erofs/Kconfig
>> @@ -38,6 +38,7 @@ config EROFS_FS_DEBUG
>> config EROFS_FS_XATTR
>> bool "EROFS extended attributes"
>> depends on EROFS_FS
>> + select XXHASH
>> default y
>> help
>> Extended attributes are name:value pairs associated with inodes by
>> diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
>> index 36e32fa542f0..3c1f89d8421b 100644
>> --- a/fs/erofs/internal.h
>> +++ b/fs/erofs/internal.h
>> @@ -151,6 +151,7 @@ struct erofs_sb_info {
>> u32 xattr_prefix_start;
>> u8 xattr_prefix_count;
>> struct erofs_xattr_prefix_item *xattr_prefixes;
>> + unsigned int xattr_filter_reserved;
>> #endif
>> u16 device_id_mask; /* valid bits of device id to be used */
>>
>> @@ -251,6 +252,7 @@ EROFS_FEATURE_FUNCS(fragments, incompat, INCOMPAT_FRAGMENTS)
>> EROFS_FEATURE_FUNCS(dedupe, incompat, INCOMPAT_DEDUPE)
>> EROFS_FEATURE_FUNCS(xattr_prefixes, incompat, INCOMPAT_XATTR_PREFIXES)
>> EROFS_FEATURE_FUNCS(sb_chksum, compat, COMPAT_SB_CHKSUM)
>> +EROFS_FEATURE_FUNCS(xattr_filter, compat, COMPAT_XATTR_FILTER)
>>
>> /* atomic flag definitions */
>> #define EROFS_I_EA_INITED_BIT 0
>> @@ -270,6 +272,7 @@ struct erofs_inode {
>> unsigned char inode_isize;
>> unsigned int xattr_isize;
>>
>> + unsigned int xattr_name_filter;
>> unsigned int xattr_shared_count;
>> unsigned int *xattr_shared_xattrs;
>>
>> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
>> index 9d6a3c6158bd..72122323300e 100644
>> --- a/fs/erofs/super.c
>> +++ b/fs/erofs/super.c
>> @@ -388,6 +388,7 @@ static int erofs_read_superblock(struct super_block *sb)
>> sbi->xattr_blkaddr = le32_to_cpu(dsb->xattr_blkaddr);
>> sbi->xattr_prefix_start = le32_to_cpu(dsb->xattr_prefix_start);
>> sbi->xattr_prefix_count = dsb->xattr_prefix_count;
>> + sbi->xattr_filter_reserved = dsb->xattr_filter_reserved;
>> #endif
>> sbi->islotbits = ilog2(sizeof(struct erofs_inode_compact));
>> sbi->root_nid = le16_to_cpu(dsb->root_nid);
>> diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
>> index 40178b6e0688..e9b9ed6b28d2 100644
>> --- a/fs/erofs/xattr.c
>> +++ b/fs/erofs/xattr.c
>> @@ -5,6 +5,7 @@
>> * Copyright (C) 2021-2022, Alibaba Cloud
>> */
>> #include <linux/security.h>
>> +#include <linux/xxhash.h>
>> #include "xattr.h"
>>
>> struct erofs_xattr_iter {
>> @@ -87,6 +88,7 @@ static int erofs_init_inode_xattrs(struct inode *inode)
>> }
>>
>> ih = it.kaddr + erofs_blkoff(sb, it.pos);
>> + vi->xattr_name_filter = le32_to_cpu(ih->h_name_filter);
>> vi->xattr_shared_count = ih->h_shared_count;
>> vi->xattr_shared_xattrs = kmalloc_array(vi->xattr_shared_count,
>> sizeof(uint), GFP_KERNEL);
>> @@ -392,7 +394,10 @@ int erofs_getxattr(struct inode *inode, int index, const char *name,
>> void *buffer, size_t buffer_size)
>> {
>> int ret;
>> + uint32_t hashbit;
>
> Why using `uint32_t` here rather than `unsigned int`? We don't use
> `uint32_t` in the kernel codebase.
>
xxh32() returns uint32_t.
--
Thanks,
Jingbo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 2/2] erofs: boost negative xattr lookup with bloom filter
2023-07-22 7:33 ` Jingbo Xu
@ 2023-07-22 7:46 ` Gao Xiang
0 siblings, 0 replies; 6+ messages in thread
From: Gao Xiang @ 2023-07-22 7:46 UTC (permalink / raw)
To: Jingbo Xu; +Cc: linux-erofs, linux-kernel
On Sat, Jul 22, 2023 at 03:33:11PM +0800, Jingbo Xu wrote:
...
> >> + uint32_t hashbit;
> >
> > Why using `uint32_t` here rather than `unsigned int`? We don't use
> > `uint32_t` in the kernel codebase.
> >
>
> xxh32() returns uint32_t.
we never use (u)intxx_t in the native kernel code.
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-07-22 7:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21 10:49 [PATCH v5 0/2] erofs: introduce xattr name bloom filter Jingbo Xu
2023-07-21 10:49 ` [PATCH v5 1/2] erofs: update on-disk format for xattr name filter Jingbo Xu
2023-07-21 10:49 ` [PATCH v5 2/2] erofs: boost negative xattr lookup with bloom filter Jingbo Xu
2023-07-22 7:05 ` Gao Xiang
2023-07-22 7:33 ` Jingbo Xu
2023-07-22 7:46 ` Gao Xiang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.