search for: plugin_pwrite

Displaying 20 results from an estimated 48 matches for "plugin_pwrite".

2019 May 09
1
[nbdkit PATCH] plugins: Use static buffer for plugin_zeroes
...&= ~NBDKIT_FLAG_MAY_TRIM; threadlocal_set_error (0); - limit = count < MAX_REQUEST_SIZE ? count : MAX_REQUEST_SIZE; - buf = calloc (limit, 1); - if (!buf) { - *err = ENOMEM; - return -1; - } + limit = count < sizeof (buf) ? count : sizeof (buf); while (count) { r = plugin_pwrite (b, conn, buf, limit, offset, flags, err); @@ -656,7 +651,6 @@ plugin_zero (struct backend *b, struct connection *conn, } *err = errno; - free (buf); errno = *err; done: -- 2.20.1
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
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
Introduce the concept of a backend. Currently the only type of backend is a plugin, and there can only be one of them. Instead of calling functions like ‘plugin_pwrite’ you call the backend method ‘backend->pwrite (backend, ...)’. The change is largely mechanical. I was able to remove ‘assert (dl)’ statements throughout since we can now prove they will never be called. Note this does not lift the restriction of one plugin per server, and it can *never* do t...
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 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
Introduce the concept of a backend. Currently the only type of backend is a plugin, and there can only be one of them. Instead of calling functions like ‘plugin_pwrite’ you call the backend method ‘backend->pwrite (backend, ...)’. The change is largely mechanical. I was able to remove ‘assert (dl)’ statements throughout since we can now prove they will never be called. Note this does not lift the restriction of one plugin per server, and it can *never* do t...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
Introduce the concept of a backend. Currently the only type of backend is a plugin, and there can only be one of them. Instead of calling functions like ‘plugin_pwrite’ you call the backend method ‘backend->pwrite (backend, ...)’. The change is largely mechanical. I was able to remove ‘assert (dl)’ statements throughout since we can now prove they will never be called. Note this does not lift the restriction of one plugin per server, and it can *never* do t...
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
...ways contains zeroes, but we can't use const or else gcc 9 - * will use .rodata instead of .bss and inflate the binary size. - */ - static /* const */ char buf[MAX_REQUEST_SIZE]; - uint32_t limit = MIN (count, sizeof buf); + uint32_t limit = MIN (count, buffer_size); - r = plugin_pwrite (b, handle, buf, limit, offset, flags, err); + r = plugin_pwrite (b, handle, zero_buffer, limit, offset, flags, err); if (r == -1) break; count -= limit; } + free(zero_buffer); + done: if (r != -1 && need_flush) r = plugin_flush (b, handle, 0, err); diff...
2017 Feb 20
1
Re: Fwd: nbdkit async
...sh_after_command) { op->flags = 0; // clear flags r = plugin_flush_lowlevel (op, op->conn->handle); if (r == -1) // do error stuff; } else if (op->cmd == NBD_CMD_READ) send_reply(op, op->buf, op->count, 0); else send_reply(op, NULL, 0, 0); } int my_plugin_pwrite_lowlevel (void *op, void *handle, void *buf, uint32_t count, uint64_t offset) { if (is_readonly(handle)) { nbdkit_reply_error (op, EROFS); return 0; } if (some critically bad issue) return -1; // this returns right away before write has...
2018 Jan 16
1
Re: [nbdkit PATCH 0/7] Initial implementation of FUA flag passthrough
...there is only one (and not two) pwrite callback per plugin, and either way, the plugin chooses which variant it wants. > (3) Core nbdkit code always defines NBDKIT_PLUGIN_LEVEL == 2 so that > it always sees the new function, but it may need to call the old > function: > > int > plugin_pwrite (...) > { > if (plugin.pwrite != NULL) > plugin.pwrite (handle, buf, count, offset, flags); > else if (plugin.pwrite_old1 != NULL) > plugin.pwrite_old1 (handle, buf, count, offset); > } This part happens whether by your proposal or by mine (see patch 5) - a new nbdkit...
2020 Aug 06
0
[PATCH nbdkit] Experiment with parallel python plugin
...ways contains zeroes, but we can't use const or else gcc 9 - * will use .rodata instead of .bss and inflate the binary size. - */ - static /* const */ char buf[MAX_REQUEST_SIZE]; - uint32_t limit = MIN (count, sizeof buf); + uint32_t limit = MIN (count, buffer_size); - r = plugin_pwrite (b, handle, buf, limit, offset, flags, err); + r = plugin_pwrite (b, handle, zero_buffer, limit, offset, flags, err); if (r == -1) break; count -= limit; } + free(zero_buffer); + done: if (r != -1 && need_flush) r = plugin_flush (b, handle, 0, err); diff...
2020 Aug 06
0
Re: [PATCH nbdkit] Experiment with parallel python plugin
...9;t use const or else gcc 9 > - * will use .rodata instead of .bss and inflate the binary size. > - */ > - static /* const */ char buf[MAX_REQUEST_SIZE]; > - uint32_t limit = MIN (count, sizeof buf); > + uint32_t limit = MIN (count, buffer_size); > > - r = plugin_pwrite (b, handle, buf, limit, offset, flags, err); > + r = plugin_pwrite (b, handle, zero_buffer, limit, offset, flags, err); > if (r == -1) > break; > count -= limit; > } > > + free(zero_buffer); > + > done: > if (r != -1 && need_flush...
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 Jan 16
0
[PATCH nbdkit 3/3] Fix const-correctness of backend pwrite method.
...) (struct backend *, struct connection *conn, uint32_t count, uint64_t offset, int may_trim); diff --git a/src/plugins.c b/src/plugins.c index e81a3d3..dfa9bc5 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -357,7 +357,7 @@ plugin_pread (struct backend *b, struct connection *conn, static int plugin_pwrite (struct backend *b, struct connection *conn, - void *buf, uint32_t count, uint64_t offset) + const void *buf, uint32_t count, uint64_t offset) { struct backend_plugin *p = (struct backend_plugin *) b; -- 2.15.1
2018 Feb 13
0
[nbdkit PATCH 2/2] plugins: Consistent error handling on FUA
...4ffdd42fab5c5d9c6157db396b60866a7a Signed-off-by: Eric Blake <eblake@redhat.com> --- src/plugins.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins.c b/src/plugins.c index 699e9c5..1b0816c 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -412,7 +412,7 @@ plugin_pwrite (struct backend *b, struct connection *conn, errno = EROFS; return -1; } - if (r == 0 && fua) { + if (r != -1 && fua) { assert (p->plugin.flush); r = plugin_flush (b, conn, 0); } @@ -439,7 +439,7 @@ plugin_trim (struct backend *b, struct connection *co...
2018 Jan 16
1
Re: [PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
On 01/16/2018 10:32 AM, Richard W.M. Jones wrote: > Introduce the concept of a backend. Currently the only type of > backend is a plugin, and there can only be one of them. Instead of > calling functions like ‘plugin_pwrite’ you call the backend method > ‘backend->pwrite (backend, ...)’. > > The change is largely mechanical. I was able to remove ‘assert (dl)’ > statements throughout since we can now prove they will never be > called. > > Note this does not lift the restriction of one plugin...
2018 Jan 16
0
Re: [nbdkit PATCH 0/7] Initial implementation of FUA flag passthrough
...nt, uint64_t offset, unsigned flags); #else int (*pwrite) (void *handle, const void *buf, uint32_t count, uint64_t offset, unsigned flags); #endif (3) Core nbdkit code always defines NBDKIT_PLUGIN_LEVEL == 2 so that it always sees the new function, but it may need to call the old function: int plugin_pwrite (...) { if (plugin.pwrite != NULL) plugin.pwrite (handle, buf, count, offset, flags); else if (plugin.pwrite_old1 != NULL) plugin.pwrite_old1 (handle, buf, count, offset); } (4) Internal plugins which don't need the FUA flag can continue to use the level 1 API, which means that we...
2018 Mar 08
0
[nbdkit PATCH v3 11/15] plugins: Expose new FUA callbacks
...;plugin.flush (connection_get_handle (conn, 0), 0); + else if (p->plugin._flush_old) + r = p->plugin._flush_old (connection_get_handle (conn, 0)); else { *err = EINVAL; return -1; } + if (r == -1) + *err = get_error (p); + return r; } static int @@ -441,6 +459,7 @@ plugin_pwrite (struct backend *b, struct connection *conn, int r; struct backend_plugin *p = container_of (b, struct backend_plugin, backend); bool fua = flags & NBDKIT_FLAG_FUA; + bool need_flush = false; assert (connection_get_handle (conn, 0)); assert (!(flags & ~NBDKIT_FLAG_FUA)); @@...
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
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