mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
Move range_tree, btree, highbit64 to common code
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. Reviewed-by: Rob Norris <robn@despairlabs.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #18133
This commit is contained in:
+2
-2
@@ -36,8 +36,8 @@ zhack_SOURCES = \
|
||||
zhack_LDADD = \
|
||||
libzpool.la \
|
||||
libzfs_core.la \
|
||||
libnvpair.la
|
||||
|
||||
libnvpair.la \
|
||||
librange_tree.la
|
||||
|
||||
ztest_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS)
|
||||
ztest_CPPFLAGS = $(AM_CPPFLAGS) $(LIBZPOOL_CPPFLAGS)
|
||||
|
||||
+3
-1
@@ -14,6 +14,8 @@ zdb_LDADD = \
|
||||
libzdb.la \
|
||||
libzpool.la \
|
||||
libzfs_core.la \
|
||||
libnvpair.la
|
||||
libnvpair.la \
|
||||
libbtree.la \
|
||||
librange_tree.la
|
||||
|
||||
zdb_LDADD += $(LIBCRYPTO_LIBS)
|
||||
|
||||
@@ -114,29 +114,3 @@ array64_max(uint64_t array[], unsigned int len)
|
||||
|
||||
return (max);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find highest one bit set.
|
||||
* Returns bit number + 1 of highest bit that is set, otherwise returns 0.
|
||||
*/
|
||||
int
|
||||
highbit64(uint64_t i)
|
||||
{
|
||||
if (i == 0)
|
||||
return (0);
|
||||
|
||||
return (NBBY * sizeof (uint64_t) - __builtin_clzll(i));
|
||||
}
|
||||
|
||||
/*
|
||||
* Find lowest one bit set.
|
||||
* Returns bit number + 1 of lowest bit that is set, otherwise returns 0.
|
||||
*/
|
||||
int
|
||||
lowbit64(uint64_t i)
|
||||
{
|
||||
if (i == 0)
|
||||
return (0);
|
||||
|
||||
return (__builtin_ffsll(i));
|
||||
}
|
||||
|
||||
@@ -45,8 +45,6 @@ void *safe_realloc(void *, size_t);
|
||||
void zpool_no_memory(void);
|
||||
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);
|
||||
|
||||
/*
|
||||
* Misc utility functions
|
||||
|
||||
Reference in New Issue
Block a user