From 419ab843cabff9a9f9946015259c44d8704eec0a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 29 Aug 2025 15:14:06 +0100 Subject: [PATCH] Rebase to nbdkit 1.45.7 resolves: RHEL-111242 --- ...Add-ONCE-macro-to-run-code-only-once.patch | 272 ------- ...ing.pod-Rearrange-synopsis-to-match-.patch | 38 + ...the-debug-message-on-the-fallback-pa.patch | 38 - ...ument-long-options-and-short-options.patch | 107 +++ ...w-to-probe-for-server-command-line-o.patch | 47 ++ ...try-BLKDISCARD-if-earlier-FALLOC_FL_.patch | 65 -- ...est-once.c-Skip-test-on-macOS-which-.patch | 63 -- ...est-once.c-Further-fixes-for-pthread.patch | 57 -- ...emove-deprecated-cacheextents-filter.patch | 692 ------------------ ...t-count-filter-count-bytes-read-writ.patch | 500 ------------- 0008-count-Clarify-documentation.patch | 41 -- copy-patches.sh | 2 +- nbdkit.spec | 46 +- sources | 4 +- 14 files changed, 222 insertions(+), 1750 deletions(-) delete mode 100644 0001-common-Add-ONCE-macro-to-run-code-only-once.patch create mode 100644 0001-docs-nbdkit-probing.pod-Rearrange-synopsis-to-match-.patch delete mode 100644 0002-file-zero-Print-the-debug-message-on-the-fallback-pa.patch create mode 100644 0002-server-Document-long-options-and-short-options.patch create mode 100644 0003-docs-Document-how-to-probe-for-server-command-line-o.patch delete mode 100644 0003-file-trim-Don-t-try-BLKDISCARD-if-earlier-FALLOC_FL_.patch delete mode 100644 0004-common-include-test-once.c-Skip-test-on-macOS-which-.patch delete mode 100644 0005-common-include-test-once.c-Further-fixes-for-pthread.patch delete mode 100644 0006-Remove-deprecated-cacheextents-filter.patch delete mode 100644 0007-New-filter-nbdkit-count-filter-count-bytes-read-writ.patch delete mode 100644 0008-count-Clarify-documentation.patch diff --git a/0001-common-Add-ONCE-macro-to-run-code-only-once.patch b/0001-common-Add-ONCE-macro-to-run-code-only-once.patch deleted file mode 100644 index 4b34524..0000000 --- a/0001-common-Add-ONCE-macro-to-run-code-only-once.patch +++ /dev/null @@ -1,272 +0,0 @@ -From de37da4184c55c6811dd02707fdd3b1773a7ce66 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Fri, 4 Jul 2025 08:13:48 +0100 -Subject: [PATCH] common: Add ONCE macro to run code only once - -This macro can be used to run code once, especially for debug messages -and similar. eg: - - /* Print this once in the log. */ - ONCE (nbdkit_debug ("falling back to less efficient method")); - -(cherry picked from commit ad8630deab4639e636212f11a5a47d2c34ef2949) ---- - .gitignore | 1 + - common/include/Makefile.am | 6 ++ - common/include/once.h | 67 ++++++++++++++++++++ - common/include/test-once.c | 126 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 200 insertions(+) - create mode 100644 common/include/once.h - create mode 100644 common/include/test-once.c - -diff --git a/.gitignore b/.gitignore -index 3629ef39..827fd53c 100644 ---- a/.gitignore -+++ b/.gitignore -@@ -68,6 +68,7 @@ plugins/*/*.3 - /common/include/test-iszero - /common/include/test-minmax - /common/include/test-nextnonzero -+/common/include/test-once - /common/include/test-random - /common/include/test-tvdiff - /common/protocol/generate-protostrings.sh -diff --git a/common/include/Makefile.am b/common/include/Makefile.am -index ca488e68..3a3757e2 100644 ---- a/common/include/Makefile.am -+++ b/common/include/Makefile.am -@@ -49,6 +49,7 @@ EXTRA_DIST = \ - iszero.h \ - minmax.h \ - nextnonzero.h \ -+ once.h \ - random.h \ - rounding.h \ - static-assert.h \ -@@ -71,6 +72,7 @@ TESTS = \ - test-iszero \ - test-minmax \ - test-nextnonzero \ -+ test-once \ - test-random \ - test-tvdiff \ - $(NULL) -@@ -120,6 +122,10 @@ test_nextnonzero_SOURCES = test-nextnonzero.c nextnonzero.h - test_nextnonzero_CPPFLAGS = -I$(srcdir) - test_nextnonzero_CFLAGS = $(WARNINGS_CFLAGS) - -+test_once_SOURCES = test-once.c once.h -+test_once_CPPFLAGS = -I$(srcdir) -+test_once_CFLAGS = $(WARNINGS_CFLAGS) -+ - test_random_SOURCES = test-random.c random.h - test_random_CPPFLAGS = -I$(srcdir) - test_random_CFLAGS = $(WARNINGS_CFLAGS) -diff --git a/common/include/once.h b/common/include/once.h -new file mode 100644 -index 00000000..bb93e767 ---- /dev/null -+++ b/common/include/once.h -@@ -0,0 +1,67 @@ -+/* nbdkit -+ * Copyright Red Hat -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * * Neither the name of Red Hat nor the names of its contributors may be -+ * used to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ */ -+ -+#ifndef NBDKIT_ONCE_H -+#define NBDKIT_ONCE_H -+ -+#ifdef HAVE_STDATOMIC_H -+#include -+#else -+/* This is best effort on platforms that don't support atomic. -+ * 32 bit ints are generally fine in reality. -+ */ -+#define _Atomic /**/ -+#endif -+ -+#include "unique-name.h" -+ -+/* Run the statement once (per nbdkit run). */ -+#define ONCE(stmt) ONCE_1(NBDKIT_UNIQUE_NAME(_once), (stmt)) -+ -+/* The actual implementation: -+ * -+ * The comparison with 0 avoids var wrapping around. Mostly var will -+ * only be 0 or 1, or in rare cases other small integers. -+ * -+ * The atomic increment & comparison with 1 is what only allows a -+ * single thread to run the statement. -+ * -+ * To avoid optimisations: Use 'volatile' so reads and writes are not -+ * removed, and use 'unsigned' to avoid any with signed overflow. -+ */ -+#define ONCE_1(var, stmt) \ -+ do { \ -+ static volatile _Atomic unsigned var = 0; \ -+ if (var == 0 && ++var == 1) { stmt; } \ -+ } while (0) -+ -+#endif /* NBDKIT_ONCE_H */ -diff --git a/common/include/test-once.c b/common/include/test-once.c -new file mode 100644 -index 00000000..d7dd5c42 ---- /dev/null -+++ b/common/include/test-once.c -@@ -0,0 +1,126 @@ -+/* nbdkit -+ * Copyright Red Hat -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * * Neither the name of Red Hat nor the names of its contributors may be -+ * used to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ */ -+ -+#include -+ -+#include -+#include -+ -+#ifndef HAVE_STDATOMIC_H -+ -+/* Skip the test if no */ -+ -+int -+main (void) -+{ -+ printf ("SKIP: no on this platform\n"); -+ exit (77); -+} -+ -+#else /* HAVE_STDATOMIC_H */ -+ -+#include -+#include -+#include -+ -+#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ -+#include -+ -+#include -+ -+#include "once.h" -+ -+#define NR_THREADS 8 -+ -+static volatile _Atomic unsigned count1 = 0, count2 = 0, -+ count3 = 0, count4 = 0; -+static pthread_barrier_t barrier; -+ -+static void * __attribute__((noreturn)) -+start_thread (void *idxp) -+{ -+ //int idx = * (int*) idxp; -+ -+ pthread_barrier_wait (&barrier); -+ -+ for (;;) { -+ ONCE (count1++); -+ ONCE (count2++); -+ ONCE (count3++); -+ ONCE (count4++); -+ } -+} -+ -+int -+main (void) -+{ -+ int i, err; -+ pthread_t th[NR_THREADS]; -+ int idx[NR_THREADS]; -+ -+ err = pthread_barrier_init (&barrier, NULL, NR_THREADS); -+ if (err != 0) { -+ errno = err; -+ perror ("pthread_barrier_init"); -+ exit (EXIT_FAILURE); -+ } -+ -+ for (i = 0; i < NR_THREADS; ++i) { -+ idx[i] = i; -+ err = pthread_create (&th[i], NULL, start_thread, &idx[i]); -+ if (err != 0) { -+ errno = err; -+ perror ("pthread_create"); -+ exit (EXIT_FAILURE); -+ } -+ } -+ -+ do { -+ sleep (1); -+ } while (count1 + count2 + count3 + count4 < 4); -+ -+ for (i = 0; i < NR_THREADS; ++i) { -+ pthread_cancel (th[i]); -+ } -+ -+ pthread_barrier_destroy (&barrier); -+ -+ if (count1 != 1 || count2 != 1 || count3 != 1 || count4 != 1) { -+ fprintf (stderr, "FAIL: counts incremented to %u %u %u %u " -+ "(expected 1 1 1 1)\n", count1, count2, count3, count4); -+ exit (EXIT_FAILURE); -+ } -+ -+ exit (EXIT_SUCCESS); -+} -+ -+#endif /* HAVE_STDATOMIC_H */ --- -2.47.1 - diff --git a/0001-docs-nbdkit-probing.pod-Rearrange-synopsis-to-match-.patch b/0001-docs-nbdkit-probing.pod-Rearrange-synopsis-to-match-.patch new file mode 100644 index 0000000..7e8b951 --- /dev/null +++ b/0001-docs-nbdkit-probing.pod-Rearrange-synopsis-to-match-.patch @@ -0,0 +1,38 @@ +From 503d91e78231a5bdbc9e2f4238cda5d6c347bb5c Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 26 Aug 2025 21:48:33 +0100 +Subject: [PATCH] docs/nbdkit-probing.pod: Rearrange synopsis to match + description + +--- + docs/nbdkit-probing.pod | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/docs/nbdkit-probing.pod b/docs/nbdkit-probing.pod +index 1c094b7b..070a793b 100644 +--- a/docs/nbdkit-probing.pod ++++ b/docs/nbdkit-probing.pod +@@ -4,16 +4,16 @@ nbdkit-probing - how to probe for nbdkit configuration and plugins + + =head1 SYNOPSIS + ++ nbdkit --version ++ ++=for paragraph ++ + nbdkit --dump-config + + =for paragraph + + nbdkit PLUGIN --dump-plugin + +-=for paragraph +- +- nbdkit --version +- + =for paragraph + + nbdkit PLUGIN --version +-- +2.47.1 + diff --git a/0002-file-zero-Print-the-debug-message-on-the-fallback-pa.patch b/0002-file-zero-Print-the-debug-message-on-the-fallback-pa.patch deleted file mode 100644 index 2c0ef9a..0000000 --- a/0002-file-zero-Print-the-debug-message-on-the-fallback-pa.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 56dba3f1fe87f119e05b74787197ec776ef2692d Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Fri, 4 Jul 2025 08:20:43 +0100 -Subject: [PATCH] file: zero: Print the debug message on the fallback path once - -Use the new ONCE() macro to print the debug message when we fall back -to emulating zero only once. (Actually the core server code contains -a similar message so we probably don't need this at all.) - -(cherry picked from commit fbb5d8211bf4c30144d01be80720e1a63ecd6e81) ---- - plugins/file/file.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/plugins/file/file.c b/plugins/file/file.c -index 9c43ff24..b881da37 100644 ---- a/plugins/file/file.c -+++ b/plugins/file/file.c -@@ -71,6 +71,7 @@ - #include "isaligned.h" - #include "ispowerof2.h" - #include "minmax.h" -+#include "once.h" - #include "utils.h" - - static enum { -@@ -1165,7 +1166,7 @@ file_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags) - - /* Trigger a fall back to writing */ - if (file_debug_zero) -- nbdkit_debug ("zero falling back to writing"); -+ ONCE (nbdkit_debug ("%s: zero falling back to writing", h->name)); - errno = EOPNOTSUPP; - return -1; - --- -2.47.1 - diff --git a/0002-server-Document-long-options-and-short-options.patch b/0002-server-Document-long-options-and-short-options.patch new file mode 100644 index 0000000..870b36e --- /dev/null +++ b/0002-server-Document-long-options-and-short-options.patch @@ -0,0 +1,107 @@ +From 7b6fb980a8cddd2c405a73d7be0967e884ab0410 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 26 Aug 2025 21:30:23 +0100 +Subject: [PATCH] server: Document --long-options and --short-options + +These command line options can be used to list the short (ie. single +letter) and long options supported by nbdkit. They are used +internally to implement bash completions. For example: + + $ nbdkit --short-options + -4 + -6 + -D + -e + [etc] + +Previously they were undocumented and hidden from the --help output, +and did not even appear in the output of 'nbdkit --long-options'. + +However the options have been around for a long time and aren't going +anywhere, and have a well-defined interface and scoped usage, so we +can safely document them. They can also be used to find out what +options are supported by a particular build of nbdkit (see subsequent +commit). +--- + docs/nbdkit.pod | 14 ++++++++++++++ + docs/synopsis.txt | 10 +++++----- + server/main.c | 7 ++----- + 3 files changed, 21 insertions(+), 10 deletions(-) + +diff --git a/docs/nbdkit.pod b/docs/nbdkit.pod +index 82939e88..bf6788bb 100644 +--- a/docs/nbdkit.pod ++++ b/docs/nbdkit.pod +@@ -338,6 +338,13 @@ L or L. + Debug messages (I<-v>/I<--verbose>) always go to standard error and + are never sent to the system log. + ++=item B<--long-options> ++ ++List the long command line options (those starting with I<-->) ++supported by this build of nbdkit. The options are listed one per ++line, and then nbdkit exits. This is used mainly to implement tab ++completion. See also I<--short-options>. ++ + =item B<--mask-handshake=>MASK + + This option can be used to mask off particular global features which +@@ -466,6 +473,13 @@ that the socket and filesystem labels are different. + nbdkit -U /tmp/sock --selinux-label=system_u:object_r:svirt_socket_t:s0 ... + chcon system_u:object_r:svirt_image_t:s0 /tmp/sock + ++=item B<--short-options> ++ ++List the short command line options (single letter options starting ++with I<->) supported by this build of nbdkit. The options are listed ++one per line, and then nbdkit exits. This is used mainly to implement ++tab completion. See also I<--long-options>. ++ + =item B<-s> + + =item B<--single> +diff --git a/docs/synopsis.txt b/docs/synopsis.txt +index 0d25c42d..3cc620db 100644 +--- a/docs/synopsis.txt ++++ b/docs/synopsis.txt +@@ -4,14 +4,14 @@ nbdkit [-4|--ipv4-only] [-6|--ipv6-only] + [--filter=FILTER ...] [-f|--foreground] + [-g|--group GROUP] [-i|--ipaddr IPADDR] [--keepalive] + [--log=default|stderr|syslog|null|/path] +- [--mask-handshake=MASK] [--name=NAME] [-n|--newstyle] +- [--no-mc|--no-meta-contexts] ++ [--long-options] [--mask-handshake=MASK] [--name=NAME] ++ [-n|--newstyle] [--no-mc|--no-meta-contexts] + [--no-sr|--no-structured-replies] [-o|--oldstyle] + [-P|--pidfile PIDFILE] [-p|--port PORT] [--print-uri] + [-r|--readonly] [--run 'COMMAND ARGS ...'] +- [--selinux-label=LABEL] [-s|--single] [--swap] +- [-t|--threads THREADS] [--timeout=TIMEOUT] +- [--tls=off|on|require] ++ [--selinux-label=LABEL] [--short-options] ++ [-s|--single] [--swap] [-t|--threads THREADS] ++ [--timeout=TIMEOUT] [--tls=off|on|require] + [--tls-certificates=/path/to/certificates] + [--tls-psk=/path/to/pskfile] [--tls-verify-peer] + [-U|--unix SOCKET|-] [-u|--user USER] +diff --git a/server/main.c b/server/main.c +index 91e3172b..ad0e5abe 100644 +--- a/server/main.c ++++ b/server/main.c +@@ -404,11 +404,8 @@ main (int argc, char *argv[]) + break; + + case LONG_OPTIONS_OPTION: +- for (i = 0; long_options[i].name != NULL; ++i) { +- if (strcmp (long_options[i].name, "long-options") != 0 && +- strcmp (long_options[i].name, "short-options") != 0) +- printf ("--%s\n", long_options[i].name); +- } ++ for (i = 0; long_options[i].name != NULL; ++i) ++ printf ("--%s\n", long_options[i].name); + cleanup_random_fifo (); + exit (EXIT_SUCCESS); + +-- +2.47.1 + diff --git a/0003-docs-Document-how-to-probe-for-server-command-line-o.patch b/0003-docs-Document-how-to-probe-for-server-command-line-o.patch new file mode 100644 index 0000000..f5f761f --- /dev/null +++ b/0003-docs-Document-how-to-probe-for-server-command-line-o.patch @@ -0,0 +1,47 @@ +From 8788b177b342e9f713ed87864e8fed333c8252e6 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 26 Aug 2025 21:45:09 +0100 +Subject: [PATCH] docs: Document how to probe for server command line options + +Virt-v2v has started to use this method to probe for the new --name +option, so we should document the method. +--- + docs/nbdkit-probing.pod | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/docs/nbdkit-probing.pod b/docs/nbdkit-probing.pod +index 070a793b..8ce506e0 100644 +--- a/docs/nbdkit-probing.pod ++++ b/docs/nbdkit-probing.pod +@@ -10,6 +10,12 @@ nbdkit-probing - how to probe for nbdkit configuration and plugins + + nbdkit --dump-config + ++=for paragraph ++ ++ nbdkit --short-options ++ ++ nbdkit --long-options ++ + =for paragraph + + nbdkit PLUGIN --dump-plugin +@@ -76,6 +82,15 @@ earlier versions. + You can also probe the minimum version using L. See + L. + ++=head2 Find out if nbdkit implements a command line option ++ ++To test if a specific single letter option (like I<-D>) or long option ++(like I<--name>) is supported by nbdkit, use: ++ ++ nbdkit --short-options | grep -sq '^-D$' ++ ++ nbdkit --long-options | grep -sq '^--name$' ++ + =head2 Query information about a particular plugin + + nbdkit pluginname --dump-plugin +-- +2.47.1 + diff --git a/0003-file-trim-Don-t-try-BLKDISCARD-if-earlier-FALLOC_FL_.patch b/0003-file-trim-Don-t-try-BLKDISCARD-if-earlier-FALLOC_FL_.patch deleted file mode 100644 index 67a288c..0000000 --- a/0003-file-trim-Don-t-try-BLKDISCARD-if-earlier-FALLOC_FL_.patch +++ /dev/null @@ -1,65 +0,0 @@ -From c9132973f88015586aa847ffcaa96e86bb23776f Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Fri, 4 Jul 2025 08:14:55 +0100 -Subject: [PATCH] file: trim: Don't try BLKDISCARD if earlier - FALLOC_FL_PUNCH_HOLE worked - -In file_zero, we test if the operations we are trying succeed and if -so jump to a single 'out:' label where we deal with the success path -out of that function. - -We did not do the same thing in file_trim. Thus in the case where -FALLOC_FL_PUNCH_HOLE succeeds, we might fall through to trying -BLKDISCARD as well. As it happens we probably don't do this (at -least, in Linux) because we only try BLKDISCARD for block devices, and -FALLOC_FL_PUNCH_HOLE does not work on those. But it's a good thing to -clean up this code anyway, especially if we were to add more cases in -future. - -This also adds a debug message if none of the trim methods worked, -which is also analogous to what happens in the same part of file_zero. - -(cherry picked from commit 909e483c121c69e6b2759ef9d5401eb3d5acc998) ---- - plugins/file/file.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/plugins/file/file.c b/plugins/file/file.c -index b881da37..66d03d4f 100644 ---- a/plugins/file/file.c -+++ b/plugins/file/file.c -@@ -1191,6 +1191,7 @@ file_trim (void *handle, uint32_t count, uint64_t offset, uint32_t flags) - - r = do_fallocate (h->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, - offset, count); -+ if (r == 0) goto out; - if (r == -1) { - if (!is_enotsup (errno)) { - nbdkit_error ("fallocate: %s: offset=%" PRIu64 ", count=%" PRIu32 ":" -@@ -1214,6 +1215,7 @@ file_trim (void *handle, uint32_t count, uint64_t offset, uint32_t flags) - uint64_t range[2] = {offset, count}; - - r = ioctl (h->fd, BLKDISCARD, &range); -+ if (r == 0) goto out; - if (r == -1) { - if (!is_enotsup (errno)) { - nbdkit_error ("ioctl: %s: offset=%" PRIu64 ", count=%" PRIu32 ":" -@@ -1227,6 +1229,15 @@ file_trim (void *handle, uint32_t count, uint64_t offset, uint32_t flags) - } - #endif - -+ /* Trim is advisory. If we got here, we were unable to trim. */ -+ ONCE (nbdkit_debug ("%s: could not trim, no trim methods worked", -+ h->name)); -+ return 0; -+ -+#ifdef __clang__ -+ __attribute__ ((unused)) -+#endif -+ out: - if ((flags & NBDKIT_FLAG_FUA) && file_flush (handle, 0) == -1) - return -1; - --- -2.47.1 - diff --git a/0004-common-include-test-once.c-Skip-test-on-macOS-which-.patch b/0004-common-include-test-once.c-Skip-test-on-macOS-which-.patch deleted file mode 100644 index 0eae34c..0000000 --- a/0004-common-include-test-once.c-Skip-test-on-macOS-which-.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 48869f1c0b6e4c318b680f6f672a9f90dfe31bff Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 8 Jul 2025 21:39:04 +0100 -Subject: [PATCH] common/include/test-once.c: Skip test on macOS which lacks - pthread_barrier_t - -See: -https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap02.html -(cherry picked from commit 8271f9244f1521c716460820d8162e7641018674) ---- - common/include/test-once.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/common/include/test-once.c b/common/include/test-once.c -index d7dd5c42..512b1a20 100644 ---- a/common/include/test-once.c -+++ b/common/include/test-once.c -@@ -34,29 +34,29 @@ - - #include - #include -+#include -+#include - --#ifndef HAVE_STDATOMIC_H -+#if !defined(HAVE_STDATOMIC_H) || !defined(_POSIX_BARRIERS) - --/* Skip the test if no */ -+/* Skip the test if no or pthread_barrier_t */ - - int - main (void) - { -- printf ("SKIP: no on this platform\n"); -+ fprintf (stderr, -+ "SKIP: no or pthread_barrier_t on this platform\n"); - exit (77); - } - --#else /* HAVE_STDATOMIC_H */ -+#else - - #include - #include --#include - - #undef NDEBUG /* Keep test strong even for nbdkit built without assertions */ - #include - --#include -- - #include "once.h" - - #define NR_THREADS 8 -@@ -123,4 +123,4 @@ main (void) - exit (EXIT_SUCCESS); - } - --#endif /* HAVE_STDATOMIC_H */ -+#endif --- -2.47.1 - diff --git a/0005-common-include-test-once.c-Further-fixes-for-pthread.patch b/0005-common-include-test-once.c-Further-fixes-for-pthread.patch deleted file mode 100644 index cb62f98..0000000 --- a/0005-common-include-test-once.c-Further-fixes-for-pthread.patch +++ /dev/null @@ -1,57 +0,0 @@ -From f694d06d432d10699e26b2234f7a285fc018e94c Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 9 Jul 2025 12:20:34 +0100 -Subject: [PATCH] common/include/test-once.c: Further fixes for - pthread_barrier_t - -macOS defines _POSIX_BARRIERS but turns out to lack any implementation -of pthread_barrier_t. WTF. - -FreeBSD requires linking with pthread else we get: - - ld: error: undefined symbol: pthread_barrier_init - -Fixes: commit ad8630deab4639e636212f11a5a47d2c34ef2949 -Fixes: commit 8271f9244f1521c716460820d8162e7641018674 -(cherry picked from commit 0d0e2b3d49cf8c9aa8cd37bb36b7002eb4624a2c) ---- - common/include/Makefile.am | 3 ++- - common/include/test-once.c | 7 +++++-- - 2 files changed, 7 insertions(+), 3 deletions(-) - -diff --git a/common/include/Makefile.am b/common/include/Makefile.am -index 3a3757e2..00a01091 100644 ---- a/common/include/Makefile.am -+++ b/common/include/Makefile.am -@@ -124,7 +124,8 @@ test_nextnonzero_CFLAGS = $(WARNINGS_CFLAGS) - - test_once_SOURCES = test-once.c once.h - test_once_CPPFLAGS = -I$(srcdir) --test_once_CFLAGS = $(WARNINGS_CFLAGS) -+test_once_CFLAGS = $(WARNINGS_CFLAGS) $(PTHREAD_CFLAGS) -+test_once_LDFLAGS = $(PTHREAD_LIBS) - - test_random_SOURCES = test-random.c random.h - test_random_CPPFLAGS = -I$(srcdir) -diff --git a/common/include/test-once.c b/common/include/test-once.c -index 512b1a20..304d512a 100644 ---- a/common/include/test-once.c -+++ b/common/include/test-once.c -@@ -37,9 +37,12 @@ - #include - #include - --#if !defined(HAVE_STDATOMIC_H) || !defined(_POSIX_BARRIERS) -+#if !defined(HAVE_STDATOMIC_H) || !defined(_POSIX_BARRIERS) || \ -+ defined(__APPLE__) - --/* Skip the test if no or pthread_barrier_t */ -+/* Skip the test if no or pthread_barrier_t or on macOS -+ * which defines _POSIX_BARRIERS but doesn't actually have them. -+ */ - - int - main (void) --- -2.47.1 - diff --git a/0006-Remove-deprecated-cacheextents-filter.patch b/0006-Remove-deprecated-cacheextents-filter.patch deleted file mode 100644 index 4953728..0000000 --- a/0006-Remove-deprecated-cacheextents-filter.patch +++ /dev/null @@ -1,692 +0,0 @@ -From dc8c6aae6aa1c62083421e2b2ce2988e970f2579 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 1 Jul 2025 13:26:08 +0100 -Subject: [PATCH] Remove deprecated cacheextents filter - -This is removed along the development branch (1.45) and in the next -stable version of nbdkit (1.46). - -(cherry picked from commit 886050f6de9179b0e267e15b20376313090b2d3c) ---- - configure.ac | 2 - - docs/nbdkit-protocol.pod | 9 +- - docs/nbdkit-release-notes-1.14.pod | 2 +- - docs/nbdkit-release-notes-1.44.pod | 2 +- - filters/cache/nbdkit-cache-filter.pod | 8 +- - filters/cacheextents/Makefile.am | 74 ------ - filters/cacheextents/cacheextents.c | 212 ------------------ - .../nbdkit-cacheextents-filter.pod | 76 ------- - filters/cow/nbdkit-cow-filter.pod | 1 - - .../extentlist/nbdkit-extentlist-filter.pod | 1 - - tests/Makefile.am | 4 - - tests/test-cacheextents.sh | 114 ---------- - 12 files changed, 9 insertions(+), 496 deletions(-) - delete mode 100644 filters/cacheextents/Makefile.am - delete mode 100644 filters/cacheextents/cacheextents.c - delete mode 100644 filters/cacheextents/nbdkit-cacheextents-filter.pod - delete mode 100755 tests/test-cacheextents.sh - -diff --git a/configure.ac b/configure.ac -index 0dca333f..9b057e6f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -143,7 +143,6 @@ filters="\ - blocksize-policy \ - bzip2 \ - cache \ -- cacheextents \ - checkwrite \ - cow \ - ddrescue \ -@@ -1787,7 +1786,6 @@ AC_CONFIG_FILES([Makefile - filters/blocksize-policy/Makefile - filters/bzip2/Makefile - filters/cache/Makefile -- filters/cacheextents/Makefile - filters/checkwrite/Makefile - filters/cow/Makefile - filters/ddrescue/Makefile -diff --git a/docs/nbdkit-protocol.pod b/docs/nbdkit-protocol.pod -index ef1934fd..93f5c5fa 100644 ---- a/docs/nbdkit-protocol.pod -+++ b/docs/nbdkit-protocol.pod -@@ -275,14 +275,13 @@ filters do not work properly in this case. - blocksize-policy Yes - bzip2 No - cache No -- cacheextents No - checkwrite Yes - cow Yes, since 1.44 - delay Yes - error Yes - evil Yes -- - exitlast Yes -+ - exitwhen Yes - exportname Yes - ext2 No -@@ -292,8 +291,8 @@ filters do not work properly in this case. - ip Yes - limit Yes - log Yes -- - luks No -+ - lzip No - multi-conn Yes - nocache Yes -@@ -303,8 +302,8 @@ filters do not work properly in this case. - nozero Yes - offset Yes, but unlikely to be useful - openonce Yes -- - partition No -+ - pause Yes - protect Yes, but unlikely to be useful - qcow2dec No -@@ -314,8 +313,8 @@ filters do not work properly in this case. - retry Yes - retry-request Yes - rotational Yes -- - scan Yes -+ - spinning Yes - stats Yes - swab Yes -diff --git a/docs/nbdkit-release-notes-1.14.pod b/docs/nbdkit-release-notes-1.14.pod -index 627e7e88..3c8c5d53 100644 ---- a/docs/nbdkit-release-notes-1.14.pod -+++ b/docs/nbdkit-release-notes-1.14.pod -@@ -50,7 +50,7 @@ plugin’s own choice of thread model. Used to determine how the thread - model affects performance, or to serialize plugins if required (Eric - Blake). - --New L to cache extents requests, -+New nbdkit-cacheextents-filter to cache extents requests, - especially useful with VDDK which has a slow implementation of extents - (Martin Kletzander). - -diff --git a/docs/nbdkit-release-notes-1.44.pod b/docs/nbdkit-release-notes-1.44.pod -index 62d69aa5..e5872763 100644 ---- a/docs/nbdkit-release-notes-1.44.pod -+++ b/docs/nbdkit-release-notes-1.44.pod -@@ -59,7 +59,7 @@ eg. C<@4M> to move the offset to 4194304 (Eric Blake). - New L which can be used to open the - underlying plugin once, sharing the plugin across connections. - --L I, and is -+I, and is - expected to be removed in S. - - L now understands that the NBD protocol export -diff --git a/filters/cache/nbdkit-cache-filter.pod b/filters/cache/nbdkit-cache-filter.pod -index ffa86919..7a64ca66 100644 ---- a/filters/cache/nbdkit-cache-filter.pod -+++ b/filters/cache/nbdkit-cache-filter.pod -@@ -29,10 +29,9 @@ does not have effective caching, or (with C) to defeat - flush requests from the client (which is unsafe and can cause data - loss, as the name suggests). - --This filter only caches image contents. To cache image metadata, use --L between this filter and the plugin. --To accelerate sequential reads, use L or --L on top of this filter. -+This filter only caches image contents. To accelerate sequential -+reads, use L or L -+on top of this filter. - - =head1 PARAMETERS - -@@ -181,7 +180,6 @@ C first appeared in nbdkit 1.2. - - L, - L, --L, - L, - L, - L, -diff --git a/filters/cacheextents/Makefile.am b/filters/cacheextents/Makefile.am -deleted file mode 100644 -index 26ac6642..00000000 ---- a/filters/cacheextents/Makefile.am -+++ /dev/null -@@ -1,74 +0,0 @@ --# nbdkit --# Copyright Red Hat --# --# Redistribution and use in source and binary forms, with or without --# modification, are permitted provided that the following conditions are --# met: --# --# * Redistributions of source code must retain the above copyright --# notice, this list of conditions and the following disclaimer. --# --# * Redistributions in binary form must reproduce the above copyright --# notice, this list of conditions and the following disclaimer in the --# documentation and/or other materials provided with the distribution. --# --# * Neither the name of Red Hat nor the names of its contributors may be --# used to endorse or promote products derived from this software without --# specific prior written permission. --# --# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND --# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, --# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR --# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF --# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND --# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, --# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT --# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF --# SUCH DAMAGE. -- --include $(top_srcdir)/common-rules.mk -- --EXTRA_DIST = nbdkit-cacheextents-filter.pod -- --filter_LTLIBRARIES = nbdkit-cacheextents-filter.la -- --nbdkit_cacheextents_filter_la_SOURCES = \ -- cacheextents.c \ -- $(top_srcdir)/include/nbdkit-filter.h \ -- $(NULL) -- --nbdkit_cacheextents_filter_la_CPPFLAGS = \ -- -I$(top_srcdir)/include \ -- -I$(top_builddir)/include \ -- -I$(top_srcdir)/common/include \ -- -I$(top_srcdir)/common/utils \ -- $(NULL) --nbdkit_cacheextents_filter_la_CFLAGS = $(WARNINGS_CFLAGS) --nbdkit_cacheextents_filter_la_LDFLAGS = \ -- -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ -- $(NULL) --if USE_LINKER_SCRIPT --nbdkit_cacheextents_filter_la_LDFLAGS += \ -- -Wl,--version-script=$(top_srcdir)/filters/filters.syms --endif --nbdkit_cacheextents_filter_la_LIBADD = \ -- $(top_builddir)/common/utils/libutils.la \ -- $(top_builddir)/common/replacements/libcompat.la \ -- $(IMPORT_LIBRARY_ON_WINDOWS) \ -- $(NULL) -- --if HAVE_POD -- --man_MANS = nbdkit-cacheextents-filter.1 --CLEANFILES += $(man_MANS) -- --nbdkit-cacheextents-filter.1: nbdkit-cacheextents-filter.pod \ -- $(top_builddir)/podwrapper.pl -- $(PODWRAPPER) --section=1 --man $@ \ -- --html $(top_builddir)/html/$@.html \ -- $< -- --endif HAVE_POD -diff --git a/filters/cacheextents/cacheextents.c b/filters/cacheextents/cacheextents.c -deleted file mode 100644 -index 71f73c41..00000000 ---- a/filters/cacheextents/cacheextents.c -+++ /dev/null -@@ -1,212 +0,0 @@ --/* nbdkit -- * Copyright Red Hat -- * -- * Redistribution and use in source and binary forms, with or without -- * modification, are permitted provided that the following conditions are -- * met: -- * -- * * Redistributions of source code must retain the above copyright -- * notice, this list of conditions and the following disclaimer. -- * -- * * Redistributions in binary form must reproduce the above copyright -- * notice, this list of conditions and the following disclaimer in the -- * documentation and/or other materials provided with the distribution. -- * -- * * Neither the name of Red Hat nor the names of its contributors may be -- * used to endorse or promote products derived from this software without -- * specific prior written permission. -- * -- * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -- * SUCH DAMAGE. -- */ -- --#include -- --#include --#include --#include --#include --#include --#include -- --#include -- --#include -- --#include "cleanup.h" -- --/* -D cacheextents.cache=1: Debug cache operations. */ --NBDKIT_DLL_PUBLIC int cacheextents_debug_cache = 0; -- --/* This lock protects the global state. */ --static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; -- --/* Cached extents from the last extents () call and its start and end -- * for the sake of simplicity. -- */ --struct nbdkit_extents *cache_extents; --static uint64_t cache_start; --static uint64_t cache_end; -- --static void --cacheextents_unload (void) --{ -- nbdkit_extents_free (cache_extents); --} -- --static int --cacheextents_add (struct nbdkit_extents *extents, int *err) --{ -- size_t i = 0; -- -- for (i = 0; i < nbdkit_extents_count (cache_extents); i++) { -- struct nbdkit_extent ex = nbdkit_get_extent (cache_extents, i); -- if (nbdkit_add_extent (extents, ex.offset, ex.length, ex.type) == -1) { -- *err = errno; -- return -1; -- } -- } -- -- return 0; --} -- --static int --fill (struct nbdkit_extents *extents, int *err) --{ -- size_t i = 0; -- size_t count = nbdkit_extents_count (extents); -- struct nbdkit_extent first = nbdkit_get_extent (extents, 0); -- struct nbdkit_extent last = nbdkit_get_extent (extents, count - 1); -- -- nbdkit_extents_free (cache_extents); -- cache_start = first.offset; -- cache_end = last.offset + last.length; -- cache_extents = nbdkit_extents_new (cache_start, cache_end); -- -- if (!cache_extents) -- return -1; -- -- for (i = 0; i < count; i++) { -- struct nbdkit_extent ex = nbdkit_get_extent (extents, i); -- -- if (cacheextents_debug_cache) -- nbdkit_debug ("cacheextents: updating cache with:" -- " offset=%" PRIu64 -- " length=%" PRIu64 -- " type=%x", -- ex.offset, ex.length, ex.type); -- -- if (nbdkit_add_extent (cache_extents, ex.offset, ex.length, -- ex.type) == -1) { -- *err = errno; -- nbdkit_extents_free (cache_extents); -- cache_extents = NULL; -- return -1; -- } -- } -- -- return 0; --} -- --static int --cacheextents_extents (nbdkit_next *next, -- void *handle, uint32_t count, uint64_t offset, -- uint32_t flags, -- struct nbdkit_extents *extents, -- int *err) --{ -- ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); -- -- if (cacheextents_debug_cache) -- nbdkit_debug ("cacheextents:" -- " cache_start=%" PRIu64 -- " cache_end=%" PRIu64 -- " cache_extents=%p", -- cache_start, cache_end, cache_extents); -- -- if (cache_extents && -- offset >= cache_start && offset < cache_end) { -- if (cacheextents_debug_cache) -- nbdkit_debug ("cacheextents: returning from cache"); -- return cacheextents_add (extents, err); -- } -- -- if (cacheextents_debug_cache) -- nbdkit_debug ("cacheextents: cache miss"); -- -- /* Clear REQ_ONE to ask the plugin for as much information as it is -- * willing to return (the plugin may still truncate if it is too -- * costly to provide everything). -- */ -- flags &= ~(NBDKIT_FLAG_REQ_ONE); -- if (next->extents (next, count, offset, flags, extents, err) == -1) -- return -1; -- -- return fill (extents, err); --} -- --/* Any changes to the data needs to clean the cache. -- * -- * Similar to the readahead filter this could be more intelligent, but -- * there would be very little benefit. -- */ -- --static void --kill_cacheextents (void) --{ -- ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); -- nbdkit_extents_free (cache_extents); -- cache_extents = NULL; --} -- --static int --cacheextents_pwrite (nbdkit_next *next, -- void *handle, -- const void *buf, uint32_t count, uint64_t offset, -- uint32_t flags, int *err) --{ -- kill_cacheextents (); -- return next->pwrite (next, buf, count, offset, flags, err); --} -- --static int --cacheextents_trim (nbdkit_next *next, -- void *handle, -- uint32_t count, uint64_t offset, uint32_t flags, -- int *err) --{ -- kill_cacheextents (); -- return next->trim (next, count, offset, flags, err); --} -- --static int --cacheextents_zero (nbdkit_next *next, -- void *handle, -- uint32_t count, uint64_t offset, uint32_t flags, -- int *err) --{ -- kill_cacheextents (); -- return next->zero (next, count, offset, flags, err); --} -- --static struct nbdkit_filter filter = { -- .name = "cacheextents", -- .longname = "nbdkit cacheextents filter", -- .unload = cacheextents_unload, -- .pwrite = cacheextents_pwrite, -- .trim = cacheextents_trim, -- .zero = cacheextents_zero, -- .extents = cacheextents_extents, --}; -- --NBDKIT_REGISTER_FILTER (filter) -diff --git a/filters/cacheextents/nbdkit-cacheextents-filter.pod b/filters/cacheextents/nbdkit-cacheextents-filter.pod -deleted file mode 100644 -index 0693ca80..00000000 ---- a/filters/cacheextents/nbdkit-cacheextents-filter.pod -+++ /dev/null -@@ -1,76 +0,0 @@ --=head1 NAME -- --nbdkit-cacheextents-filter - cache extents -- --=head1 SYNOPSIS -- -- nbdkit --filter=cacheextents plugin -- --=head1 DEPRECATED -- --B 1.43.10> and --will be removed in S>. There is no direct replacement, --but as the filter only worked for a narrow and unusual range of access --patterns it is likely that it has no effect and you can just stop --using it. -- --=head1 DESCRIPTION -- --C is a filter that caches the result of last --extents() call. -- --A common use for this filter is to improve performance when using a --client performing a linear pass over the entire image while asking for --only one extent at a time (such as S>), but where --the plugin can provide multiple extents for the same high latency as a --single extent (such as L). For example: -- -- nbdkit --filter=cacheextents --run 'qemu-img map "$uri"' vddk ... -- --For files with big extents (when it is unlikely for one extents() call --to return multiple different extents) this does not slow down the --access. -- --This filter only caches image metadata; to also cache image contents, --place this filter between L and the plugin. -- --=head1 PARAMETERS -- --There are no parameters specific to nbdkit-cacheextents-filter. Any --parameters are passed through to and processed by the underlying --plugin in the normal way. -- --=head1 FILES -- --=over 4 -- --=item F<$filterdir/nbdkit-cacheextents-filter.so> -- --The filter. -- --Use C to find the location of C<$filterdir>. -- --=back -- --=head1 VERSION -- --C first appeared in nbdkit 1.14. -- --=head1 SEE ALSO -- --L, --L, --L, --L, --L, --L, --L, --L. -- --=head1 AUTHORS -- --Martin Kletzander -- --=head1 COPYRIGHT -- --Copyright Red Hat -diff --git a/filters/cow/nbdkit-cow-filter.pod b/filters/cow/nbdkit-cow-filter.pod -index fd551d93..9462a28d 100644 ---- a/filters/cow/nbdkit-cow-filter.pod -+++ b/filters/cow/nbdkit-cow-filter.pod -@@ -169,7 +169,6 @@ C first appeared in nbdkit 1.2. - L, - L, - L, --L, - L, - L, - L, -diff --git a/filters/extentlist/nbdkit-extentlist-filter.pod b/filters/extentlist/nbdkit-extentlist-filter.pod -index d5ac81eb..44c81635 100644 ---- a/filters/extentlist/nbdkit-extentlist-filter.pod -+++ b/filters/extentlist/nbdkit-extentlist-filter.pod -@@ -85,7 +85,6 @@ C first appeared in nbdkit 1.18. - =head1 SEE ALSO - - L, --L, - L, - L, - L. -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 6d94c327..c16b5912 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -1694,10 +1694,6 @@ EXTRA_DIST += \ - test-cache-unaligned.sh \ - $(NULL) - --# cacheextents filter test. --TESTS += test-cacheextents.sh --EXTRA_DIST += test-cacheextents.sh -- - # checkwrite filter test. - TESTS += \ - test-checkwrite.sh \ -diff --git a/tests/test-cacheextents.sh b/tests/test-cacheextents.sh -deleted file mode 100755 -index 34d66217..00000000 ---- a/tests/test-cacheextents.sh -+++ /dev/null -@@ -1,114 +0,0 @@ --#!/usr/bin/env bash --# nbdkit --# Copyright Red Hat --# --# Redistribution and use in source and binary forms, with or without --# modification, are permitted provided that the following conditions are --# met: --# --# * Redistributions of source code must retain the above copyright --# notice, this list of conditions and the following disclaimer. --# --# * Redistributions in binary form must reproduce the above copyright --# notice, this list of conditions and the following disclaimer in the --# documentation and/or other materials provided with the distribution. --# --# * Neither the name of Red Hat nor the names of its contributors may be --# used to endorse or promote products derived from this software without --# specific prior written permission. --# --# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND --# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, --# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR --# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF --# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND --# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, --# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT --# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF --# SUCH DAMAGE. -- --source ./functions.sh --set -x --set -u --set -e -- --requires_plugin sh --requires_filter cacheextents --requires grep --version --requires qemu-io --version --requires dd iflag=count_bytes >$accessfile_full --size=4M --block_size=$((1024*1024)) --case "$1" in -- thread_model) echo parallel ;; -- get_size) echo $size ;; -- can_extents) ;; -- extents) -- echo "extents request: $@" >>$accessfile_full -- offset=$(($4 / $block_size)) -- count=$(($3 / $block_size)) -- length=$(($offset + $count)) -- for i in $(seq $offset $length); do -- echo ${i}M $block_size $((i%4)) >>$accessfile_full -- echo ${i}M $block_size $((i%4)) -- done -- ;; -- pread) dd if=/dev/zero count=$3 iflag=count_bytes ;; -- can_write) ;; -- pwrite) dd of=/dev/null ;; -- can_trim) ;; -- trim) ;; -- can_zero) ;; -- zero) ;; -- *) exit 2 ;; --esac --EOF -- --export accessfile_full --start_nbdkit \ -- -P $pidfile \ -- -U $sock \ -- --filter=cacheextents \ -- sh - <<<"$plugin" -- --test_me() { -- num_accesses=$1 -- shift -- -- qemu-io -f raw "$@" "$sockurl" -- test "$(grep -c "^extents request: " $accessfile)" -eq "$num_accesses" -- ret=$? -- rm -f "$accessfile" -- return $ret --} -- --# First one causes caching, the rest should be returned from cache. --test_me 1 -c 'map' -c 'map' -c 'map' --# First one is still cached from last time, discard should kill the cache, then --# one request should go through. --test_me 1 -c 'map' -c 'discard 0 1' -c 'map' --# Same as above, only this time the cache is killed before all the operations as --# well. This is used from now on to clear the cache as it seems nicer and --# faster than running new nbdkit for each test. --test_me 2 -c 'discard 0 1' -c 'map' -c 'discard 0 1' -c 'map' --# Write should kill the cache as well. --test_me 2 -c 'discard 0 1' -c 'map' -c 'write 0 1' -c 'map' --# Alloc should use cached data from map --test_me 1 -c 'discard 0 1' -c 'map' -c 'alloc 0' --# Read should not kill the cache --test_me 1 -c 'discard 0 1' -c 'map' -c 'read 0 1' -c 'map' -c 'alloc 0' --- -2.47.1 - diff --git a/0007-New-filter-nbdkit-count-filter-count-bytes-read-writ.patch b/0007-New-filter-nbdkit-count-filter-count-bytes-read-writ.patch deleted file mode 100644 index 832fb98..0000000 --- a/0007-New-filter-nbdkit-count-filter-count-bytes-read-writ.patch +++ /dev/null @@ -1,500 +0,0 @@ -From 9c28df70cbde94e58e448c8953965510e5d952c2 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 8 Jul 2025 17:49:00 +0100 -Subject: [PATCH] New filter: nbdkit-count-filter: count bytes read, written - etc. - -This produces a summary of the number of bytes read, written, etc -through the filter. - -This is mainly of use to virt-v2v where it's commonly asked how much -data was transferred over the wire or written to disk, and we don't -currently have an easy way to answer that. By simply adding this -filter, the numbers will be known from the virt-v2v conversion log. - -(cherry picked from commit 3512c3ce9308b4d940119ac6cc87f1baa9afb655) ---- - configure.ac | 2 + - docs/nbdkit-protocol.pod | 9 +- - filters/count/Makefile.am | 70 ++++++++++++++ - filters/count/count.c | 132 ++++++++++++++++++++++++++ - filters/count/nbdkit-count-filter.pod | 55 +++++++++++ - filters/log/nbdkit-log-filter.pod | 1 + - filters/stats/nbdkit-stats-filter.pod | 3 + - plugins/file/nbdkit-file-plugin.pod | 1 + - tests/Makefile.am | 4 + - tests/test-count.sh | 55 +++++++++++ - 10 files changed, 328 insertions(+), 4 deletions(-) - create mode 100644 filters/count/Makefile.am - create mode 100644 filters/count/count.c - create mode 100644 filters/count/nbdkit-count-filter.pod - create mode 100755 tests/test-count.sh - -diff --git a/configure.ac b/configure.ac -index 9b057e6f..26e59462 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -144,6 +144,7 @@ filters="\ - bzip2 \ - cache \ - checkwrite \ -+ count \ - cow \ - ddrescue \ - delay \ -@@ -1787,6 +1788,7 @@ AC_CONFIG_FILES([Makefile - filters/bzip2/Makefile - filters/cache/Makefile - filters/checkwrite/Makefile -+ filters/count/Makefile - filters/cow/Makefile - filters/ddrescue/Makefile - filters/delay/Makefile -diff --git a/docs/nbdkit-protocol.pod b/docs/nbdkit-protocol.pod -index 93f5c5fa..edf0efb0 100644 ---- a/docs/nbdkit-protocol.pod -+++ b/docs/nbdkit-protocol.pod -@@ -276,12 +276,13 @@ filters do not work properly in this case. - bzip2 No - cache No - checkwrite Yes -+ count Yes - cow Yes, since 1.44 - delay Yes - error Yes - evil Yes -+ - exitlast Yes -- - exitwhen Yes - exportname Yes - ext2 No -@@ -291,8 +292,8 @@ filters do not work properly in this case. - ip Yes - limit Yes - log Yes -+ - luks No -- - lzip No - multi-conn Yes - nocache Yes -@@ -302,8 +303,8 @@ filters do not work properly in this case. - nozero Yes - offset Yes, but unlikely to be useful - openonce Yes -+ - partition No -- - pause Yes - protect Yes, but unlikely to be useful - qcow2dec No -@@ -313,8 +314,8 @@ filters do not work properly in this case. - retry Yes - retry-request Yes - rotational Yes -+ - scan Yes -- - spinning Yes - stats Yes - swab Yes -diff --git a/filters/count/Makefile.am b/filters/count/Makefile.am -new file mode 100644 -index 00000000..20456e17 ---- /dev/null -+++ b/filters/count/Makefile.am -@@ -0,0 +1,70 @@ -+# nbdkit -+# Copyright Red Hat -+# -+# Redistribution and use in source and binary forms, with or without -+# modification, are permitted provided that the following conditions are -+# met: -+# -+# * Redistributions of source code must retain the above copyright -+# notice, this list of conditions and the following disclaimer. -+# -+# * Redistributions in binary form must reproduce the above copyright -+# notice, this list of conditions and the following disclaimer in the -+# documentation and/or other materials provided with the distribution. -+# -+# * Neither the name of Red Hat nor the names of its contributors may be -+# used to endorse or promote products derived from this software without -+# specific prior written permission. -+# -+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+# SUCH DAMAGE. -+ -+include $(top_srcdir)/common-rules.mk -+ -+EXTRA_DIST = nbdkit-count-filter.pod -+ -+filter_LTLIBRARIES = nbdkit-count-filter.la -+ -+nbdkit_count_filter_la_SOURCES = \ -+ count.c \ -+ $(top_srcdir)/include/nbdkit-filter.h \ -+ $(NULL) -+ -+nbdkit_count_filter_la_CPPFLAGS = \ -+ -I$(top_srcdir)/include \ -+ -I$(top_builddir)/include \ -+ $(NULL) -+nbdkit_count_filter_la_CFLAGS = $(WARNINGS_CFLAGS) -+nbdkit_count_filter_la_LDFLAGS = \ -+ -module -avoid-version -shared $(NO_UNDEFINED_ON_WINDOWS) \ -+ $(NULL) -+if USE_LINKER_SCRIPT -+nbdkit_count_filter_la_LDFLAGS += \ -+ -Wl,--version-script=$(top_srcdir)/filters/filters.syms -+endif -+nbdkit_count_filter_la_LIBADD = \ -+ $(IMPORT_LIBRARY_ON_WINDOWS) \ -+ $(NULL) -+ -+if HAVE_POD -+ -+man_MANS = nbdkit-count-filter.1 -+CLEANFILES += $(man_MANS) -+ -+nbdkit-count-filter.1: nbdkit-count-filter.pod \ -+ $(top_builddir)/podwrapper.pl -+ $(PODWRAPPER) --section=1 --man $@ \ -+ --html $(top_builddir)/html/$@.html \ -+ $< -+ -+endif HAVE_POD -diff --git a/filters/count/count.c b/filters/count/count.c -new file mode 100644 -index 00000000..8af7f5a0 ---- /dev/null -+++ b/filters/count/count.c -@@ -0,0 +1,132 @@ -+/* nbdkit -+ * Copyright Red Hat -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * * Neither the name of Red Hat nor the names of its contributors may be -+ * used to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ */ -+ -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include -+ -+#ifdef HAVE_STDATOMIC_H -+#include -+#else -+/* Only used for counting statistics. */ -+#define _Atomic /**/ -+#endif -+ -+static _Atomic uint64_t bytes_read, bytes_written, bytes_zeroed, bytes_trimmed; -+ -+static void -+count_unload (void) -+{ -+ nbdkit_debug ("count bytes: " -+ "read %" PRIu64 ", " -+ "written %" PRIu64 ", " -+ "zeroed %" PRIu64 ", " -+ "trimmed %" PRIu64, -+ bytes_read, bytes_written, bytes_zeroed, bytes_trimmed); -+} -+ -+/* Read data. */ -+static int -+count_pread (nbdkit_next *next, -+ void *handle, -+ void *buf, -+ uint32_t count, uint64_t offset, uint32_t flags, -+ int *err) -+{ -+ int r; -+ -+ r = next->pread (next, buf, count, offset, flags, err); -+ if (r >= 0) -+ bytes_read += count; -+ return r; -+} -+ -+/* Write data. */ -+static int -+count_pwrite (nbdkit_next *next, -+ void *handle, -+ const void *buf, -+ uint32_t count, uint64_t offset, uint32_t flags, -+ int *err) -+{ -+ int r; -+ -+ r = next->pwrite (next, buf, count, offset, flags, err); -+ if (r >= 0) -+ bytes_written += count; -+ return r; -+} -+ -+/* Trim data. */ -+static int -+count_trim (nbdkit_next *next, -+ void *handle, uint32_t count, uint64_t offset, uint32_t flags, -+ int *err) -+{ -+ int r; -+ -+ r = next->trim (next, count, offset, flags, err); -+ if (r >= 0) -+ bytes_trimmed += count; -+ return r; -+} -+ -+/* Zero data. */ -+static int -+count_zero (nbdkit_next *next, -+ void *handle, uint32_t count, uint64_t offset, uint32_t flags, -+ int *err) -+{ -+ int r; -+ -+ r = next->zero (next, count, offset, flags, err); -+ if (r >= 0) -+ bytes_zeroed += count; -+ return r; -+} -+ -+static struct nbdkit_filter filter = { -+ .name = "count", -+ .longname = "nbdkit count filter", -+ .unload = count_unload, -+ .pread = count_pread, -+ .pwrite = count_pwrite, -+ .trim = count_trim, -+ .zero = count_zero, -+}; -+ -+NBDKIT_REGISTER_FILTER (filter) -diff --git a/filters/count/nbdkit-count-filter.pod b/filters/count/nbdkit-count-filter.pod -new file mode 100644 -index 00000000..f0437000 ---- /dev/null -+++ b/filters/count/nbdkit-count-filter.pod -@@ -0,0 +1,55 @@ -+=head1 NAME -+ -+nbdkit-count-filter - count bytes read, written, zeroed and trimmed -+ -+=head1 SYNOPSIS -+ -+ nbdkit --filter=count plugin -+ -+=head1 DESCRIPTION -+ -+C is a filter for L that simply counts -+the number of bytes that are read, written, zeroed and trimmed, and -+reports this number in debugging output when the filter is unloaded -+(usually when nbdkit exits). -+ -+This is a very simple and lightweight filter. For much more -+comprehensive stats about and logging of operations, use -+L or L instead. -+ -+=head1 PARAMETERS -+ -+There are no parameters specific to this filter. All parameters are -+passed through to the underlying plugin. -+ -+=head1 FILES -+ -+=over 4 -+ -+=item F<$filterdir/nbdkit-count-filter.so> -+ -+The filter. -+ -+Use C to find the location of C<$filterdir>. -+ -+=back -+ -+=head1 VERSION -+ -+C first appeared in nbdkit 1.46. -+ -+=head1 SEE ALSO -+ -+L, -+L, -+L, -+L, -+L. -+ -+=head1 AUTHORS -+ -+Richard W.M. Jones -+ -+=head1 COPYRIGHT -+ -+Copyright Red Hat -diff --git a/filters/log/nbdkit-log-filter.pod b/filters/log/nbdkit-log-filter.pod -index b91b60c4..256701a1 100644 ---- a/filters/log/nbdkit-log-filter.pod -+++ b/filters/log/nbdkit-log-filter.pod -@@ -208,6 +208,7 @@ L, - L, - L, - L, -+L, - L. - - =head1 AUTHORS -diff --git a/filters/stats/nbdkit-stats-filter.pod b/filters/stats/nbdkit-stats-filter.pod -index c0d2b45c..10074b4a 100644 ---- a/filters/stats/nbdkit-stats-filter.pod -+++ b/filters/stats/nbdkit-stats-filter.pod -@@ -13,6 +13,8 @@ C is a filter that displays statistics about NBD - operations, such as the number of bytes read and written. Statistics - are written to a file once when nbdkit exits. - -+A lighter weight version of this is L. -+ - =head1 EXAMPLE OUTPUT - - # nbdkit --filter=exitlast --filter=stats memory 25G statsfile=example.txt -@@ -113,6 +115,7 @@ C first appeared in nbdkit 1.14. - - L, - L, -+L, - L. - - =head1 AUTHORS -diff --git a/plugins/file/nbdkit-file-plugin.pod b/plugins/file/nbdkit-file-plugin.pod -index 63d07617..626827b2 100644 ---- a/plugins/file/nbdkit-file-plugin.pod -+++ b/plugins/file/nbdkit-file-plugin.pod -@@ -316,6 +316,7 @@ L, - L, - L, - L, -+L, - L, - L, - L, -diff --git a/tests/Makefile.am b/tests/Makefile.am -index c16b5912..d7053ba2 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -1706,6 +1706,10 @@ EXTRA_DIST += \ - test-checkwrite-fail.sh \ - $(NULL) - -+# count filter test. -+TESTS += test-count.sh -+EXTRA_DIST += test-count.sh -+ - # cow filter test. - if HAVE_MKE2FS_WITH_D - TESTS += \ -diff --git a/tests/test-count.sh b/tests/test-count.sh -new file mode 100755 -index 00000000..e2e10704 ---- /dev/null -+++ b/tests/test-count.sh -@@ -0,0 +1,55 @@ -+#!/usr/bin/env bash -+# nbdkit -+# Copyright Red Hat -+# -+# Redistribution and use in source and binary forms, with or without -+# modification, are permitted provided that the following conditions are -+# met: -+# -+# * Redistributions of source code must retain the above copyright -+# notice, this list of conditions and the following disclaimer. -+# -+# * Redistributions in binary form must reproduce the above copyright -+# notice, this list of conditions and the following disclaimer in the -+# documentation and/or other materials provided with the distribution. -+# -+# * Neither the name of Red Hat nor the names of its contributors may be -+# used to endorse or promote products derived from this software without -+# specific prior written permission. -+# -+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+# SUCH DAMAGE. -+ -+# Test nbdkit-count-filter. -+ -+source ./functions.sh -+set -e -+set -x -+set -u -+ -+requires_run -+requires_filter count -+requires_plugin sparse-random -+requires_nbdcopy -+ -+log=test-count.out -+rm -f $log -+cleanup_fn rm -f $log -+ -+# We use sparse-random plugin because it both provides some data for -+# nbdcopy to copy, and allows writes. -+nbdkit -v --filter=count sparse-random 1G \ -+ --run 'nbdcopy "$uri" "$uri"' 2>$log -+ -+# Check that something got logged when the filter was unloaded. -+grep "count bytes:" $log --- -2.47.1 - diff --git a/0008-count-Clarify-documentation.patch b/0008-count-Clarify-documentation.patch deleted file mode 100644 index cac2436..0000000 --- a/0008-count-Clarify-documentation.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 745b959b44a67cd3def7c60b873701ad79137bda Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 8 Jul 2025 21:20:52 +0100 -Subject: [PATCH] count: Clarify documentation - -Updates: commit 3512c3ce9308b4d940119ac6cc87f1baa9afb655 -(cherry picked from commit 7c84314ec7411fc1090bf1ca417c453d08fcf364) ---- - filters/count/nbdkit-count-filter.pod | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/filters/count/nbdkit-count-filter.pod b/filters/count/nbdkit-count-filter.pod -index f0437000..c20b4737 100644 ---- a/filters/count/nbdkit-count-filter.pod -+++ b/filters/count/nbdkit-count-filter.pod -@@ -4,17 +4,19 @@ nbdkit-count-filter - count bytes read, written, zeroed and trimmed - - =head1 SYNOPSIS - -- nbdkit --filter=count plugin -+ nbdkit -fv --filter=count plugin - - =head1 DESCRIPTION - - C is a filter for L that simply counts - the number of bytes that are read, written, zeroed and trimmed, and - reports this number in debugging output when the filter is unloaded --(usually when nbdkit exits). -+(usually when nbdkit exits). The filter output can only be seen when -+debugging is enabled (I<-v>) which usually implies using the -+foreground (I<-f>) option as well. - - This is a very simple and lightweight filter. For much more --comprehensive stats about and logging of operations, use -+comprehensive stats and logging of operations, use - L or L instead. - - =head1 PARAMETERS --- -2.47.1 - diff --git a/copy-patches.sh b/copy-patches.sh index 5dc5564..ea96135 100755 --- a/copy-patches.sh +++ b/copy-patches.sh @@ -6,7 +6,7 @@ set -e # directory. Use it like this: # ./copy-patches.sh -rhel_version=10.1 +rhel_version=10.2 # Check we're in the right directory. if [ ! -f nbdkit.spec ]; then diff --git a/nbdkit.spec b/nbdkit.spec index 156c329..e810d34 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -51,11 +51,11 @@ %global verify_tarball_signature 1 # The source directory. -%global source_directory 1.44-stable +%global source_directory 1.45-development Name: nbdkit -Version: 1.44.1 -Release: 2%{?dist} +Version: 1.45.7 +Release: 1%{?dist} Summary: NBD server License: BSD-3-Clause @@ -77,17 +77,12 @@ Source2: libguestfs.keyring Source3: copy-patches.sh # Patches come from the upstream repository: -# https://gitlab.com/nbdkit/nbdkit/-/commits/rhel-10.1/ +# https://gitlab.com/nbdkit/nbdkit/-/commits/rhel-10.2/ # Patches. -Patch0001: 0001-common-Add-ONCE-macro-to-run-code-only-once.patch -Patch0002: 0002-file-zero-Print-the-debug-message-on-the-fallback-pa.patch -Patch0003: 0003-file-trim-Don-t-try-BLKDISCARD-if-earlier-FALLOC_FL_.patch -Patch0004: 0004-common-include-test-once.c-Skip-test-on-macOS-which-.patch -Patch0005: 0005-common-include-test-once.c-Further-fixes-for-pthread.patch -Patch0006: 0006-Remove-deprecated-cacheextents-filter.patch -Patch0007: 0007-New-filter-nbdkit-count-filter-count-bytes-read-writ.patch -Patch0008: 0008-count-Clarify-documentation.patch +Patch0001: 0001-docs-nbdkit-probing.pod-Rearrange-synopsis-to-match-.patch +Patch0002: 0002-server-Document-long-options-and-short-options.patch +Patch0003: 0003-docs-Document-how-to-probe-for-server-command-line-o.patch # For automatic RPM Provides generation. # See: https://rpm-software-management.github.io/rpm/manual/dependency_generators.html @@ -140,6 +135,9 @@ BuildRequires: pkgconfig(libtorrent-rasterbar) BuildRequires: pkgconfig(blkio) %endif BuildRequires: bash-completion +%if !0%{?rhel} +BuildRequires: bash-completion-devel +%endif BuildRequires: perl-devel BuildRequires: perl(ExtUtils::Embed) %if 0%{?rhel} == 8 @@ -158,11 +156,6 @@ BuildRequires: ocaml-ocamldoc BuildRequires: pkgconfig(tcl) BuildRequires: pkgconfig(lua) %endif -# Only needed until the following bug gets fixed in boost: -# https://bugzilla.redhat.com/show_bug.cgi?id=2297642 -%if 0%{?fedora} >= 41 -BuildRequires: openssl-devel-engine -%endif %if 0%{verify_tarball_signature} BuildRequires: gnupg2 %endif @@ -592,8 +585,6 @@ VMware VDDK for accessing VMware disks and servers. %package basic-filters Summary: Basic filters for %{name} Requires: %{name}-server%{?_isa} = %{version}-%{release} -# Remove this in Fedora 43: -Obsoletes: nbdkit-gzip-filter < %{version}-%{release} %description basic-filters This package contains filters for %{name} which only depend on simple @@ -632,6 +623,8 @@ nbdkit-fua-filter Modify flush behaviour in plugins. nbdkit-gzip-filter Decompress a .gz file +nbdkit-indexed-gzip-filter Access .gz contents efficiently. + nbdkit-ip-filter Filter clients by IP address. nbdkit-limit-filter Limit nr clients that can connect concurrently. @@ -640,6 +633,8 @@ nbdkit-log-filter Log all transactions to a file. nbdkit-luks-filter Read and write LUKS-encrypted disks. +nbdkit-map-filter Remap disk blocks. + nbdkit-multi-conn-filter Enable, emulate or disable multi-conn. nbdkit-nocache-filter Disable cache requests in the underlying plugin. @@ -1367,10 +1362,12 @@ fi %{_libdir}/%{name}/filters/nbdkit-extentlist-filter.so %{_libdir}/%{name}/filters/nbdkit-fua-filter.so %{_libdir}/%{name}/filters/nbdkit-gzip-filter.so +%{_libdir}/%{name}/filters/nbdkit-indexed-gzip-filter.so %{_libdir}/%{name}/filters/nbdkit-ip-filter.so %{_libdir}/%{name}/filters/nbdkit-limit-filter.so %{_libdir}/%{name}/filters/nbdkit-log-filter.so %{_libdir}/%{name}/filters/nbdkit-luks-filter.so +%{_libdir}/%{name}/filters/nbdkit-map-filter.so %{_libdir}/%{name}/filters/nbdkit-multi-conn-filter.so %{_libdir}/%{name}/filters/nbdkit-nocache-filter.so %{_libdir}/%{name}/filters/nbdkit-noextents-filter.so @@ -1413,10 +1410,12 @@ fi %{_mandir}/man1/nbdkit-extentlist-filter.1* %{_mandir}/man1/nbdkit-fua-filter.1* %{_mandir}/man1/nbdkit-gzip-filter.1* +%{_mandir}/man1/nbdkit-indexed-gzip-filter.1* %{_mandir}/man1/nbdkit-ip-filter.1* %{_mandir}/man1/nbdkit-limit-filter.1* %{_mandir}/man1/nbdkit-log-filter.1* %{_mandir}/man1/nbdkit-luks-filter.1* +%{_mandir}/man1/nbdkit-map-filter.1* %{_mandir}/man1/nbdkit-multi-conn-filter.1* %{_mandir}/man1/nbdkit-nocache-filter.1* %{_mandir}/man1/nbdkit-noextents-filter.1* @@ -1525,8 +1524,13 @@ fi %files bash-completion %license LICENSE +%if !0%{?rhel} +%dir %{bash_completions_dir} +%{bash_completions_dir}/nbdkit +%else %dir %{_datadir}/bash-completion/completions %{_datadir}/bash-completion/completions/nbdkit +%endif %if 0%{?with_selinux} @@ -1558,6 +1562,10 @@ fi %changelog +* Fri Aug 29 2025 Richard W.M. Jones - 1.45.7-1 +- Rebase to nbdkit 1.45.7 + resolves: RHEL-111242 + * Wed Jul 09 2025 Richard W.M. Jones - 1.44.1-2 - Rebase to nbdkit 1.44.1 resolves: RHEL-78830, RHEL-101180 diff --git a/sources b/sources index e6a3393..e9292d4 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (nbdkit-1.44.1.tar.gz) = 150a31ca7f64b76a4e4cc90d077e88531458f2766c0bb1f6f1ae23176d5c55a2e4dab61be58bd92b166e67fe70b67c9458a04d29978cbb1b89a6fa8ebca4617d -SHA512 (nbdkit-1.44.1.tar.gz.sig) = b987c7cfc0cf4585f3db7c33a19a63ac24b5ea5cf10635c497d2780e70f121fcc82dda983a63ef8464b0c8550dd12811499fd171cf7b368ce1a7f0ddd9b60ae7 +SHA512 (nbdkit-1.45.7.tar.gz) = 0dae8cd809e40f8a67d92e1fd49e8956873cd22037e0d68773392c75eab8357731df67afa48742849f92384edf5ec402fe4195f97ddf4045a250c584500a8448 +SHA512 (nbdkit-1.45.7.tar.gz.sig) = 2239a0a5dbc175a2b9a3d619babbd10a810d534721c84bbdc893d180d674ae5b5f383756b24a6b9fdb1ac3116f7a99e9d4818b5525e8d8ffa33a1a10d12fdccb