-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Move range_tree, btree, highbit64 to common code #18133
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
base: master
Are you sure you want to change the base?
Conversation
|
Note - I kept |
Break out the range_tree, btree, and highbit64/lowbit64 code from kernel space into shared kernel and userspace code. This is needed for the updated `zpool status -vv` error byte range reporting that will be coming in a future commit. That commit needs the range_tree code in kernel and userspace. Signed-off-by: Tony Hutter <[email protected]>
4c51583 to
1f5d7ef
Compare
| uint_t num_logs(nvlist_t *nv); | ||
| uint64_t array64_max(uint64_t array[], unsigned int len); | ||
| int highbit64(uint64_t i); | ||
| int lowbit64(uint64_t i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lowbit64 too
| libnvpair.la | ||
| libnvpair.la \ | ||
| librange_tree.la \ | ||
| libbtree.la |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not using any of this yet so this hunk should get moved to the "error ranges" PR.
| libnvpair.la | ||
|
|
||
| libnvpair.la \ | ||
| librange_tree.la |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zhack shouldn't need this yet either.
| #include <sys/btree.h> | ||
| #include <sys/bitops.h> | ||
| #include <sys/zfs_context.h> | ||
| #include <sys/sysmacros.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When compiling without ZFS_DEBUG there are a bunch of warning: unused parameter ‘xxx’ [-Wunused-parameter] messages which were seem to have been suppressed before. One way to tackle this would be to add some no-op #define macros for the !ZFS_DEBUG case.
| module/zcommon/zprop_common.c | ||
| module/zcommon/zprop_common.c \ | ||
| module/zfs/btree.c \ | ||
| module/zfs/range_tree.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aren't needed by libzfs and can be removed. We'll want to add in whatever dependencies are needed as part of the "error ranges" changes.
| # | | \ \ | | / / | \ \ | ||
| # libicp --/ | \ \ | | / / | \ \ | ||
| # | \ librange_tree / | \ \ | ||
| # libzstd ---/ \ libbtree / | \ \-------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be where we end up, but libzpool should be our only consumer of librange_tree and libbtree in this PR.
| libzpool.la \ | ||
| libzfs_core.la | ||
|
|
||
| libbtree.la |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untested but I'm pretty sure we should be able to prune this down to what we actually use. Something like:
%C%_btree_test_LDADD = \
libavl.la \
libbtree.la
| @@ -0,0 +1,6 @@ | |||
| # SPDX-License-Identifier: CDDL-1.0 | |||
| libbtree_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For both libbtree and librange_tree we should set -fvisibility=hidden by default in the Makefile.am and then define a wrapper macro to make visible the symbols we need. Both libnvpair and libavl are good examples. For example:
libbtree_la_CFLAGS += -fvisibility=hidden
and
#ifndef _BTREE_H
#define _BTREE_H extern __attribute__((visibility("default")))
_BTREE_H void zfs_btree_init(void);
_BTREE_H void zfs_btree_fini(void);
...
Motivation and Context
Break out range_tree/btree/highbit64/lowbit64 code for #17864
Description
Break out the range_tree, btree, and highbit64/lowbit64 code from kernel space into shared kernel and userspace code. This is needed for the updated
zpool status -vverror byte range reporting that will be coming in a future commit. That commit needs the range_tree code in kernel and userspace.How Has This Been Tested?
Test built
Types of changes
Checklist:
Signed-off-by.