Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erofs bloom filter #176

Merged
merged 3 commits into from
Aug 29, 2023
Merged

Conversation

alexlarsson
Copy link
Collaborator

This adds the COMPAT_XATTR_FILTER feature flag, and computes h_name_filter in all the inode xattr header.

Fixes #167

This is based on and tested against the code in the dev branch of erofs.git, so this is not upstream quite yet. However, this likely will go in unchanged.

@hsiangkao wanna have a quick look?

This is a copy of the upstream bsd-2 licences code
which is also used by the kernel.

Signed-off-by: Alexander Larsson <[email protected]>
@alexlarsson alexlarsson force-pushed the erofs-bloom-filter branch 2 times, most recently from 9769a76 to 7031321 Compare August 21, 2023 10:04
@alexlarsson
Copy link
Collaborator Author

NOTE: This is a format-breaking change, so its also updates the test checksums. We should merge this before freezing the format.

struct erofs_inode_chunk_info {
__le16 format; /* chunk blkbits, etc. */
__le16 reserved;
};

union erofs_inode_i_u {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like some of this could be split out as a prep patch?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean. This is a prep patch. All it does is copy the latest version of this file from the kernel tree.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, actually, it does tweak the code to work with some new naming in the new file, but its nice to merge those to have each commit build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I was reviewing in the "files changed" UI which squashes everything. Let's just do the two prep patches as a distinct PR that can merge right away?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes were proposed upstream today, so I think we can merge the whole thing soon.

@hsiangkao
Copy link
Contributor

hsiangkao commented Aug 22, 2023

@hsiangkao wanna have a quick look?

Sorry for a bit late reply since I'm busy in the last test for commits of the next cycle.
Overall it looks good to me, will upstream xattr bloom filter feature once the merge window opens.

I think the implementation won't be changed, but let's wait until the kernel side merged.

This matches:
  https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git/commit/?h=dev&id=fd73a4395d477ae134f319f7368a9f8a6264fd8b

We set the COMPAT_XATTR_FILTER flag on the superblock, and we add to
each xattr header a 32bit bloom filter which defaults to all bits
set, and then we compute a hash for each key modulo 32, and unset
that bit in the bloom filter.

Older kernels will ignore this, but newer kernels will use it
to make xattr lookup more efficient.

NOTE: This is a format-breaking change, so we also update the test
checksums. We should merge this before freezing the format.

Signed-off-by: Alexander Larsson <[email protected]>
@alexlarsson
Copy link
Collaborator Author

Added the link to the kernel source of xxh32()

@alexlarsson
Copy link
Collaborator Author

@hsiangkao
Copy link
Contributor

hsiangkao commented Aug 29, 2023

@lostjeffle
Copy link

The implementation looks good to me. Thanks.

@alexlarsson alexlarsson enabled auto-merge (rebase) August 29, 2023 06:52
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexlarsson alexlarsson merged commit 597a766 into containers:main Aug 29, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add bloom filter data to erofs images
5 participants