diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-11 20:35:06 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-05 13:14:22 -0500 |
commit | 7abf98f3a20229b68668662cf6b8602c7a4b6ccf (patch) | |
tree | 8d7aa8676db36db9ae02f82a0cca04bfd5de03fb | |
parent | 8574144c446cff52aa5f694960447bf82e8090bf (diff) |
mean and variance: Promote to lib/math
This promotes mean_and_variance from bcachefs to lib/math, so it can be
used by other things.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | MAINTAINERS | 9 | ||||
-rw-r--r-- | fs/bcachefs/Kconfig | 10 | ||||
-rw-r--r-- | fs/bcachefs/Makefile | 3 | ||||
-rw-r--r-- | fs/bcachefs/util.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/util.h | 3 | ||||
-rw-r--r-- | include/linux/mean_and_variance.h (renamed from fs/bcachefs/mean_and_variance.h) | 0 | ||||
-rw-r--r-- | lib/Kconfig.debug | 9 | ||||
-rw-r--r-- | lib/math/Kconfig | 3 | ||||
-rw-r--r-- | lib/math/Makefile | 2 | ||||
-rw-r--r-- | lib/math/mean_and_variance.c (renamed from fs/bcachefs/mean_and_variance.c) | 3 | ||||
-rw-r--r-- | lib/math/mean_and_variance_test.c (renamed from fs/bcachefs/mean_and_variance_test.c) | 3 |
11 files changed, 28 insertions, 19 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 55d9d860f1a7..04459cb2e646 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13070,6 +13070,15 @@ S: Maintained F: drivers/net/mdio/mdio-regmap.c F: include/linux/mdio/mdio-regmap.h +MEAN AND VARIANCE LIBRARY +M: Daniel B. Hill <daniel@gluo.nz> +M: Kent Overstreet <kent.overstreet@linux.dev> +S: Maintained +T: git https://github.com/YellowOnion/linux/ +F: include/linux/mean_and_variance.h +F: lib/math/mean_and_variance.c +F: lib/math/mean_and_variance_test.c + MEASUREMENT COMPUTING CIO-DAC IIO DRIVER M: William Breathitt Gray <william.gray@linaro.org> L: linux-iio@vger.kernel.org diff --git a/fs/bcachefs/Kconfig b/fs/bcachefs/Kconfig index c08c2c7d6fbb..dded24cfa575 100644 --- a/fs/bcachefs/Kconfig +++ b/fs/bcachefs/Kconfig @@ -24,6 +24,7 @@ config BCACHEFS_FS select XXHASH select SRCU select SYMBOLIC_ERRNAME + select MEAN_AND_VARIANCE help The bcachefs filesystem - a modern, copy on write filesystem, with support for multiple devices, compression, checksumming, etc. @@ -72,12 +73,3 @@ config BCACHEFS_NO_LATENCY_ACCT depends on BCACHEFS_FS help This disables device latency tracking and time stats, only for performance testing - -config MEAN_AND_VARIANCE_UNIT_TEST - tristate "mean_and_variance unit tests" if !KUNIT_ALL_TESTS - depends on KUNIT - depends on BCACHEFS_FS - default KUNIT_ALL_TESTS - help - This option enables the kunit tests for mean_and_variance module. - If unsure, say N. diff --git a/fs/bcachefs/Makefile b/fs/bcachefs/Makefile index 45b64f89258c..3eccbcc646aa 100644 --- a/fs/bcachefs/Makefile +++ b/fs/bcachefs/Makefile @@ -57,7 +57,6 @@ bcachefs-y := \ keylist.o \ logged_ops.o \ lru.o \ - mean_and_variance.o \ migrate.o \ move.o \ movinggc.o \ @@ -85,5 +84,3 @@ bcachefs-y := \ util.o \ varint.o \ xattr.o - -obj-$(CONFIG_MEAN_AND_VARIANCE_UNIT_TEST) += mean_and_variance_test.o diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c index 84b142fcc3df..eefe7b42a20a 100644 --- a/fs/bcachefs/util.c +++ b/fs/bcachefs/util.c @@ -22,9 +22,9 @@ #include <linux/string.h> #include <linux/types.h> #include <linux/sched/clock.h> +#include <linux/mean_and_variance.h> #include "eytzinger.h" -#include "mean_and_variance.h" #include "util.h" static const char si_units[] = "?kMGTPEZY"; diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index 2984b57b2958..977e1d9fa453 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h @@ -17,8 +17,7 @@ #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/workqueue.h> - -#include "mean_and_variance.h" +#include <linux/mean_and_variance.h> #include "darray.h" diff --git a/fs/bcachefs/mean_and_variance.h b/include/linux/mean_and_variance.h index 647505010b39..647505010b39 100644 --- a/fs/bcachefs/mean_and_variance.h +++ b/include/linux/mean_and_variance.h diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index ce3a4abf40f8..5a4c7a8e9f07 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2205,6 +2205,15 @@ config CPUMASK_KUNIT_TEST If unsure, say N. +config MEAN_AND_VARIANCE_UNIT_TEST + tristate "mean_and_variance unit tests" if !KUNIT_ALL_TESTS + depends on KUNIT + select MEAN_AND_VARIANCE + default KUNIT_ALL_TESTS + help + This option enables the kunit tests for mean_and_variance module. + If unsure, say N. + config TEST_LIST_SORT tristate "Linked list sorting test" if !KUNIT_ALL_TESTS depends on KUNIT diff --git a/lib/math/Kconfig b/lib/math/Kconfig index 0634b428d0cb..7530ae9a3584 100644 --- a/lib/math/Kconfig +++ b/lib/math/Kconfig @@ -15,3 +15,6 @@ config PRIME_NUMBERS config RATIONAL tristate + +config MEAN_AND_VARIANCE + tristate diff --git a/lib/math/Makefile b/lib/math/Makefile index 91fcdb0c9efe..8cdfa13a67ce 100644 --- a/lib/math/Makefile +++ b/lib/math/Makefile @@ -4,6 +4,8 @@ obj-y += div64.o gcd.o lcm.o int_log.o int_pow.o int_sqrt.o reciprocal_div.o obj-$(CONFIG_CORDIC) += cordic.o obj-$(CONFIG_PRIME_NUMBERS) += prime_numbers.o obj-$(CONFIG_RATIONAL) += rational.o +obj-$(CONFIG_MEAN_AND_VARIANCE) += mean_and_variance.o obj-$(CONFIG_TEST_DIV64) += test_div64.o obj-$(CONFIG_RATIONAL_KUNIT_TEST) += rational-test.o +obj-$(CONFIG_MEAN_AND_VARIANCE_UNIT_TEST) += mean_and_variance_test.o diff --git a/fs/bcachefs/mean_and_variance.c b/lib/math/mean_and_variance.c index 1f0801e2e565..eb5f2ba03b7f 100644 --- a/fs/bcachefs/mean_and_variance.c +++ b/lib/math/mean_and_variance.c @@ -40,10 +40,9 @@ #include <linux/limits.h> #include <linux/math.h> #include <linux/math64.h> +#include <linux/mean_and_variance.h> #include <linux/module.h> -#include "mean_and_variance.h" - u128_u u128_div(u128_u n, u64 d) { u128_u r; diff --git a/fs/bcachefs/mean_and_variance_test.c b/lib/math/mean_and_variance_test.c index 019583c3ca0e..f45591a169d8 100644 --- a/fs/bcachefs/mean_and_variance_test.c +++ b/lib/math/mean_and_variance_test.c @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include <kunit/test.h> - -#include "mean_and_variance.h" +#include <linux/mean_and_variance.h> #define MAX_SQR (SQRT_U64_MAX*SQRT_U64_MAX) |