search for: plugin_zero

Displaying 20 results from an estimated 64 matches for "plugin_zero".

2019 May 09
1
[nbdkit PATCH] plugins: Use static buffer for plugin_zeroes
...calloc/free altogether if we don't mind the bss being 64M larger. server/plugins.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/server/plugins.c b/server/plugins.c index 947bb6d..acdfa1f 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -594,7 +594,7 @@ plugin_zero (struct backend *b, struct connection *conn, uint32_t count, uint64_t offset, uint32_t flags, int *err) { struct backend_plugin *p = container_of (b, struct backend_plugin, backend); - char *buf; + static const char buf[MAX_REQUEST_SIZE]; uint32_t limit; int r = -1; boo...
2018 Feb 13
3
[nbdkit PATCH 0/2] Consistent plugin return value handling
While working on improving the backend interface to allow filters to handle errors, I noticed that I've introduced some minor incompatibilities for filters that don't quite obey the documentation which states that a callback should return only 0/-1. Prior to my additions, we treated all plugin returns other than -1 as success (sort of makes sense for a positive return, particularly if a
2017 Jan 26
0
[nbdkit PATCH v2 4/6] plugins: Add new nbdkit_set_error() utility function
...till falling back to errno for backwards compatibility. The saved error code has to be thread-safe for use in multithreaded plugins. Note that setting an error value but then returning success from the plugin has no impact; the error value is only consulted when the plugin reports failure. Also, plugin_zero() has to be a bit careful about using EOPNOTSUPP as its trigger to fall back to .pwrite, so that the fallback does not inherit an accidental improper error code. Signed-off-by: Eric Blake <eblake@redhat.com> --- docs/nbdkit-plugin.pod | 16 +++++++++++++--- include/nbdkit-plugin.h | 3 ++-...
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...offset=%" PRIu64, count, offset); if (p->plugin.trim != NULL) - return p->plugin.trim (connection_get_handle (conn), count, offset); + return p->plugin.trim (connection_get_handle (conn, 0), count, offset); else { errno = EINVAL; return -1; @@ -416,7 +417,7 @@ plugin_zero (struct backend *b, struct connection *conn, int result; int err = 0; - assert (connection_get_handle (conn)); + assert (connection_get_handle (conn, 0)); debug ("zero count=%" PRIu32 " offset=%" PRIu64 " may_trim=%d", count, offset, may_trim);...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...>flush (backend, conn) == -1) return get_error (conn); break; case NBD_CMD_TRIM: - if (plugin_trim (conn, count, offset) == -1) + if (backend->trim (backend, conn, count, offset) == -1) return get_error (conn); break; case NBD_CMD_WRITE_ZEROES: - if (plugin_zero (conn, count, offset, - !(flags & NBD_CMD_FLAG_NO_HOLE)) == -1) + if (backend->zero (backend, conn, count, offset, + !(flags & NBD_CMD_FLAG_NO_HOLE)) == -1) return get_error (conn); break; @@ -910,7 +912,7 @@ handle_request (stru...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...; fua=%d", count, offset, fua); if (p->plugin.trim != NULL) - r = p->plugin.trim (connection_get_handle (conn), count, offset); + r = p->plugin.trim (connection_get_handle (conn, 0), count, offset); else { errno = EINVAL; return -1; @@ -438,7 +439,7 @@ plugin_zero (struct backend *b, struct connection *conn, int may_trim = (flags & NBDKIT_FLAG_MAY_TRIM) != 0; bool fua = flags & NBDKIT_FLAG_FUA; - assert (connection_get_handle (conn)); + assert (connection_get_handle (conn, 0)); assert (!(flags & ~(NBDKIT_FLAG_MAY_TRIM | NBDKIT_FLAG_FU...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...>flush (backend, conn) == -1) return get_error (conn); break; case NBD_CMD_TRIM: - if (plugin_trim (conn, count, offset) == -1) + if (backend->trim (backend, conn, count, offset) == -1) return get_error (conn); break; case NBD_CMD_WRITE_ZEROES: - if (plugin_zero (conn, count, offset, - !(flags & NBD_CMD_FLAG_NO_HOLE)) == -1) + if (backend->zero (backend, conn, count, offset, + !(flags & NBD_CMD_FLAG_NO_HOLE)) == -1) return get_error (conn); break; @@ -910,7 +912,7 @@ handle_request (stru...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...>flush (backend, conn) == -1) return get_error (conn); break; case NBD_CMD_TRIM: - if (plugin_trim (conn, count, offset) == -1) + if (backend->trim (backend, conn, count, offset) == -1) return get_error (conn); break; case NBD_CMD_WRITE_ZEROES: - if (plugin_zero (conn, count, offset, - !(flags & NBD_CMD_FLAG_NO_HOLE)) == -1) + if (backend->zero (backend, conn, count, offset, + !(flags & NBD_CMD_FLAG_NO_HOLE)) == -1) return get_error (conn); break; @@ -910,7 +912,7 @@ handle_request (stru...
2018 Jan 16
9
[nbdkit PATCH 0/7] Initial implementation of FUA flag passthrough
Tested via: term1$ qemu-nbd -k $PWD/sock -t -f raw -x foo junk --trace=nbd_\* term2$ ./nbdkit -f -v -e bar nbd socket=$PWD/sock export=foo term3$ qemu-io -t none -f raw nbd://localhost:10809/bar --trace=nbd_\* and checking the traces to see that 'w 0 1' vs. 'w -f 0 1' was able to influence whether the FUA flag showed up at the server in term1. Still to go: figure out how to
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2: - Fixed everything mentioned in the review. Rich.
2018 Jan 16
6
[PATCH nbdkit 0/3] Refactor plugin_* functions into a backend struct.
Somewhat invasive but mostly mechanical change to how plugins are called. This patch is in preparation for adding a second backend subtype for filters. Rich.
2020 Aug 06
2
[PATCH nbdkit] Experiment with parallel python plugin
...#39;], [buf], offset) if n != len(buf): raise RuntimeError("short write") + +def flush(h, flags): + os.fsync(h['fd']) diff --git a/server/plugins.c b/server/plugins.c index d4364cd2..ce4700a3 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -631,6 +631,8 @@ plugin_zero (struct backend *b, void *handle, bool fast_zero = flags & NBDKIT_FLAG_FAST_ZERO; bool emulate = false; bool need_flush = false; + void *zero_buffer = NULL; + int buffer_size = MIN (MAX_REQUEST_SIZE, count); if (fua && backend_can_fua (b) != NBDKIT_FUA_NATIVE) { fla...
2019 Aug 23
1
[nbdkit PATCH 1/3] server: Add internal support for NBDKIT_FLAG_FAST_ZERO
...ruct backend *b, struct connection *conn) +{ + assert (connection_get_handle (conn, 0)); + + debug ("can_fast_zero"); + + return 0; /* Upcoming patch will actually add support. */ +} + static int plugin_can_extents (struct backend *b, struct connection *conn) { @@ -621,15 +631,18 @@ plugin_zero (struct backend *b, struct connection *conn, int r = -1; bool may_trim = flags & NBDKIT_FLAG_MAY_TRIM; bool fua = flags & NBDKIT_FLAG_FUA; + bool fast_zero = flags & NBDKIT_FLAG_FAST_ZERO; bool emulate = false; bool need_flush = false; int can_zero = 1; /* TODO cache...
2017 Jan 20
7
[nbdkit PATCH 0/5] Add WRITE_ZEROES support
The upstream protocol recently promoted NBD_CMD_WRITE_ZEROES from experimental to a documented extension. Exposing support for this allows plugin writers to create sparse files when driven by a client that knows how to use the extension; meanwhile, even if a plugin does not support this extension, the server benefits from less network traffic from the client. Eric Blake (5): protocol: Support
2018 Mar 08
0
[nbdkit PATCH v3 11/15] plugins: Expose new FUA callbacks
...-1; } - if (r != -1 && fua) { - assert (p->plugin.flush); - r = p->plugin.flush (connection_get_handle (conn, 0)); - } + if (r != -1 && need_flush) + r = plugin_flush (b, conn, 0, err); if (r == -1) *err = get_error (p); return r; @@ -500,9 +529,11 @@ plugin_zero (struct backend *b, struct connection *conn, struct backend_plugin *p = container_of (b, struct backend_plugin, backend); char *buf; uint32_t limit; - int result; - int may_trim = (flags & NBDKIT_FLAG_MAY_TRIM) != 0; + int r = -1; + bool may_trim = flags & NBDKIT_FLAG_MAY_TRIM;...
2020 Aug 06
0
[PATCH nbdkit] Experiment with parallel python plugin
...#39;], [buf], offset) if n != len(buf): raise RuntimeError("short write") + +def flush(h, flags): + os.fsync(h['fd']) diff --git a/server/plugins.c b/server/plugins.c index d4364cd2..ce4700a3 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -631,6 +631,8 @@ plugin_zero (struct backend *b, void *handle, bool fast_zero = flags & NBDKIT_FLAG_FAST_ZERO; bool emulate = false; bool need_flush = false; + void *zero_buffer = NULL; + int buffer_size = MIN (MAX_REQUEST_SIZE, count); if (fua && backend_can_fua (b) != NBDKIT_FUA_NATIVE) { fla...
2020 Aug 06
0
Re: [PATCH nbdkit] Experiment with parallel python plugin
...> raise RuntimeError("short write") > + > +def flush(h, flags): > + os.fsync(h['fd']) > diff --git a/server/plugins.c b/server/plugins.c > index d4364cd2..ce4700a3 100644 > --- a/server/plugins.c > +++ b/server/plugins.c > @@ -631,6 +631,8 @@ plugin_zero (struct backend *b, void *handle, > bool fast_zero = flags & NBDKIT_FLAG_FAST_ZERO; > bool emulate = false; > bool need_flush = false; > + void *zero_buffer = NULL; > + int buffer_size = MIN (MAX_REQUEST_SIZE, count); > > if (fua && backend_can_fua (...
2019 Aug 13
3
[nbdkit PATCH 0/2] errno cleanup patches
I ran into these while trying to prepare patches to add NBD_CMD_FLAG_FAST_ZERO, which will expose a new NBD_ENOTSUP wire value. Eric Blake (2): plugins: Don't lose original error when emulating FUA plugins: Permit ENOTSUP as synonym for EOPNOTSUPP docs/nbdkit-filter.pod | 11 ++++++----- docs/nbdkit-plugin.pod | 12 +++++++----- plugins/file/file.c | 16 +++++++++++-----
2018 Feb 13
0
[nbdkit PATCH 2/2] plugins: Consistent error handling on FUA
...h (b, conn, 0); } @@ -439,7 +439,7 @@ plugin_trim (struct backend *b, struct connection *conn, errno = EINVAL; return -1; } - if (r == 0 && fua) { + if (r != -1 && fua) { assert (p->plugin.flush); r = plugin_flush (b, conn, 0); } @@ -503,7 +503,7 @@ plugin_zero (struct backend *b, struct connection *conn, errno = err; done: - if (!result && fua) { + if (result != -1 && fua) { assert (p->plugin.flush); result = plugin_flush (b, conn, 0); } -- 2.14.3
2019 Oct 04
6
[nbdkit PATCH 0/5] Another round of retry fixes
I still don't have .prepare/.finalize working cleanly across reopen, but did find a nasty bug where a botched assertion means we failed to notice reads beyond EOF in both the xz and retry filter. Refactoring backend.c will make .finalize work easier. Eric Blake (5): xz: Avoid reading beyond EOF retry: Check size before transactions tests: Test retry when get_size values change